# Authentication

> Every tool works without a key. An API key ties an agent's calls to your DECA workspace.

Every tool works with no key and no account; calls are then limited by address (see [Rate limits](https://app.decalabs.ai/docs/reference/limits)). An **API key** ties an agent's calls to your DECA workspace.

| | No key | With a key |
|---|---|---|
| `get_signals`, `get_ideas`, `quote_test` | Yes | Yes, within the key's scopes |
| `get_my_ideas`: ideas written for your workspace | No | Yes, your workspace's only |
| Rate limit | 60 calls a minute per address | 600 calls a minute per key |
| Calls counted in your dashboard | No | Yes, per key and per tool |
| Spending caps on quotes | No | Yes |
| Paid tests | Yes, paid in USDC over x402 | Yes, within the key's caps |

## Make a key

In the DECA dashboard, open **MCP & API** at the bottom of the menu and press **New key**. Only the workspace's owner can make keys.

- **Name** it after the agent that will use it.
- **Choose what it may do**: `read` (signals and ideas), `quote` (price tests) and `test` (pay for and run tests, once they open).
- **Set its caps**: the most it may spend on one test, and in a month. An agent cannot raise them.

The key is shown **once**, when it is made. DECA keeps only a hash of it. If a key is lost or leaked, revoke it and make another.

Keys look like `deca_sk_` followed by 40 letters and digits.

## Send it

As a bearer token, over MCP or REST:

```bash title="Claude Code"
claude mcp add --transport http deca https://app.decalabs.ai/mcp \
  --header "Authorization: Bearer deca_sk_…"
```

```json title="MCP config"
{
  "mcpServers": {
    "deca": {
      "type": "http",
      "url": "https://app.decalabs.ai/mcp",
      "headers": { "Authorization": "Bearer deca_sk_…" }
    }
  }
}
```

```bash title="REST"
curl -H "Authorization: Bearer deca_sk_…" \
  "https://app.decalabs.ai/api/agent/ideas?limit=3"
```

Keep keys out of code you share and out of public repositories. Pass them through your client's secret or environment settings.

## Caps on quotes

With a key that has a cap per test, every option `quote_test` returns carries `within_cap`, and the answer has a `key_cap` object, so the agent can pick an option it may pay for:

```json
{
  "options": [
    { "id": "signal", "budget_usd": 450, "within_cap": true, "…": "…" },
    { "id": "clear", "budget_usd": 900, "within_cap": false, "…": "…" }
  ],
  "key_cap": {
    "per_test_usd": 500,
    "per_month_usd": 1500,
    "note": "Options above $500 are over this key's cap per test; its owner can raise it in MCP & API."
  }
}
```

## When a key is refused

| Code | Status | Meaning |
|---|---|---|
| `invalid_key` | 401 | The key is not one DECA made. Check it, or call without a key. |
| `key_revoked` | 401 | The key was revoked. Make a new one. |
| `scope_missing` | 403 | The key may not use this tool. Add the scope in the dashboard. |

A key that is sent must be good: a bad key is refused, never treated as no key. Over MCP these come back as JSON-RPC error `-32001` with the code in `data.code`.

## Without a key, later

Paid tests will also work with no key: the wallet that pays a test owns it and reads it by signing with that wallet.

Source: https://app.decalabs.ai/docs/reference/authentication
