---
title: "Create a short-lived stateless token for an agent"
method: POST
path: "/agents/{id}/tokens"
tags: ["Agents"]
---

# Create a short-lived stateless token for an agent

`POST /agents/{id}/tokens`

## Request

- Base URL: `https://api.carbonvoice.app`
- URL: `https://api.carbonvoice.app/agents/{id}/tokens`
- Auth: one of:
  - API key in header `pxtoken`
  - OAuth 2 (implicit, authorization URL `https://api.carbonvoice.app/oauth/authorize`)

Mints a stateless JWT for an agent in your ownership scope (humans: their agents; agents: siblings under the same root human). The JWT includes `user_id` (the agent) and `creator_id` (the root human). Send the returned `token` as `Authorization: Bearer <token>`.

## Path parameters

- `id` string, required

## Request body

- CreateAgentToken
  - `expires_in_seconds` number: Token lifetime in seconds.

## Response `200`

JWT and expiry fields. Use `token` as the bearer credential in the `Authorization` header.

- CreatedAgentToken
  - `token` string, required: JWT string. Use as a bearer token on API requests: send `Authorization: Bearer <token>` to authenticate as the agent user.
  - `expires_in_seconds` number, required
  - `expires_at` string, date-time, required

## Other responses

- `403`

---

[API](https://skmtc.dev/carbonvoice/apis/carbon-voice-api.md) · [All operations](https://skmtc.dev/carbonvoice/apis/carbon-voice-api/llms.txt) · [OpenAPI document](https://skmtc.dev/carbonvoice/apis/carbon-voice-api/revisions/b91c5c845122?raw)
