Creating Device using API appKey problem

I can create a device using api but cant activate. heres where i need help. If i create the device using the web UI i just add the application key (otaa) and then turn on sensor and it activates… i cant see how to get the application key in using the rest api? is there a step by step documentation somewhere on the complete process of adding a device using the rest api?

thank you in advance