Authentication

Every request carries an API key. A key is either read or write, and each key has its own rate limit.

For AI agents: the docs index is at /llms.txt, and every page is also served as markdown at its URL plus .md.

#Send the key

Put the key in an Authorization: Bearer header, or in an X-API-Key header. Both are accepted on every authenticated endpoint.

Bearer header
curl https://api.coldagentai.com/v1/account \
  -H "Authorization: Bearer $COLDAGENTAI_API_KEY"
X-API-Key header
curl https://api.coldagentai.com/v1/account \
  -H "X-API-Key: $COLDAGENTAI_API_KEY"

A missing, malformed, revoked or unknown key returns 401 unauthorized with a WWW-Authenticate: Bearer header.

#Read and write scope

ScopeWhat the key can do
readRead only. It cannot change state, send mail or spend credits.
writeEverything a read key can do, plus routes that change state, send mail or spend credits.

Each operation in the API reference names the scope it needs, and the OpenAPI document carries the same value as x-scope. A read key that calls a write route gets 403 forbidden with a message that names the route and tells you to use a write key.

#Creating and revoking keys

  • POST /v1/account/keys creates a key. It needs a write key, and the scope defaults to read.
  • The full key is in the creation response once. It is not stored and cannot be shown again. GET /v1/account lists keys by id, prefix and scope, never the key itself.
  • DELETE /v1/account/keys/:id revokes a key at once. A revoked key is rejected with 401 from then on.

Give each agent its own key with the narrowest scope it needs, so you can revoke one without touching the rest.

#Rate limits

Limits are counted per key: 200 requests per 10 seconds by default. Every authenticated response carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset (Unix seconds).

Over the limit you get 429 rate_limited with a Retry-After header holding the seconds to wait. Wait that long, then send the same request again.

Node
const res = await fetch(url, { headers });
if (res.status === 429) {
  const wait = Number(res.headers.get('retry-after') ?? '1');
  await new Promise((r) => setTimeout(r, wait * 1000));
  // then send the same request again
}
Authentication