Skip to main content
GET
/
api
/
token
List Tokens
curl --request GET \
  --url https://api.example.com/api/token/

Overview

Retrieve all API tokens created by the current user, with pagination support.
The /api/token/* endpoints are mainly for Crazyrouter dashboard automation around API key management. They require a user access token plus the New-Api-User header, and are not the normal interface for sk-xxx model calls.

Authentication

Authenticate using the user’s access token with the following headers:
Authorization: Bearer {access_token}
New-Api-User: {user_id}

Request Parameters

p
integer
default:"1"
Page number. The backend accepts older styles too, but 1 is the recommended starting page
size
integer
default:"10"
Items per page, maximum 100

Response Format

{
  "success": true,
  "message": "",
  "data": {
    "page": 1,
    "page_size": 10,
    "total": 1,
    "items": [
      {
        "id": 1,
        "user_id": 1,
        "key": "sk-xxxxxxxxxxxxxxxx",
        "status": 1,
        "name": "My Token",
        "created_time": 1706000000,
        "accessed_time": 1706100000,
        "expired_time": -1,
        "remain_quota": 500000,
        "unlimited_quota": false,
        "model_limits_enabled": true,
        "model_limits": "[\"gpt-5.4\",\"claude-sonnet-4-6\"]",
        "allow_ips": "203.0.113.10",
        "used_quota": 12345,
        "group": "default"
      }
    ]
  }
}

Field Descriptions

FieldTypeDescription
idintToken ID
keystringAPI key in sk-xxx format
statusintStatus: 1=enabled, 2=disabled
namestringToken name
expired_timeintExpiration timestamp, -1 means never expires
remain_quotaintRemaining quota
unlimited_quotaboolWhether quota is unlimited
used_quotaintUsed quota
model_limits_enabledboolWhether the model whitelist is enabled
model_limitsstringModel restriction config string
allow_ipsstringIP whitelist string
groupstringGroup

Code Examples

import requests

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

response = requests.get(
    "https://crazyrouter.com/api/token/?p=1&size=100",
    headers=headers
)

page = response.json()["data"]
for token in page["items"]:
    print(f"[{token['name']}] {token['key'][:10]}... Quota: {token['remain_quota']}")