Skip to main content
PATCH
Update project spend limit
This endpoint requires an Admin Key with the org:write scope, and the key owner must still be an organization admin at call time (otherwise 403 owner_not_admin).Sending neither field (empty body {}) returns 400 invalid_request; provide at least one field.

Tri-state fields and period rules

  • Omitted field: keeps the current value for that period; null: clears that period’s budget (back to unlimited); a number: sets that period’s budget.
  • Daily and monthly periods are configured independently and do not affect each other; the response returns the complete configuration for both periods.
  • Budget semantics match “Get project spend limit”: daily resets at Asia/Shanghai day boundaries and monthly at month boundaries. When spending reaches a configured daily or monthly budget greater than 0, subsequent API requests for that project are rejected. Consumption statistics and limit enforcement may be delayed, and charges incurred during the delay must still be paid.

Authorizations

Authorization
string
header
required

Send the Admin API secret as a Bearer token in the Authorization header (Bearer sk-admin-***). Create Admin Keys under Console → Organization → Admin API Keys.

Path Parameters

pid
string
required

Project ID.

Body

application/json

At least one field must be present.

daily_consume_limit
integer<uint64> | null

Daily spend limit (milli-cent). Omit to keep the current value, null to clear the limit (unlimited), or a number to set it.

Required range: x >= 0
monthly_consume_limit
integer<uint64> | null

Monthly spend limit (milli-cent). Omit to keep the current value, null to clear the limit (unlimited), or a number to set it.

Required range: x >= 0

Response

Updated spend limit.

daily_consume_limit
integer<uint64> | null
required

Daily consume limit (milli-cent). Accumulates and resets at Asia/Shanghai day boundaries; when spending reaches a configured budget greater than 0, subsequent API requests for the project are rejected. Consumption statistics and limit enforcement may be delayed, and charges incurred during the delay must still be paid. Null means not configured (unlimited); 0 means a zero budget.

Required range: x >= 0
monthly_consume_limit
integer<uint64> | null
required

Monthly consume limit (milli-cent). Accumulates and resets at Asia/Shanghai month boundaries; when spending reaches a configured budget greater than 0, subsequent API requests for the project are rejected. Consumption statistics and limit enforcement may be delayed, and charges incurred during the delay must still be paid. Null means not configured (unlimited); 0 means a zero budget.

Required range: x >= 0