# Store a credential for tool calls

Source: https://docs.usetone.ai/reference/secrets/create

> Reference the returned `id` from a tool as `http.auth.secretId`.

`POST /v1/secrets`
Reference the returned `id` from a tool as `http.auth.secretId`. The value is encrypted at rest and never returned again. `allowedOrigin` binds it to one host: a tool on any other host is refused when the agent is saved and again when it runs. With an API key `allowedOrigin` is required, and a live key or the dashboard is needed (a test key gets `403`), because agents are shared by both lanes. Rotation is create a new secret, point the tools at it and publish, then delete the old one.

Requires the `admin` scope.

## Request body

| Field | Type | | Meaning |
|---|---|---|---|
| `allowedOrigin` | string | optional | The one origin (`https://host[:port]`) tools may send this secret to. A tool on any other host is refused when the agent is saved, and again when it runs. **Required with an API key.** In the dashboard it is optional, and the first tool saved with the secret binds it. |
| `name` | string | required | A label for people, unique in your organization. Tools reference the returned `id`, not the name. |
| `value` | string | required | The credential. Accepted here only and never returned by any route. |

### Example request

```json
{
  "allowedOrigin": "https://api.example.com",
  "name": "Carselona API key",
  "value": "sk_live_51H…"
}
```

## Response

| Field | Type | | Meaning |
|---|---|---|---|
| `allowedOrigin` | string | null | required | The one origin tools may send it to. Null until bound: a secret made in the dashboard is bound by the first tool saved with it. |
| `createdAt` | string | required | RFC 3339, UTC. |
| `id` | string | required | Reference it from a tool as `http.auth.secretId`. |
| `lastUsedAt` | string | null | required | When a call last sent it. RFC 3339, UTC; null if never. |
| `name` | string | required | The label you gave it. |

### Example response

```json
{
  "data": {
    "allowedOrigin": "https://api.example.com",
    "createdAt": "2026-11-11T09:30:00.000Z",
    "id": "4c8f8f4e-3b1a-4d7c-9a92-1f2e3d4c5b6a",
    "lastUsedAt": null,
    "name": "Carselona API key"
  }
}
```
