---
title: "Authentication · Docs"
description: "How Donut Browser's local REST API checks the bearer token: where the token is, how to send it from curl, Node.js, Python or PowerShell, and each error."
url: "https://donutbrowser.com/docs/authentication/"
---

# Authenticate to the local API

Every request to a `/v1` route must carry the API token as a bearer token. The desktop app makes the token and keeps it on your computer.

```http
Authorization: Bearer <token>
```

## Where to find the token

Open **Integrations** (**Cmd/Ctrl+I**) → **Local API**. The tab has the **Enable Local API Server** switch, the **Port**, the **Authentication Token** with a copy button, and an example request. **More examples** opens ready requests in cURL, JavaScript and Python with your token filled in; keep copies of them private.

![Integrations page, Local API tab. Enable Local API Server is on and running on http://127.0.0.1:10108. Port 10108 with Save, a masked authentication token with show and copy buttons, an example curl request, and a Connection test with the steps Configured, Reachable and Credential accepted.](https://donutbrowser.com/img/docs/integrations.webp "The local REST API: port, token and a ready-to-run example.")

## Export it

```bash
# ~/.zshrc or ~/.bashrc
export DONUT_API_KEY="<token>"
```

```powershell
# Add to $PROFILE to keep it
$env:DONUT_API_KEY = "<token>"
```

## Send it

```bash
curl -sS http://127.0.0.1:10108/v1/profiles \
  -H "Authorization: Bearer $DONUT_API_KEY"
```

```javascript
const response = await fetch("http://127.0.0.1:10108/v1/profiles", {
  headers: { Authorization: `Bearer ${process.env.DONUT_API_KEY}` },
});
```

```python
import os, requests

response = requests.get(
    "http://127.0.0.1:10108/v1/profiles",
    headers={"Authorization": f"Bearer {os.environ['DONUT_API_KEY']}"},
    timeout=10,
)
```

```powershell
Invoke-RestMethod -Uri "http://127.0.0.1:10108/v1/profiles" `
    -Headers @{ Authorization = "Bearer $env:DONUT_API_KEY" }
```

`/openapi.json` and `/v1/openapi.json` need no token.

## What the token grants

One token opens every `/v1` route. Anyone with it can create and delete profiles, read cookies and, on Pro, launch and drive browsers. The server listens on `127.0.0.1` only, so a caller must already run on your computer. On a shared computer, keep the token out of shell history and shared scripts.

This token opens the local API only. Remote MCP uses a `dmk_` credential instead; see [Remote MCP](https://donutbrowser.com/docs/remote-mcp).

## Errors

| Status | Meaning |
| --- | --- |
| `401` | The `Authorization` header is missing, or the token is wrong. The body is empty. |
| `402` | The route needs a plan you do not have, for example `run` without Pro. |
| `403` | The Wayfern terms are not accepted yet. Accept them in the app. |
| `429` | An automation route passed the hourly limit. Wait for the `Retry-After` seconds. |

Check the status code: the `401` body is empty.
