Tonedocs
API referencesecrets

Store a credential for tool calls

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. A key with less gets 403 insufficient_scope.

POST
/v1/secrets
AuthorizationBearer <token>

Authorization: Bearer tone_live_… or tone_test_…. The prefix IS the environment: a test key reaches only the sandbox, and no request field bridges the two.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/secrets" \  -H "Content-Type: application/json" \  -d '{    "allowedOrigin": "https://api.example.com",    "name": "Carselona API key",    "value": "sk_live_51H…"  }'
{  "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"  }}
Was this page helpful?