API reference · Account and tokens

Create a token

POST/v1/tokens

Create an API token. The token is shown once.

On this page

Auth. An API token: Authorization: Bearer lb_… (create one). Signed-in web sessions work too.

Limits. Each token counts toward your plan's API tokens (5, 20 or 100).

Parameters

Body

NameTypeRequiredDescription
namestringnoA name you will recognise, for example laptop. Default default.
scopesarray of stringnoScopes; default read, stream and subscribe.
agentobjectnoThe agent this token belongs to, {name, version}; deliveries and attestations then carry it.

Request

Terminal
curl -X POST "https://api.langbot.ai/v1/tokens" \
  -H "Authorization: Bearer $LANGBOT_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "laptop", "agent": {"name": "mention-sniper", "version": "1.4.0"}}'

Response

201 Created

JSON
{ "id": "tok_01J9…", "name": "laptop", "scopes": ["read", "stream", "subscribe"], "agent": { "name": "mention-sniper", "version": "1.4.0" }, "created_at": 1760050000000, "last_used_at": null, "token": "lb_…" }

Errors

StatuscodeWhen
401auth_requiredNo token was sent.
401token_invalidThe token was not recognised (mistyped, revoked or expired).
422validation_errorA parameter failed validation; detail[].loc names it.
402quota_exceededYour plan's API tokens are all in use; revoke one or move up a plan.
429rate_limitedOver your request budget; wait Retry-After seconds.

Every error body is {"detail": …, "code": "…"}; branch on code. All codes: Errors.