Skip to main content
Opens the active session for a device, or reuses it if one already exists. Returns session_id and expires_at.
You usually do not call this directly: phone_run_task creates or reuses a session automatically and returns its session_id. Call phone_session_start when you want the session in hand before dispatching work, or to intentionally split workflows with force_new.

Parameters

string
The device to open the session on. Omit to use your default device.
boolean
Pass true only for an intentionally separate workflow. The default reuses the device’s active session, which is almost always what you want.

Response

string
Pass this on later task calls to keep related tasks in one workflow.
string
When the session expires. Start a new session once it has passed - task calls against an expired session fail with session_not_found_or_inactive.

Behavior

  • A session groups related tasks on one device. After it starts, its session_id determines the target phone for phone_run_task and phone_session_end; changing your default device does not reroute it.
  • Sessions survive individual task completions - reuse the same session_id for follow-up tasks until the whole workflow is done.