Skip to main content
POST
JavaScript
Requests a new device from the specification in the request body. The response includes the device, its resolved billingStrategy, and its stream token.

Choose a device type

Use android_cloud_phone for the cloud Android phone offering. For example:
Send your normal API authentication with this request. Explicit minute billing still requires sufficient minute balance and an available concurrency allowance. The accepted device types are android_cloud_phone, ios_phone and device_slot. Any other value is rejected with HTTP 422. A listed type that is not available for creation in your deployment returns DEVICE_TYPE_UNAVAILABLE (HTTP 422). This is different from temporarily having no free devices.

Choose a billing mode

A missing subscription and exhausted subscription slots are distinct denials, but both allow auto to try minutes. Billing-service failures and indeterminate responses never trigger fallback. When neither mode is enabled, creation is denied. Fallback is another admission attempt, not a guarantee that creation will succeed. An explicit subscription request without entitlement returns SUBSCRIPTION_REQUIRED (HTTP 402). When minute billing is enabled, the message suggests explicitly selecting billing=minute, subject to its own checks. A minute-billed request whose cloud-phone minute balance is exhausted (the plan’s minute feature is spent, not a generic credits shortfall) returns MINUTE_BALANCE_EXHAUSTED (HTTP 402). The remedy is a plan upgrade, a one-off minute top-up, or the next billing period, not a credits top-up. Minute-billed concurrency limits keep the generic PAYMENT_REQUIRED (HTTP 402) shape.

Idempotency

Send an optional Idempotency-Key header (1-255 printable ASCII characters, no spaces) to make a retry safe. Retrying with the same key and the same request returns the same device, with the original status, its current state and Idempotent-Replayed: true; no second device is created or billed.
  • The same key with a different request (device type, country, billing, profile or spec) returns 422 idempotency_key_reused.
  • While the first request is still running, a retry returns 409 idempotency_request_in_progress with Retry-After: 1; retry shortly.
  • If the device has since been terminated, deleted or transferred to another owner, the retry returns 404 (still marked Idempotent-Replayed: true) and never a stream token.
  • A create that is denied before any device exists (for example a billing or capacity denial) frees the key, so a retry re-evaluates the request.
  • A create that fails after the device was announced (for example a provider error) binds the key to that device instead, so a retry can never create a second one: the retry is a replay (404 if that device is already terminated). This is a deliberate deviation from “a failed create always frees the key”; use a new key to start over.
  • A create that is cancelled because it ran too long follows the same rule: the key stays bound only if a device was created, and is otherwise freed.
  • A malformed key returns 400 invalid_idempotency_key. Without the header the endpoint behaves exactly as before.
Keys are scoped to your account and kept for at least 24 hours.

Authorizations

Authorization
string
header
required

Bearer token via Authorization header

Headers

Idempotency-Key
string

Optional. 1-255 printable ASCII characters without spaces. Retrying with the same key and request returns the same device instead of creating another one; see the Idempotency section of the create-device guide.

Required string length: 1 - 255
Pattern: ^[!-~]{1,255}$

Query Parameters

deviceType
enum<string>

Device type: android_cloud_phone (cloud Android phone), ios_phone or device_slot. Any other value is rejected with 422. Not every device type is available for creation; an unavailable type returns DEVICE_TYPE_UNAVAILABLE (422).

Available options:
android_cloud_phone,
ios_phone,
device_slot
Example:

"android_cloud_phone"

country
string

ISO 3166-1 alpha-2 country code. If omitted the system picks the country with the most availability.

profileId
string

Profile ID to use as device spec

template
string

Optional device template, e.g. onboarding. The device gets the template's Android version and preinstalled apps and is ready in seconds when a prepared phone is available; otherwise it boots with the same setup. Country, name and proxy still come from this request. Cannot be combined with profileId, apps or androidVersion. Omit it to create from the request alone.

Maximum string length: 80
Example:

"onboarding"

billing
enum<string>
default:auto

Billing mode. 'auto' tries subscription first, then minute billing if no subscription entitlement exists or all subscription slots are in use, provided minute billing is enabled. When subscription billing is disabled, auto uses minutes directly. Billing-service failures never trigger fallback. 'subscription' requires an available subscription slot and never falls back. 'minute' uses minute billing only, subject to balance and concurrency checks. Modes depend on the device type's billing configuration.

Available options:
auto,
subscription,
minute

Body

application/json
androidVersion
integer<int64>
apps
string[] | null
carrier
object
country
string
files
string[] | null
identifiers
object
locale
string
location
object
name
string
proxy
object
timezone
string

Response

OK

activeTaskId
string
required
assignedAt
string<date-time> | null
required
createdAt
string<date-time>
required
id
string
required
name
string
required
platform
enum<string>
required

Operating system the device runs.

Available options:
android,
ios
state
string
required
stateMessage
string
required
streamUrl
string
required
taskCount
integer<int64>
required
terminatesAt
string<date-time> | null
required
type
string
required
updatedAt
string<date-time>
required
$schema
string<uri>
read-only

A URL to the JSON Schema for this object.

Example:

"https://example.com/schemas/DeviceInfo.json"

billingStrategy
string
createdBy
string
ownerId
string
providerId
string
streamToken
string
userId
string
deprecated

Deprecated: use ownerId/createdBy.