Devices
Manage devices
Start, stop and control a phone, and know what each state means.
States
| State | Meaning |
|---|---|
| starting | Being created, started or restarted. A job is running for it. |
| running | On and reachable from the dashboard, the API and ADB. |
| error | Running, but its last health check failed. |
| stopped | Off. Apps and data are kept. After about 10 minutes a stopped phone moves to storage; Start brings it back in a few minutes. A phone stopped for 30 days moves to Trash. |
Start, stop, reset and delete
GET /v1/devices # your phones POST /v1/devices/{name}/start POST /v1/devices/{name}/stop POST /v1/devices/{name}/restart POST /v1/devices/{name}/reset # wipe apps and data, same Android version DELETE /v1/devices/{name} # to Trash for 14 days DELETE /v1/devices/{name}?forever=1 # for good, at once GET /v1/trash # deleted phones and when they go POST /v1/trash/{name}/restore # back as a stopped phone
Start, stop and restart answer 202 with a job; follow it with GET /v1/jobs/{id}. Reset brings the phone back like new in 1 to 5 minutes. Stop keeps everything; Reset does not. Delete moves the phone to Trash: it stops, is not billed, and comes back as a stopped phone with POST /v1/trash/{name}/restore within 14 days; after that it is deleted with its data. ?forever=1 deletes at once and cannot be undone. On an account that has never paid, Delete always deletes at once. Starting a phone that has been stopped for a while can take a couple of minutes.
Screenshots and single steps
GET /v1/devices/{name}/screenshot?w=540 # PNG, or a smaller JPEG with w
POST /v1/devices/{name}/action {"op":"open_app","package":"com.android.chrome"}action runs one step: open_app, close_app, url, tap, swipe, text, key, scroll, and the text helpers find_text, tap_text, wait_text, screen_text. For an agent loop use Observe and act.
Names
Every phone has an API name such as c3f9a41d2, a label (its name in the dashboard, or "Phone #N") and a number. Rename a phone with POST /v1/devices/{name}/label.
Physical phones
Besides cloud phones you can rent a physical Android phone. In the API it is the same device with kind: "physical" (cloud phones have kind: "cloud"): the screen, observe, act, action and Tasks work the same way.
POST /v1/devices {"kind":"physical","country":"US"} # rent one, paid from the balance
DELETE /v1/devices/{name} # return itA physical phone is rented for 30 days and renews from the balance. It stays on: stop and ADB answer 409 not_supported. reset erases everything on it and keeps the rental. POST /v1/devices/{name}/network with {"country":"DE"} moves its internet to another country, and an empty body gives a new IP. Files from the Library are sent to it like to any device; your own APK files install only where that is enabled for the phone, otherwise install apps on it the way you do on any phone. Returning it erases everything on it.