API Overview
The Token Management API lets you handle the full lifecycle of your API keys in code, instead of clicking through the console one key at a time. The most common use case is batch issuance: giving each team member, downstream customer, or project its own key, each with its own limits on how much it can spend, which models it can call, and how long it stays valid.Quota limit
remain_quota caps how much this key can spend in totalModel limit
models sets an allowlist; calls to anything outside it are rejectedExpiry limit
expired_time sets an expiry timestamp, after which the key stops workingHow to Get Your System Token
The Token Management API authenticates with a System Token, which is not the same thing as an API key.Access Console
api.apiyi.com/account/profile to access your profile pageFind System Token
Generate AccessToken

Endpoints
All endpoints authenticate the same way: put the raw system token in theAuthorization header,
with no Bearer prefix.
https://api.apiyi.com.
Creating a Token
Request Example
Request Fields
Response Example
Batch Creation
There is no server-side batch endpoint — passing something likecount in the request body
has no effect and still creates a single token. Batch issuance is done by looping on the client.
- Python
- Node.js
- cURL
Using the Three Limits
Quota limit
remain_quota caps what the token can spend. The conversion matches the
Balance Query API:
Conversion Rule
remain_quota to
5000000 with unlimited_quota set to false. Consumption so far is readable from the token’s
used_quota field.
Model limit
models is a comma-separated allowlist. Once set, calling a model outside the list is rejected:
models means no restriction.
Expiry limit
expired_time is a Unix-seconds timestamp, with -1 meaning never. For example, a key that
expires in 30 days:
Listing Tokens
Updating a Token
Disabling and Deleting
Disable (keeps the record)
Once disabled, the key stops working immediately — calls with it return 401 — but the token record and its usage history are retained.Delete (irreversible)
FAQ
The key returned at creation does not work — why?
The key returned at creation does not work — why?
key in the response does not include the sk- prefix. Prepend it yourself:
the usable API key is sk- followed by the returned value.Why does my newly created token report insufficient quota?
Why does my newly created token report insufficient quota?
remain_quota was set nor unlimited_quota was set to true at creation.
That default combination produces a token with zero quota. Recreate it with one of the two
specified explicitly.Why do model_limits or allow_ips have no effect?
Why do model_limits or allow_ips have no effect?
model_limits_enabled — currently do not take effect. Passing them
raises no error but nothing is stored. Use models to restrict available models; source-IP
restrictions need to be handled on your own side for now.Can I create several tokens in a single request?
Can I create several tokens in a single request?
count in the body has no
effect. Loop the create call on the client instead — see the batch creation section above.My other fields got cleared after an update
My other fields got cleared after an update
GET the full object first, modify it, then
PUT the whole thing back rather than sending only the changed fields.What is the difference between disabling and deleting?
What is the difference between disabling and deleting?
status: 2) stops the key working immediately but keeps the record and usage
history, and you can set it back to 1 at any time. Deleting is irreversible and removes the
record. For temporary suspension, prefer disabling.How do I see how much each key has spent?
How do I see how much each key has spent?
used_quota field is that key’s cumulative spend (÷ 500,000 = USD). For a
per-period breakdown or call-level detail, use the
Log Query API with the token_name filter.Important Notes
- When creating in bulk, add a modest delay between calls to avoid high instantaneous concurrency
- Give each key a meaningful
name(such asteam-aliceorprod-webhook) so you can attribute usage bytoken_namein the logs later - For rotation: create the new key, shift traffic, disable the old key, observe for a while, and only delete it once you confirm no calls remain
Related Documentation
- Log Query API — per-key call detail and charges
- Balance Query API — remaining account credit
- How to create an API key — manual creation in the console
- Tokens and groups — what groups do and how to choose