Sample - OpenAI API
POST/organization/projects/{project_id}/spend_limit

Update the project spend limit

Creates or replaces a project's hard spend limit. Provide threshold_amount, currency, and interval to define the limit and how the API evaluates spending against it.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

1 parameter · 3 body fields
project_idstringrequired
The string identifier of the project whose hard spend limit you want to create or replace.

Parameters for creating or replacing a project's hard spend limit.

threshold_amountintegerrequired
The hard spend limit amount, in cents.
currencystringrequired
The currency for the threshold amount. Currently, only `USD` is supported.
Allowed:USD
intervalstringrequired
The time interval for evaluating spend against the threshold. Currently, only `month` is supported.
Allowed:month

1 status code
200Returns the created or replaced project spend limit with the `project.spend_limit` object type, threshold amount, currency, evaluation interval, and enforcement status.
objectstringrequired
The object type, which is always `project.spend_limit`.
Allowed:project.spend_limitDefault:project.spend_limit
threshold_amountintegerrequired
The hard spend limit amount, in cents.
currencystringrequired
The currency for the threshold amount. Currently, only `USD` is supported.
intervalstringrequired
The time interval for evaluating spend against the threshold. Currently, only `month` is supported.
enforcementobjectrequired
The current enforcement state of the hard spend limit.

Error handling

threshold_amount, currency, and interval are required. threshold_amount must be at least 1 cent, currency must be USD, and interval must be month.