Skip to content

Create a token request

Ask for a personal token; the person signs it in at `verification_url`

POST /api/v1/tokens

CLI sign-in required · personal tokens cannot manage tokens

Needs a sign-in (theseus login); a personal token gets insufficient_scope.

Example request

Link to this section
Shell
# Token management needs a CLI sign-in; personal tokens cannot do it.
# token create handles browser approval and collection.
theseus token create --name "Review reader" --scope read --workspace example-team

Content type application/json

  • name string required

    Minimum length 1 · Maximum length 100

  • scopes array of string required

    Minimum items 1 · Each item: One of read, notes:write, runs:write, webhooks:manage, cli:download

  • workspaces array of string required

    Workspace IDs, as GET /me lists them

    Minimum items 1 · Maximum items 50 · Each item: Minimum length 1

  • repositories array of string or null

    Repository IDs to limit it to; omit or null for every one

    Default null · Minimum items 1 · Maximum items 100 · Each item: Pattern ^rep_

  • expires_in_days integer

    Default 90 · Minimum 1 · Maximum 365

Waiting for the person to sign the token in

Response fields

Content type application/json

  • id string required

  • status string required

    Always pending

  • user_code string required

    The code the person confirms in the browser

  • verification_url string (uri) required

    Where the person signs the token in

  • expires_at string (date-time) required

  • interval integer required

    Seconds to wait between collections

Example responses

Link to this section

Waiting for browser approval

Illustrative response · complete

{
  "id": "hnd_EXAMPLE",
  "status": "pending",
  "user_code": "<browser-confirmation-code>",
  "verification_url": "https://app.theseus.dev/login/device",
  "expires_at": "2026-10-08T12:10:00Z",
  "interval": 5
}
400 · The request is not valid

Error response fields

401 · A valid bearer token is required

Error response fields

403 · The credential's scopes do not allow this

Error response fields

426 · Upgrade the CLI: run theseus update

Error response fields

429 · Too many requests

Headers

  • Retry-After integer

    Seconds to wait before the next request, when known

Error response fields

500 · Theseus could not complete the request; retrying will not help

Error response fields

503 · Theseus is unavailable; retry the same request

Headers

  • Retry-After integer

    Seconds to wait before the next request, when known

Error response fields

Error response fields

Content type application/problem+json

  • type string (uri) required

    Identifies the problem type; branch on code instead

  • title string required

  • status integer required

  • detail string

  • code string required

    Why the request failed. New codes may be added: treat an unknown one by its status

    One of invalid_request, unauthenticated, not_in_plan, insufficient_scope, admission_required, not_found, ambiguous, conflict, rate_limited, internal_error, unavailable, search_authorization_pending, search_unavailable, cli_upgrade_required

  • request_id string required

    Quote this when reporting the problem

  • errors array of FieldError

    With invalid_request: what is wrong with each field

    errors fields
    • path string required

      Where in the request, as dotted segments

    • message string required

  • required_scope string

    With insufficient_scope: the scope the operation needs

  • next string

    Recovery action, such as theseus update

  • candidates array of Candidate

    With ambiguous: what the request could mean; ask which

    candidates fields
    • id string required

    • path string required

    • kind string required

    • title string required

    • url string (uri) required