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

# One browser per end user

> For a product whose agent works in each of its users' own accounts. One team workspace, one browser and one key per user, a sign-in your user finishes, and webhooks.

Your product has users, and your agent works for each of them in their own accounts. Give each user a Hotkey browser of their own. It stays signed in to their sites for months, your agent never sees their passwords, and when a step needs them (a sign-in, a code), they do it from a link you send.

The steps below use [`/v1`](https://docs.hotkey.so/api) from your backend. Every write takes an `Idempotency-Key`, so each step is safe to send again.

## 1. One workspace for your product

Make one team workspace for the company in the console, under **Settings**, then **Workspace**. Your staff are its members and see every browser. Your users never sign in to Hotkey; they only open hand links.

Don't make a workspace per user. Workspaces are for people who work together, and a plan's limits belong to the workspace.

Make a key for the workspace: switch to it in the console, then **Settings**, **Connect your agent**, **Tokens for scripts**. Your backend keeps it. It is the only key that makes browsers.

Then turn phone alerts off, since you tell your users yourself:

```bash theme={null}
curl -X PATCH https://console.hotkey.so/v1/workspace \
  -H "Authorization: Bearer $HOTKEY_KEY" -H "content-type: application/json" \
  -d '{ "phone_alerts": false }'
```

With them on, every member's phone gets a push for every ask of every user. Asks still show in the console's Needs you either way.

## 2. A browser for each user

```bash theme={null}
curl https://console.hotkey.so/v1/browsers \
  -H "Authorization: Bearer $HOTKEY_KEY" -H "content-type: application/json" \
  -H "Idempotency-Key: browser-user_829" \
  -d '{ "external_id": "user_829", "metadata": { "plan": "pro" }, "time_zone": "Europe/Paris" }'
```

* `external_id` is your id for the user, unique in the workspace. A second browser with it is refused with 409 `browser_exists`, and the error's `browser` field names the first one.
* `GET /v1/browsers?external_id=user_829` finds it later. For an admin page, `?q=` searches names, external ids and metadata (`q=plan:pro`), and `?state=awake` lists those at work now ([filters](https://docs.hotkey.so/api.md#browsers)).
* Names are unique in the workspace, so two users called Ada can't both have `"Acme for Ada"`: the second is refused with 409. Put your own user id in the name your user sees, such as `"Acme for Ada (829)"`; the hand link's page shows it to them ("It opens this one tab of Acme for Ada (829)"). Or leave `name` out: the browser is then named after its `external_id`, and the user's display name can go in `metadata`.
* Making browsers in bulk, send at most 25 requests a second with one key; past that the answer is 429 with `Retry-After`. 300 browsers took 8 to 20 seconds in our runs.
* A new browser sleeps. It wakes when it is used and sleeps again on its own, so a user who isn't active costs nothing.

## 3. A key that reaches only that browser

Give the agent that works for this user a key for their browser alone:

```bash theme={null}
curl https://console.hotkey.so/v1/agent_keys \
  -H "Authorization: Bearer $HOTKEY_KEY" -H "content-type: application/json" \
  -d '{ "name": "Agent for user_829", "browser": "brw_k3m9x2p7qa4t" }'
```

The answer's `secret` is shown once. With it, on `/v1` and on MCP:

* `list_connected_browsers` and `GET /v1/browsers` show this browser only, and calls without a `tabId` go to it.
* Another user's browser, tabs, asks, downloads and events answer as if they don't exist (404 on `/v1`, "doesn't exist" over MCP). A mistake in your agent, or a prompt injected by a page, can't reach another user.
* It makes no browsers or keys and changes no workspace setting (403 `key_scoped`).
* It stops working when the browser is deleted or moved to another workspace.

Connect the agent over MCP with it as you would any key: `https://mcp.hotkey.so` with `Authorization: Bearer <secret>`. A browser has at most 5 keys of its own.

## 4. The first sign-in

Ask the user to sign in, and say where to send them back:

```bash theme={null}
curl https://console.hotkey.so/v1/asks \
  -H "Authorization: Bearer $USER_KEY" -H "content-type: application/json" \
  -d '{ "browser": "brw_k3m9x2p7qa4t", "url": "https://www.linkedin.com/login",
        "reason": "Sign in to LinkedIn so we can post for you",
        "return_url": "https://app.acme.com/connected?user=829" }'
```

Send the answer's `link` to your user, by email, text or in your app. It opens that one tab with no sign-in to Hotkey. They sign in, press Done, and the page sends them to your `return_url`. If they can't, Can't do it takes a note, and they go back the same way.

The link's page names your team workspace as who asks ("Sign in for Acme", "Acme sent you this link from Hotkey"), so name the workspace after your product. An agent that asks with `request_human` is named by the `title` of its MCP client instead.

* `return_url` is https (http only on `localhost`). The link's page says where it goes back to, and never tells your user to answer an agent in a chat. Without a team name to show, it names your app by `return_url`'s host.
* A link opened again after the step ended, or after its 30 minutes, sends your user back to `return_url` too. Have that page offer a new link when the ask still waits (below).
* A link works for 30 minutes. If the user comes later, make a new one and send that:

  ```bash theme={null}
  curl -X POST https://console.hotkey.so/v1/asks/ask_k3m9x2p7qa4t_7f3a91c2e0d4/link \
    -H "Authorization: Bearer $USER_KEY"
  ```

  The old link stops at once. The ask itself waits up to `timeout_minutes`, a day by default.
* An email can sit unread for longer than that. Put your own address in it, such as `https://app.acme.com/connect/829`, and when your user opens it, read the ask (`GET /v1/asks/{id}`): send them to its `link`, or make a new one when `link` is null, or a new ask when it ended.
* Someone who opens a link that ended reads that it ended, with a button back to your `return_url`. Your user reaches that page after Done, after Can't do it, and from a link that ended, so have it read the ask (`GET /v1/asks/{id}`) before it says they're connected.
* An agent asks the same way with `request_human`, which also takes `return_url`.
* Add `"save_sign_in": true` and your user may let the browser keep the password they sign in with, so the next time the site signs the browser out, your agent's `sign_in` signs it back in without them ([Sign-ins your users let the browser keep](https://docs.hotkey.so/link-sign-ins.md)).

From then on the browser stays signed in. Your agent works in it and asks again only when a site asks for the person again.

## 5. Many users at once: a nightly run

Your plan sets how many browsers work at once ([Plans and limits](https://docs.hotkey.so/limits.md#plans), 50 on Scale), and every user's browser counts while it is awake. `GET /v1/workspace` says both numbers (`plan.browsers_at_once`, `plan.browsers_working`). When every place is taken, a call that needs one more browser waits up to 20 seconds for one to free, then fails: `/v1` answers 429 `browsers_busy` with `Retry-After: 30`, and an MCP tool call answers with an error whose `_meta.retryAfter` is 30. Nothing ran, so send it again then. A browser frees its place once nothing has used it for 15 seconds, and one kept awake only by an ask that nobody has open frees it too (its link wakes the browser again).

So a run over hundreds of users:

* Runs at most `plan.browsers_at_once` users at a time, as a pool: start the next user when one finishes, rather than in fixed waves.
* Puts each browser to sleep when its user is done, with `POST /v1/browsers/{id}/sleep`. Its place goes to the next user at once, where otherwise each new start waits out the 15 seconds. In a run of 300 users 50 at a time, no start waited for a place this way, against 50 that did without it; in one of 12 users 3 at a time, the run took 13 s instead of 64 s. The browser keeps its logins and wakes in a second or two the next night.
* Treats `browsers_busy` and 503 as "try again after `Retry-After`", and puts the user back in the queue.

A user whose site wants them again (a bank's fresh sign-in, a new device check) gets an ask (step 4), and the run moves on to the next user.

## 6. Webhooks

Register an endpoint for the workspace to hear about every user's browser:

```bash theme={null}
curl https://console.hotkey.so/v1/webhook_endpoints \
  -H "Authorization: Bearer $HOTKEY_KEY" -H "content-type: application/json" \
  -d '{ "url": "https://app.acme.com/hotkey", "events": ["ask.*", "browser.crashed"] }'
```

* `ask.done` and `ask.cancelled` say the user finished or couldn't; the event's `browser` names whose browser it is, with its `external_id`, so you find your user from the event alone.
* An endpoint made with a user's key, or with `"browser": "brw_…"` in the body, gets that browser's events only.
* See [Webhooks](https://docs.hotkey.so/webhooks.md) for signatures and retries.
* The endpoint's address must be https and resolve to a public address. To test on your own machine, put your receiver behind a tunnel (cloudflared, ngrok) and register its https address.

## 7. Your support staff

Your staff are members of the team workspace and see every user's browser in the console, live. Each browser object has a `console` address that opens it there; link to it from your admin page.

To show a user's browser inside your own admin page, [embed its live view](https://docs.hotkey.so/embed.md): list your admin site's origin on the workspace, mint a short-lived view-only embed for that browser from your backend, and put its `url` in an iframe. The console and hand links themselves can't be framed by another site.

## 8. When a user leaves

```bash theme={null}
curl -X DELETE "https://console.hotkey.so/v1/browsers?external_id=user_829" -H "Authorization: Bearer $HOTKEY_KEY"
```

This erases the browser for good: its profile, logins, saved passwords and passkeys, downloads and backups. The answer comes at once: 200 when it is done, or 202 while an awake browser stops; either way it is gone from every list from then on, and the `browser.deleted` webhook says when its files are gone. The keys made for it stop working at once, and the endpoints filtered to it are deleted a minute later, after its last events have gone out. In a team, the key of an owner or admin deletes browsers; a user's key never does.

Many users at once, up to 100 a request:

```bash theme={null}
curl https://console.hotkey.so/v1/browsers/delete -H "Authorization: Bearer $HOTKEY_KEY" -H "content-type: application/json" \
  -d '{ "external_ids": ["user_829", "user_830"] }'
```

## 9. Billing your users

`GET /v1/usage?group_by=external_id` gives each of your users' minutes awake, agent calls, asks, downloads and storage for a range of days, this month by default, and `format=csv` gives it as a spreadsheet. Users who left during the month keep their row. Each browser object also carries this month's `usage`, for an admin page. See [Usage](https://docs.hotkey.so/api.md#usage).


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