What a Session Is

A session switches a phone on for use. Starting a session:
  • wakes the phone and keeps its screen on, and
  • connects the phone’s network.
Ending the session lets the phone rest again: its screen turns off and its network is disconnected. Every control endpoint (touch, typing, keys, screen, apps, files, clipboard, Appium) needs an active session on the phone. Without one, that phone’s result has the error code session_required. Get Phones, Reboot Phones and watching a phone’s live video do not need a session. Sessions are not about access. Your phones are private to your organization whether or not a session is active. A phone has at most one session at a time.

Lifecycle

  1. Start Sessions returns once each phone is ready for control.
  2. Use the control endpoints.
  3. End Sessions when you are done.
A session belongs to the user who started it. Your API keys act as you, so your keys and your web login share the same sessions. Opening a phone for control at app.phones.inc starts a session your own API keys can use, and a session you start through the API appears there. Another user’s keys or login cannot take over or control your session; their attempt returns the phone error in_use. Administrators can end a user’s session. The web app keeps a separate hold for each open phone view. Removing a phone from multi-view releases that view’s hold immediately. Closing a tab releases its holds after a short reconnection grace period; refreshing within that period preserves control. The server also cleans up holds after a browser crash or lost connection. Another open view of the same phone keeps its hold. Watching as an observer does not hold the phone. Once the phone confirms that control has ended, slow network cleanup does not keep a browser-only session reserved. The next user can control the phone while its internet connection waits for cleanup. For API work that must continue after the web app closes, call Start Sessions without viewId. This establishes a persistent hold, including when you already control the phone in the web app. Closing browser views does not end that persistent hold. End Sessions explicitly ends the whole session, including any browser views. Starting a session on a phone you already hold returns your existing session. If another user or an automation holds it, the result is in_use.

Expiry

A persistent API session ends by itself 30 minutes after the last request for that phone. Your control requests, live input, and Renew Sessions requests move expiresAt to 30 minutes from now. Watching video alone does not keep a session alive. Browser-only sessions also end when their last view closes or loses its connection; they do not wait for the 30-minute idle expiry. If your code waits for longer than that between actions, call Renew Sessions periodically.

Network Readiness

A session starts as soon as the phone can be controlled. Its internet connection can take longer to come up. The session’s network field tells you where it stands: Poll Get Sessions until network is ready before doing anything on the phone that needs internet. This usually takes a few seconds and can take up to two minutes. If the network error says that previous cleanup could not be confirmed, retrying the session cannot resolve it. Control remains available, but the phone’s internet connection needs network recovery before it can be restored. A phone that is not yet set up for its network refuses to start a session: Start Session answers the phone error network_unavailable and nothing is reserved. Pick another phone; the phone becomes available once its setup is complete.
A phone’s public IP address can change from one session to the next.

Watching a Session

While a session is active, people in your organization can open the phone at app.phones.inc and watch the screen live, and your own code can do the same with a live stream. Either is the easiest way to see what your code is doing.

Reboots

Rebooting an Android phone ends your session on it. Start a new session once the phone’s status is online again.