api.*.update_key(to update keys in any API)api.<api_id>.update_key(to update keys in a specific API)
See the API reference for the full HTTP endpoint documentation.
Usage
Flags
string
required
The ID of the key to update (begins with
key_). This is the database reference ID for the key, not the actual API key string that users authenticate with. This ID uniquely identifies which key’s credits will be updated.string
required
Defines how to modify the key’s remaining credits. Must be one of
set, increment, or decrement. Use set to replace current credits with a specific value or unlimited usage, increment to add credits for plan upgrades or credit purchases, and decrement to reduce credits for refunds or policy violations.integer
The credit value to use with the specified operation. For
set, this becomes the new remaining credits value. For increment, this amount is added to current credits. For decrement, this amount is subtracted from current credits.Omit when using the set operation to make the key unlimited (removes usage restrictions entirely). When decrementing, if the result would be negative, remaining credits are automatically set to zero.Required when using increment or decrement operations. Optional for set operation (omitting creates unlimited usage).Global Flags
Examples
Output
Default output shows the request ID, followed by the updated credit data:--output=json, the full response envelope is returned: