# Phone

Canonical URL: https://developers.iagenify.com/sdk/ref/providers/phone/
Language: en

`api.storage.device({ deviceId, name, userAgent }) → Promise<ConnectedStorage>`

A visitor's phone or tablet, registered by the application that holds the key — the phone never sees it. Its files live in its own browser.

Status: type: phone · registered for it · files via a bridge

A phone cannot register itself, and that is the whole design: the key stays on your server, the phone keeps nothing but a random identifier, and your server calls `device()` on its behalf.

## Registering one {#register}

```javascript
// On your server — this is where the key is
const phone = await api.storage.device({
  deviceId,                              // kept in the phone's own browser
  name: "Zayd's iPhone",                 // optional
  userAgent,                             // optional, used to name it
});

// phone.type === "phone"   phone.provider === "browser"   phone.deviceId === deviceId
```

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `deviceId` | string | required | `dev_` followed by 16 to 64 letters and digits. Anything else is refused. |
| `name` | string |  | The display name, 80 characters at most. Derived from the user agent when absent. |
| `userAgent` | string |  | The phone's user agent, 400 characters at most. Used to name and describe it. |

## The identifier is yours to keep {#deviceid}

Generate it once in the page, keep it in that browser, and send it with every call. The same identifier always resolves to the same storage, so calling `device()` on every page load is normal and creates nothing new.

```javascript
// In the page
const id = localStorage.getItem("device")
  || `dev_${crypto.randomUUID().replace(/-/g, "")}`;
localStorage.setItem("device", id);
```

> **An identifier that does not match the shape is refused**
>
> invalid_device_id comes back on anything that is not dev_ plus 16 to 64 letters and digits. A UUID with its dashes left in is the usual cause.

## Its files are in its browser {#files}

Nothing of a phone's data is on the account, and nothing of it is on your server either. `phone.files` therefore throws `storage_is_phone` — a refusal that says where the files actually are, rather than pretending there are none.

To reach them, the page that holds them does the work: an agent given `files` as a bridge streams each operation to that page, the page runs it on its own storage, and the answer travels back. That is the subject of [bridges · files](/sdk/agent/bridges/files).

```javascript
const agent = api.agents.create({
  runtime: "local",
  machine: phone,
  files: phoneBridge(),            // yours: it talks to the page
  model: "gemini-3.5-flash",
});
```

## A phone is never the default {#never-default}

Registering one does not move the account's default storage, whatever else is there. A save with no target would have nowhere to go.

## One phone per application {#appname}

`appName`, given to the client when you construct it, separates devices registered by different applications of the same account. The same phone used by two of your applications is two storages, which is what keeps one from listing the other's.

## Two simultaneous registrations are one storage {#race}

Pages double-fire — a refresh, a framework that mounts twice. Concurrent calls with the same identifier settle on a single storage and both get it back, so no guard of yours is needed.

## Errors {#errors}

| Code | Status | When |
| --- | --- | --- |
| invalid_device_id | 400 | `deviceId` does not match `dev_` + 16–64 letters and digits. |
| storage_is_phone | 400 | `phone.files` was reached from outside that browser. |

- [bridges · files](/sdk/agent/bridges/files): Running file operations on the device that holds them.
- [device()](/sdk/ref/storage/device): The call itself.
- [Computer](/sdk/ref/providers/computer): The device whose files are on a disk.

```python
# On your server — this is where the key is
phone = api.storage.device(
    device_id=device_id,           # kept in the phone's own browser
    name="Zayd's iPhone",          # optional
    user_agent=user_agent,         # optional, used to name it
)

# phone.type == "phone"   phone.provider == "browser"
```

```python
# In the page (JavaScript) — the browser keeps its own id:
#   const id = localStorage.getItem("device")
#     || "dev_" + crypto.randomUUID().replace(/-/g, "");
#   localStorage.setItem("device", id);
#
# Python receives that id from the page, e.g. in a request header.
device_id = request.headers["X-Device-Id"]
```

```python
agent = api.agents.create(
    runtime="local",
    machine=phone,
    files=PhoneBridge(),   # yours: an object with list/read/write/mkdir/move/remove that talks to the page
    model="gemini-3.5-flash",
)
```
