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,
"model_limits_enabled": true,
"model_limits": "<string>",
"status": 123,
"allow_ips": "<string>",
"group": "<string>"
}
'import requests
url = "https://api.example.com/api/token/"
payload = {
"id": 123,
"name": "<string>",
"remain_quota": 123,
"unlimited_quota": True,
"expired_time": 123,
"model_limits_enabled": True,
"model_limits": "<string>",
"status": 123,
"allow_ips": "<string>",
"group": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
id: 123,
name: '<string>',
remain_quota: 123,
unlimited_quota: true,
expired_time: 123,
model_limits_enabled: true,
model_limits: '<string>',
status: 123,
allow_ips: '<string>',
group: '<string>'
})
};
fetch('https://api.example.com/api/token/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/token/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'id' => 123,
'name' => '<string>',
'remain_quota' => 123,
'unlimited_quota' => true,
'expired_time' => 123,
'model_limits_enabled' => true,
'model_limits' => '<string>',
'status' => 123,
'allow_ips' => '<string>',
'group' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/token/"
payload := strings.NewReader("{\n \"id\": 123,\n \"name\": \"<string>\",\n \"remain_quota\": 123,\n \"unlimited_quota\": true,\n \"expired_time\": 123,\n \"model_limits_enabled\": true,\n \"model_limits\": \"<string>\",\n \"status\": 123,\n \"allow_ips\": \"<string>\",\n \"group\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.example.com/api/token/")
.header("Content-Type", "application/json")
.body("{\n \"id\": 123,\n \"name\": \"<string>\",\n \"remain_quota\": 123,\n \"unlimited_quota\": true,\n \"expired_time\": 123,\n \"model_limits_enabled\": true,\n \"model_limits\": \"<string>\",\n \"status\": 123,\n \"allow_ips\": \"<string>\",\n \"group\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/token/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": 123,\n \"name\": \"<string>\",\n \"remain_quota\": 123,\n \"unlimited_quota\": true,\n \"expired_time\": 123,\n \"model_limits_enabled\": true,\n \"model_limits\": \"<string>\",\n \"status\": 123,\n \"allow_ips\": \"<string>\",\n \"group\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyAPI Key & Console Management
Update Token
Update the configuration of an existing token
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,
"model_limits_enabled": true,
"model_limits": "<string>",
"status": 123,
"allow_ips": "<string>",
"group": "<string>"
}
'import requests
url = "https://api.example.com/api/token/"
payload = {
"id": 123,
"name": "<string>",
"remain_quota": 123,
"unlimited_quota": True,
"expired_time": 123,
"model_limits_enabled": True,
"model_limits": "<string>",
"status": 123,
"allow_ips": "<string>",
"group": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
id: 123,
name: '<string>',
remain_quota: 123,
unlimited_quota: true,
expired_time: 123,
model_limits_enabled: true,
model_limits: '<string>',
status: 123,
allow_ips: '<string>',
group: '<string>'
})
};
fetch('https://api.example.com/api/token/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/token/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'id' => 123,
'name' => '<string>',
'remain_quota' => 123,
'unlimited_quota' => true,
'expired_time' => 123,
'model_limits_enabled' => true,
'model_limits' => '<string>',
'status' => 123,
'allow_ips' => '<string>',
'group' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/token/"
payload := strings.NewReader("{\n \"id\": 123,\n \"name\": \"<string>\",\n \"remain_quota\": 123,\n \"unlimited_quota\": true,\n \"expired_time\": 123,\n \"model_limits_enabled\": true,\n \"model_limits\": \"<string>\",\n \"status\": 123,\n \"allow_ips\": \"<string>\",\n \"group\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.example.com/api/token/")
.header("Content-Type", "application/json")
.body("{\n \"id\": 123,\n \"name\": \"<string>\",\n \"remain_quota\": 123,\n \"unlimited_quota\": true,\n \"expired_time\": 123,\n \"model_limits_enabled\": true,\n \"model_limits\": \"<string>\",\n \"status\": 123,\n \"allow_ips\": \"<string>\",\n \"group\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/token/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": 123,\n \"name\": \"<string>\",\n \"remain_quota\": 123,\n \"unlimited_quota\": true,\n \"expired_time\": 123,\n \"model_limits_enabled\": true,\n \"model_limits\": \"<string>\",\n \"status\": 123,\n \"allow_ips\": \"<string>\",\n \"group\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyLast updated: 2026-06-06
Overview
Modify the name, quota, expiration time, model permissions, and other settings of an existing token.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
Use user-side authentication with these headers:Authorization: Bearer your_access_token
New-Api-User: 1
Request Parameters
Token ID
Token name
Remaining quota
Whether quota is unlimited
Expiration timestamp,
-1 means never expiresWhether to enable the model whitelist
Model restriction config string, for example
["gpt-5.5","claude-opus-4-8"]Status: 1=enabled, 2=disabled
IP whitelist string
Group
Response Format
The current endpoint returns the updated token object:{
"success": true,
"message": "",
"data": {
"id": 10,
"name": "Production-Updated",
"status": 1,
"remain_quota": 200000,
"unlimited_quota": false,
"model_limits_enabled": true,
"model_limits": "[\"gpt-5.5\",\"claude-opus-4-8\"]",
"allow_ips": "203.0.113.10",
"group": "default"
}
}
Code Examples
import json
import requests
headers = {
"Authorization": "Bearer your_access_token",
"New-Api-User": "1",
"Content-Type": "application/json",
"User-Agent": "Mozilla/5.0"
}
response = requests.put(
"https://api.crazyrouter.com/api/token/",
headers=headers,
json={
"id": 10,
"name": "Production-Updated",
"remain_quota": 200000,
"model_limits_enabled": True,
"model_limits": json.dumps(["gpt-5.5", "claude-opus-4-8"])
}
)
print(response.json())
curl -X PUT https://api.crazyrouter.com/api/token/ \
-H "Authorization: Bearer your_access_token" \
-H "New-Api-User: 1" \
-H "Content-Type: application/json" \
-d '{
"id": 10,
"name": "Production-Updated",
"remain_quota": 200000,
"model_limits_enabled": true,
"model_limits": "[\"gpt-5.5\"]"
}'
Updating a token does not regenerate the API key. If you need a new key, delete the token and create a new one.
⌘I