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

Create a project spend alert

Creates a spend alert for a project. Supply the threshold in cents, the USD currency, a monthly evaluation interval, and email notification settings in notification_channel.

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

1 parameter · 4 body fields
project_idstringrequired
The unique identifier of the project for which to create the spend alert.

Project spend alert configuration, including its threshold, evaluation interval, and email notification settings.

threshold_amountintegerrequired
The alert threshold amount, in cents.
currencystringrequired
The currency for the threshold amount.
Allowed:USD
intervalstringrequired
The time interval for evaluating spend against the threshold.
Allowed:month
notification_channelobjectrequired
Email notification settings for a spend alert.

1 status code
200Returns the created project spend alert with its identifier, object type, threshold amount, currency, interval, and notification channel.
idstringrequired
The identifier, which can be referenced in API endpoints.
objectstringrequired
The object type, which is always `project.spend_alert`.
Allowed:project.spend_alert
threshold_amountintegerrequired
The alert threshold amount, in cents.
currencystringrequired
The currency for the threshold amount.
Allowed:USD
intervalstringrequired
The time interval for evaluating spend against the threshold.
Allowed:month
notification_channelobjectrequired
Email notification settings for a spend alert.

Error handling

threshold_amount, currency, interval, and notification_channel are required. currency must be USD, interval must be month, and the notification channel must use type email with recipients provided.