---
title: "POST /oauth/auth-codes/mint"
method: POST
path: "/oauth/auth-codes/mint"
---

# POST /oauth/auth-codes/mint

`POST /oauth/auth-codes/mint`

## Request

- Base URL: `https://api.useanima.sh/v1`
- URL: `https://api.useanima.sh/v1/oauth/auth-codes/mint`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-API-Key`

## Request body

- object: Mint a one-shot authorization code (10-min TTL by default)
  - `clientId` string, required: OAuth client_id (anima_oauth_apps row)
  - `agentId` string: Optional — restrict grant to a single agent
  - `redirectUri` string, uri, required: Where the consent callback lands
  - `scope` string, required: Space-delimited scope list
  - `codeChallenge` string, required: PKCE S256 challenge (RFC 7636)
  - `codeChallengeMethod` 'S256'
  - `ttlSeconds` integer
  - `consentMetadata` object: Identity hints cached on the resulting grant
    - `consentEmail` string, nullable
    - `consentEmailVerified` boolean
    - `consentName` string, nullable

## Response `200`

OK

- object: Newly-minted authorization code (cleartext, one-time disclosure)
  - `code` string, required: Raw authorization code — return to the consenting client ONCE
  - `expiresAt` string, date-time, required

## Other responses

- `400`: 400
- `401`: 401
- `404`: 404

---

[API](https://skmtc.dev/useanima/apis/anima-api.md) · [All operations](https://skmtc.dev/useanima/apis/anima-api/llms.txt) · [OpenAPI document](https://skmtc.dev/useanima/apis/anima-api/revisions/aaa148188980?raw)
