# Link Desktop to Writ Cloud

> Make APIs on your computer callable from Writ Cloud, your assistant or your code, without opening ports.

Source: https://usewrit.app/docs/uplink/

Link Writ Desktop to your Writ account and the APIs on your computer become callable from Writ Cloud,
from your code and from your AI assistant, wherever they are. The app opens one connection outward to
Writ Cloud: you open no port and your computer gets no public address. The link is included on every
plan.

## Link your computer

-

1. **Start from Writ Desktop**

Open **Account** (in the sidebar footer, **Connect free account** when you are not linked yet) and click **Connect a cloud account**.

-

2. **Approve in your browser**

Writ shows a code. Click **Open the approval page**, sign in to Writ Cloud (or create a free account), check that the code matches, and approve.

-

3. **Choose where your data stays**

The first link asks **Where your data stays**. **Keep everything on this computer** uses your account only to sign in and unlock your plan. **Also use Writ Cloud** turns on cloud runs, Writ’s AI, the marketplace, email and SMS alerts and
sync. You can change this later in **Settings → General → This machine**.

On Writ Cloud, **Agents → Connect a machine → Writ Desktop** shows the same path with a
download link. Linked computers appear in the **Agents** list: see [Your own machines](https://usewrit.app/docs/agents).

## Choose what Cloud may call

Nothing on your computer is callable until you say so, one workflow at a time. Open the workflow in
Writ Desktop, tab **Call**, and turn on **Callable from the cloud**.

| Sent to Writ Cloud | Stays on your computer |
| --- | --- |
| The workflow’s name and description | Its steps, selectors and code |
| Its inputs, output field names and function names | Your sign-ins and secrets |
| The inputs of each call, and the result it returns to the caller | The data it saves on your computer |

The run itself happens on your computer, with your browser, your sign-ins and your internet
connection. Runs on your own computer are never charged in credits.

## Call it from Cloud, your code or your assistant

### From your code

Use a Writ Cloud API key (`wt_`, from **Developers → API Keys**). First list
the workflows your linked computers offer:

GET `https://api.usewrit.app/api/v1/local-workflows` wt_ key · workflows:read

```bash
curl https://api.usewrit.app/api/v1/local-workflows \
  -H "Authorization: Bearer $WRIT_API_KEY"
```

```python
import os, requests

res = requests.get(
    "https://api.usewrit.app/api/v1/local-workflows",
    headers={"Authorization": f"Bearer {os.environ['WRIT_API_KEY']}"},
)
for wf in res.json()["data"]:
    print(wf["id"], wf["name"], wf["device_name"], wf["device_online"])
```

```typescript
const res = await fetch("https://api.usewrit.app/api/v1/local-workflows", {
  headers: { Authorization: `Bearer ${process.env.WRIT_API_KEY}` },
});
const { data } = await res.json();
for (const wf of data) console.log(wf.id, wf.name, wf.device_name, wf.device_online);
```

```json
{
  "object": "list",
  "data": [
    {
      "id": 318,
      "agent_id": "writ-9e84034ee2d7",
      "local_id": "12",
      "name": "Supplier prices",
      "description": "Prices from the supplier portal",
      "input_schema": {
        "type": "object",
        "properties": { "sku": { "type": "string", "description": "Input: sku" } },
        "required": ["sku"],
        "output_fields": ["sku", "price", "in_stock"]
      },
      "cloud_callable": true,
      "status": "active",
      "device_name": "Office Mac",
      "device_online": true
    }
  ]
}
```

Then run one by its `id`. The call waits for the result, up to 300 seconds.

POST `https://api.usewrit.app/api/v1/local-workflows/{id}/run` free wt_ key · workflows:execute

Body

- `inputs` (object): The workflow’s inputs.
- `function_name` (string): Run one function of an API, or function_names for several.
- `mutation_mode` (string): For a function that writes: dry_run previews it without sending.
- `device_persona_id` (string): Run as a sign-in saved on that same computer (device::).

```bash
curl -X POST https://api.usewrit.app/api/v1/local-workflows/318/run \
  -H "Authorization: Bearer $WRIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"inputs": {"sku": "A-1042"}}'
```

```python
import os, requests

res = requests.post(
    "https://api.usewrit.app/api/v1/local-workflows/318/run",
    headers={"Authorization": f"Bearer {os.environ['WRIT_API_KEY']}"},
    json={"inputs": {"sku": "A-1042"}},
    timeout=310,
)
print(res.status_code, res.json())
```

```typescript
const res = await fetch("https://api.usewrit.app/api/v1/local-workflows/318/run", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.WRIT_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ inputs: { sku: "A-1042" } }),
});
console.log(res.status, await res.json());
```

```json
{
  "task_id": "5b0c3f0e-8a1d-4c55-9a43-1f0f3b1f2e77",
  "success": true,
  "extracted_data": { "sku": "A-1042", "price": 18.4, "in_stock": true },
  "error": null,
  "duration_ms": 4120,
  "device": { "agent_id": "writ-9e84034ee2d7", "name": "Office Mac" },
  "reaches_local_network": false
}
```

`GET /api/v1/devices` (scope `devices:read`) lists your linked computers with
their name, system, whether each is online, and how many callable workflows and sign-ins each offers.

### From your assistant

Connect Writ Cloud to your assistant (see [Connect an AI assistant](https://usewrit.app/docs/mcp))
and ask in plain words, for example “Run my supplier prices workflow on my office Mac”. The assistant:

- lists your computers with `writ_devices`, and can point the conversation at one with `action='use'`;
- finds your desktop workflows with `writ_list_workflows` and runs one with `writ_run_workflow`, as `local:`;
- can send any run to your computer with the run controls `device` or `execution_target`: `local` (your computer only) or `auto` (your computer when it is online, else Writ Cloud).

Sign-ins saved on a desktop sign in from that computer’s own vault. The credentials never leave it.

### From Writ Cloud

A workflow saved on Writ Cloud can also run on your computer. In its **Call** tab, set the
execution target to **Local agent** or **Auto (local, else cloud)**, or pick **Run on a device** from **Run**.

## When your computer is offline

A computer counts as online while Writ Desktop is running and connected. When it is not, a call to one
of its workflows fails at once with `409` and `device_offline`. Nothing is queued,
and Writ does not run it somewhere else on its own.

```json
{
  "detail": {
    "error": "device_offline",
    "code": "device_offline",
    "message": "This workflow runs on Office Mac, and Office Mac is offline. Start Writ on Office Mac, then run it again.",
    "device": { "agent_id": "writ-9e84034ee2d7", "name": "Office Mac" },
    "reaches_local_network": false
  }
}
```

A run moves to Writ Cloud only with your agreement: when you set the target to **Auto (local, else cloud)**, or when your assistant asks you first and then runs it with `execution_target='cloud'`. A run on Writ Cloud happens on Writ’s servers, off your computer and
your IP address, and costs credits. A workflow that reaches your local network can only run on its own
computer.

## Privacy, disconnecting and limits

**Keep everything on this computer** (in **Settings → General → This machine**)
uses your account only to sign in and unlock your plan. The cloud agent that receives calls from Writ
Cloud is off, and so are sync, cloud runs and the public URL. Turn it off to use Writ Cloud features
again; your earlier settings come back.

To unlink, open **Account** in Writ Desktop and click **Disconnect**. The
computer signs out of your Writ account and switches to local-only mode. Your cloud workflows, monitors
and personas stay in your Writ account. On Writ Cloud, **Disconnect** in the **Agents** list stops sending work to that computer.

Each plan links a number of computers at once (offline computers do not count):

| Plan | Linked machines |
| --- | --- |
| Free | 1 |
| Starter | 1 |
| Pro | 2 |
| Growth | 5 |
| Scale | 20 |
| Enterprise | Unlimited |

> **limit:** At the limit, a new computer cannot link. Disconnect one, or upgrade your plan.

## Next

-
- [Writ Desktop](https://usewrit.app/docs/desktop): Install the app and run everything on your computer.
-
- [Your own machines](https://usewrit.app/docs/agents): The Agents page and the open-source agent.
-
- [Connect an AI assistant](https://usewrit.app/docs/mcp): Give your assistant your cloud and desktop APIs.
