# Mint a short-lived token from this key

`POST /keys/tokens` · Rivier · keys

Mint a short-lived token from this key: at most its scopes, minutes to live, no key management.

- Scope: keys:write
- Sdk: keys.token.create
- Cli: keys token create
- Events: keys.token.minted

## Request body

`application/json`

```json
{
  "type": "object",
  "properties": {
    "scopes": {
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 40
      },
      "maxItems": 60
    },
    "ttlSeconds": {
      "type": "integer",
      "minimum": 60,
      "maximum": 3600
    },
    "allowedOrigins": {
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 200
      },
      "maxItems": 20
    },
    "ipAllowlist": {
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 60
      },
      "maxItems": 20
    },
    "rpmLimit": {
      "type": "integer",
      "minimum": 1,
      "maximum": 100000
    },
    "subject": {
      "type": "string",
      "maxLength": 120
    }
  },
  "additionalProperties": false
}
```

## Responses

- `201`: Success
- `400`: The request was malformed
- `401`: No valid credential
- `403`: The credential lacks the scope, origin or address
- `429`: Over the key's rate limit; see Retry-After

## Example

```sh
curl -X POST 'https://api.rivier.ai/keys/tokens' \
  -H 'Authorization: Bearer $KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "scopes": [
    "string"
  ],
  "ttlSeconds": 0,
  "allowedOrigins": [
    "string"
  ],
  "ipAllowlist": [
    "string"
  ],
  "rpmLimit": 0,
  "subject": "string"
}'
```
