API Key management
Create groups and sub-keys, set quotas on sub-keys, and learn about revocation and cascading rules.
The key tree model
Platform API Keys support a tree structure: a main key can have groups beneath it, groups can contain sub-keys, and sub-keys can be subdivided further—up to 4 levels. Typical usage:
- Groups: Split by project or team, e.g. "Data Analytics" or "Support Bot".
- Sub-keys: Distribute to individual members or service instances; revoking one doesn't affect other keys.
- Quotas: Each key can have a spending quota (in yuan); the total spend of its subtree cannot exceed that quota.
Creating a key
On the API Keys page, click "Create API Key":
- Enter a name and an optional group.
- Select a parent key (leave it unselected to create a top-level key).
- Optionally enter a quota in yuan—the total amount this key and its subtree may spend.
- After creation the plaintext key is shown only once; save it immediately.
How billing and quotas apply
- On each call the system validates up the key tree from the bottom: every key in the chain must be enabled.
- The cost of each call is added to the used quota of every key level in the chain at once.
- If any level exceeds its quota, or the account balance is insufficient, the call returns
402 Payment Required.
Revocation and cascading
Revoking a key disables it immediately; its sub-keys are also rejected on their next call. Revoking a group therefore shuts down an entire group of services in one step.
Viewing usage
The API Keys page shows recent calls for each key, including call time and cost. For full consumption details, see the billing ledger.