Skip to main content
PUT
/
api
/
token
Update Token
curl --request PUT \
  --url https://api.example.com/api/token/ \
  --header 'Content-Type: application/json' \
  --data '
{
  "id": 123,
  "name": "<string>",
  "remain_quota": 123,
  "unlimited_quota": true,
  "expired_time": 123,
  "models": [
    "<string>"
  ],
  "status": 123,
  "subnet": "<string>"
}
'

Overview

Modify the name, quota, expiration time, model permissions, and other settings of an existing token.

Request Parameters

id
integer
required
Token ID
name
string
Token name
remain_quota
integer
Remaining quota
unlimited_quota
boolean
Whether quota is unlimited
expired_time
integer
Expiration timestamp, -1 means never expires
models
string[]
List of allowed models
status
integer
Status: 1=enabled, 2=disabled
subnet
string
IP whitelist (CIDR format)

Response Format

{
  "success": true,
  "message": "Token updated successfully"
}

Code Examples

import requests

headers = {
    "Authorization": "Bearer your_access_token",
    "New-Api-User": "1",
    "Content-Type": "application/json",
    "User-Agent": "Mozilla/5.0"
}

# Update token quota and model permissions
response = requests.put(
    "https://crazyrouter.com/api/token/",
    headers=headers,
    json={
        "id": 10,
        "name": "Production-Updated",
        "remain_quota": 200000,
        "models": ["gpt-4o", "claude-sonnet-4-20250514", "gemini-2.5-flash"]
    }
)

print(response.json())
Updating a token does not regenerate the API Key. If you need a new Key, delete the token and create a new one.