> ## Documentation Index
> Fetch the complete documentation index at: https://vetta.sh/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Mobile devices

> Cloud Android phones and iPhones you look at, tap, type into, install apps on, and destroy. The third member of the computer suite.

> [!NOTE]
>
> See [Computers](https://vetta.sh/docs/api/computers.md) for the Linux sandbox and [Browser sessions](https://vetta.sh/docs/api/browser-sessions.md) for the managed browser. A mobile device is a sibling of both: its own resource, with its own lifecycle. It needs no computer.

A **mobile device** is a cloud phone — an Android phone or an iPhone: a screen, touch input and an app lifecycle. It is usually ready in under a minute (a few minutes with `apps` at create; an iPhone up to about three), driven through a small set of actions, watched live from the dashboard, and ends when you delete it or when its own timers fire. There is **no pause**: idle cost is controlled by `idle_timeout_minutes` and `max_duration_minutes`, both set at create; the platform checks them every minute.

## The mobile device object

**id** `string`

Unique id (e.g. `mob_...`).

**object** `string`

Always `mobile_device`.

**name** `string`

Human-readable name. The one field you can change after create.

**platform** `string`

`android` or `ios`.

**os\_version** `string | null`

`13`, `14` or `15` on Android; `null` on iOS, which has no version to choose.

**model** `string`

`phone`. `tablet` and `watch` are reserved and refused today.

**jurisdiction** `string`

`us`, `eu` or `as` — where the device runs (the US, Germany or Singapore) and where its traffic comes from: a residential IP in that country, with the phone's GPS, timezone, locale and carrier matched to it. It is the one placement control; a region is never a parameter.

**status** `string`

`creating`, `ready`, `terminated` or `failed`. See [Truth](#truth-who-says-what-the-status-is).

**idle\_timeout\_minutes** `integer`

Minutes without an action after which the platform ends the device (1–180, default 10). Checked once a minute.

**max\_duration\_minutes** `integer`

Hard ceiling on the device's life (1–1440, default 120).

**apps** `string[]`

The apps asked for at create, installed from the platform's app catalogue when the device starts (an install the catalogue fails is not reported here; take a screenshot or call `install_app` to check): package names on Android (`com.spotify.music`), App Store bundle ids on iOS (`com.burbn.instagram`). There is no upload route; to add one to a running device, use [`install_app`](#act-on-the-device).

**termination\_reason** `string | null`

`null` while alive; then `requested`, `idle_timeout`, `max_duration`, `unfunded` (stopped by the platform because the balance or plan no longer covered it) or `unknown`.

**error** `string | null`

One sentence when provisioning failed, else `null`.

**created\_at** `string`

Creation timestamp.

**terminated\_at** `string | null`

When it ended, or `null` while alive.

**session\_id** `string | null`

The agent session whose [`mobile` tool](https://vetta.sh/docs/capabilities/tools#the-mobile-tool) opened it, the session it was created for (`session_id` at create), or `null`.

## Create a mobile device

`POST /v1/mobile_devices` → `202 Accepted` — scope `computers:write`. The row is recorded before the provider is asked, so a create whose answer is lost is still found and ended, never a device nobody can find; a provision that failed leaves the list. The request then waits up to \~45 seconds for the device to become `ready` and answers with whatever is true at that moment. An Android phone usually takes under a minute (two to three with `apps` at create) and an iPhone up to about three, so expect `creating` and poll `GET /v1/mobile_devices/{id}` until it is `ready`. There is no limit on how many devices an organization runs, only on what it can pay for: a create is admitted when the prepaid balance covers **10 minutes of runway for every live device and the new one, each at its own rate**, plus what the live ones have run so far — one Android phone needs 2,500 credits, one iPhone 4,000, and a fifth Android phone 12,500 when four are running, plus the minutes they have accrued. Short of that, the create is `402 insufficient_credits` before anything is provisioned, and the message names the amount needed. When every phone slot on the platform is in use, the create is `429 rate_limited`; try again shortly. A device bills per minute from create to end — 250 credits on Android, 400 on iOS, its residential network included — booked when it ends ([Pricing](https://vetta.sh/docs/platform/pricing.md#priced-tools)).

**name** `string`

Defaults to `device`.

**platform** `string`

`android` (the default) or `ios`.

**os\_version** `string`

Android only: `13` | `14` | `15`, defaults to `15`. Omit it for `ios`: an iPhone has no version to choose, and sending one is `400 validation_failed`.

**model** `string`

`phone`, the default and today the only value; `tablet` and `watch` are `400 validation_failed`.

**jurisdiction** `string`

`us` | `eu` | `as`. Defaults to `us`. Sets where the phone runs and the country of the residential IP its traffic exits through.

**idle\_timeout\_minutes** `integer`

1–180. Defaults to `10`.

**max\_duration\_minutes** `integer`

1–1440. Defaults to `120`.

**apps** `string[]`

Up to 10 apps installed from the platform's app catalogue when the device starts: package names on Android (`com.spotify.music`), App Store bundle ids on iOS (`com.burbn.instagram`, `com.openai.chat`). No URLs; no store account is needed. The catalogue carries many but not all store apps (on Android, Wikipedia and DuckDuckGo are not offered; iPhones carry fewer), and there is no route that lists it: an app it lacks is `404`, `param: apps`, before any device starts, so check one with `install_app` on a running device first.

**session\_id** `string`

An agent session of yours. The device is filed under it, and that session's [`mobile` tool](https://vetta.sh/docs/capabilities/tools#the-mobile-tool) uses it instead of opening its own phone. When the session ends, the device ends with it. A session that has already ended is refused with `409 session_terminal`.

```bash cURL theme={"system"}
curl -fsSL https://api.vetta.sh/v1/mobile_devices \
  -H "authorization: Bearer sk_live_..." \
  -H "content-type: application/json" \
  -H "idempotency-key: $(uuidgen)" \
  -d '{ "name": "pixel", "os_version": "15", "idle_timeout_minutes": 15 }'
```

```typescript TypeScript theme={"system"}
const device = await naive.mobileDevices.create({ name: "pixel", os_version: "15", idle_timeout_minutes: 15 });
const iphone = await naive.mobileDevices.create({ name: "iphone", platform: "ios", apps: ["com.burbn.instagram"] });
```

```json Response theme={"system"}
{
  "id": "mob_01H8YZ...",
  "object": "mobile_device",
  "name": "pixel",
  "platform": "android",
  "os_version": "15",
  "model": "phone",
  "jurisdiction": "us",
  "status": "ready",
  "idle_timeout_minutes": 15,
  "max_duration_minutes": 120,
  "apps": [],
  "termination_reason": null,
  "error": null,
  "created_at": "2026-09-22T10:00:00Z",
  "terminated_at": null,
  "session_id": null
}
```

## Retrieve & list

```bash theme={"system"}
GET /v1/mobile_devices/{id}   # retrieve one -> 200 (reconciled with the provider)
GET /v1/mobile_devices        # list (cursor-paginated), terminated and failed devices excluded -> 200
GET /v1/mobile_devices?session_id=ses_...   # only the phone that agent session opened
```

Both take any authenticated key. See [Pagination](https://vetta.sh/docs/api/pagination.md) for list parameters.

### Truth: who says what the status is

The platform ends a device on its idle and maximum timers, checking once a minute; the provider can also end one on its own (an error, a stopped account) without telling us. `status` on a row is what we last wrote; **`GET /v1/mobile_devices/{id}` asks the provider and rewrites the row** when they disagree, filling `terminated_at` and `termination_reason`. The **list reads rows only** — a provider call per row is not a read — so a list can lag until a detail is opened. Neither read wakes or bills anything: a device bills while it is alive whether or not you look at it.

## Rename

`PATCH /v1/mobile_devices/{id}` → `200 OK` — scope `computers:write`. The body is strict: any field other than `name` is `400` `validation_failed` naming it. Recorded in the [audit log](https://vetta.sh/docs/api/audit-logs.md) as `mobile_device.updated`.

**name** `string` *required*

1–200 characters.

## Act on the device

`POST /v1/mobile_devices/{id}/act` → `200 OK` — scope `computers:write`. One action per call; the device must be `ready`, otherwise `409` `computer_unavailable`. Not written to the audit log: an action is work, as `exec` on a computer is.

| `type` | Fields | What it does |
| - | - | - |
| `screenshot` | — | The screen in `image`, a JPEG at half the screen's resolution on Android and full resolution on an iPhone (393 wide). Its pixels map 1:1 to `tap` coordinates. An iPhone can show landscape StandBy, at boot and again 15–45 s after `HOME`, and a tap does not leave it: the platform opens Settings to leave it when the phone becomes ready and whenever a screenshot finds it, so that screenshot shows Settings in portrait. |
| `element_tree` | — | `output` is `{ screen: { width, height }, elements: [{ text, resource_id, content_desc, class, clickable, bounds }] }`: the named elements on screen, `bounds` as `[left, top, right, bottom]` in screenshot pixels. Most iPhones publish no element tree: there this and a `selector` tap are `400 validation_failed`, so tap by `x`, `y` from the screenshot. |
| `tap` | `x`, `y` **or** `selector` | Tap a point, or the element a selector names. `selector` is `{ text?, resource_id?, content_desc? }`, at least one; the first matching element is tapped, an exact text match before a partial one. A point at or past the screen's edge is refused. |
| `type` | `text` | Type into the focused field. Refused when the phone reports no editable field and no keyboard; tap a field first. |
| `press_key` | `key` | `HOME`, `BACK`, `RECENTS`, `NOTIFICATIONS`, `ENTER`, `DEL`, `TAB`, `ESCAPE`, `SPACE`, arrows (`DPAD_*`), volume, `POWER`, or a numeric key code. Case-insensitive; a `KEYCODE_` prefix is accepted. These are Android's keys: an iPhone has no `BACK` or `RECENTS`, so navigate it with taps and `HOME`. |
| `scroll` | `direction`, `amount?` | `up`, `down`, `left` or `right` — `down` shows what is below. `amount` is in screenshot pixels, 40% of the screen by default. |
| `open_url` | `url` | Android phones (an iPhone answers `400`). Hand a URL or deep link to the phone. `output` says it was sent, not what opened: a link no app handles does nothing, so take a screenshot. To open an app, use `launch_app`. |
| `launch_app` | `package` | Start an installed app by package name at its launcher screen, e.g. `com.android.settings` for Settings. Android phones. |
| `install_app` | `app` | Install an app from the platform's app catalogue onto the running device: a package name on Android, an App Store bundle id on iOS, the same ids as `apps`. No upload and no store account. The catalogue carries many but not all store apps; one it does not carry is `400`, `param: app`, in a second or two, which is also the way to check an app before naming it at create. `output` is `{ app, status, error }`: `installed`, `failed` (with `error`, one sentence), or `installing` — the call waits up to about a minute, and a large app can take longer; call `install_app` again with the same `app` to check on it (a repeat follows the attempt already running). |

The selector words match the screen's elements:

| ours | matches |
| - | - |
| `text` | the element's visible text |
| `resource_id` | its `resource-id` |
| `content_desc` | its accessibility label (`content-desc`) |

```bash cURL theme={"system"}
curl -fsSL https://api.vetta.sh/v1/mobile_devices/mob_01H8YZ.../act \
  -H "authorization: Bearer sk_live_..." \
  -H "content-type: application/json" \
  -d '{ "type": "tap", "x": 360, "y": 1100 }'
```

```typescript TypeScript theme={"system"}
const shot = await naive.mobileDevices.act("mob_01H8YZ...", { type: "screenshot" });
await naive.mobileDevices.act("mob_01H8YZ...", { type: "tap", selector: { text: "Sign in" } });
await naive.mobileDevices.act("mob_01H8YZ...", { type: "install_app", app: "com.spotify.music" });
```

```json Response theme={"system"}
{
  "object": "mobile_action_result",
  "type": "screenshot",
  "output": null,
  "image": { "content_type": "image/jpeg", "data": "/9j/4AAQSkZJRg..." }
}
```

`image` is the screen, filled only by `screenshot`. Every other action answers with `image: null` and, in `output`, a one-line account of what ran (`element_tree` and `install_app` answer the objects above), so take a screenshot to see its result. A tap by `selector` taps the centre of the first element that matches, an exact `text` beating a partial one; a selector nothing matches is `404 not_found` naming `selector`; read `element_tree` for what is on screen.

## Open a live view

`POST /v1/mobile_devices/{id}/live_view` → `200 OK` — scope `computers:write`. Takes no body. Opening it counts as activity for the idle timer, as an action does; taps through the stream do not reach the API, so a client that keeps a phone open only through the stream should take a screenshot now and then.

> [!WARNING]
>
> `stream` is a **bearer credential**: a `wss://` address and a token that let anyone holding them see and drive the device with no further authentication. It is minted on demand, never stored, never written to the audit trail, never returned inside any other object, and withheld from the [MCP catalogue](https://vetta.sh/docs/api/mcp.md). `expires_at` is `null`: it lives as long as the device does.

`url` is the device's page on the dashboard, where the stream plays for a signed-in member of your organization. It is a link, not a credential. `stream` is what the dashboard's realtime player takes: it is returned only to a signed-in member, and is `null` for an API key (open `url` instead) or when no stream is offered.

`409 computer_unavailable` while the device is still starting, `404 not_found` once it has ended. Audited as `mobile_device.live_view_opened` — who and when, never the credential.

```json Response theme={"system"}
{
  "object": "mobile_live_view",
  "url": "https://app.usenaive.ai/mobile/mob_01H8YZ...",
  "expires_at": null,
  "stream": { "url": "wss://...", "token": "..." }
}
```

## Delete a mobile device

`DELETE /v1/mobile_devices/{id}` → `200 OK` — scope `computers:write`. Ends the device at the provider and marks the row `terminated` with `termination_reason: "requested"`. Idempotent. Audited as `mobile_device.deleted`. A device whose create has not been answered yet (`creating`, its first few minutes) is `409 computer_unavailable` — try again shortly; ending it then could leave the phone being made with nothing to end it.

```json Response theme={"system"}
{ "id": "mob_01H8YZ...", "object": "mobile_device", "deleted": true }
```

## On the developer platform

In a [developer workspace](https://vetta.sh/docs/developers/overview.md) a mobile device is a **workspace resource** called a *mobile sandbox*:
no identity owns it, and it shows under **Identities → Resources** in the console and in
[`GET /v1/resources?type=mobile_device`](https://vetta.sh/docs/developers/resources#mobile-sandboxes). Create, act and live view need a funded
workspace; reads, rename and delete do not. `session_id` is for agent sessions and is never set from the developer
platform. Price: $0.05 a minute for Android and $0.08 for an iPhone, billed once when the device ends. Limits: 2 live
devices and 20 starts in any 24 hours; past them a create answers `429 rate_limited`.

## Errors

| Code | Status | When |
| - | - | - |
| `validation_failed` | 400 | A bad `os_version` (or any `os_version` on `ios`), an unknown `platform`, a `model` other than `phone`, an app that is not a package name or bundle id (or that the app catalogue does not carry), a tap with no target or off the screen (naming `x` or `y`), typing with nothing to type into (naming `text`), an unknown key, an `element_tree` or `selector` tap on a device that publishes no element tree (most iPhones), `open_url` on an iPhone. |
| `insufficient_credits` | 402 | Creating a device when the balance does not cover 10 minutes for every live device and the new one, plus what the live ones have run (an agent's phone counts too). |
| `forbidden` | 403 | `launch_app` on a protected app the phone will not start. |
| `not_found` | 404 | Not your device, or a live view on one that has ended; a selector that matches nothing (`selector`); `launch_app` on an app that is not installed (`package`); a create naming an app that is not in the app catalogue (`apps`). |
| `session_terminal` | 409 | Creating a device with the `session_id` of a session that has ended. |
| `computer_unavailable` | 409 | Acting on a device that is not `ready`; the provider did not answer a create in time. Its row stays `creating` for about 5 minutes while the platform checks, then leaves the list, and any phone that appeared is ended unbilled; it counts toward the balance check until then. |
| `rate_limited` | 429 | No device capacity is available on the platform right now; try again shortly. iPhone capacity is small, so iPhones meet this far sooner than Android phones. |
| `feature_not_configured` | 501 | This deployment cannot provision mobile devices; the create and the list answer it before anything is written. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.