Sample - OpenAI API
POST/organization/spend_alerts

Create an organization spend alert

Creates an organization spend alert that evaluates monthly spending against a threshold and sends email notifications. Supply threshold_amount, currency, interval, and notification_channel with its required email settings.

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

4 body fields

Organization spend alert definition containing the spending 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 organization spend alert with its identifier, threshold amount, currency, interval, and notification channel.
idstringrequired
The identifier, which can be referenced in API endpoints.
objectstringrequired
The object type, which is always `organization.spend_alert`.
Allowed:organization.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. threshold_amount must be zero or greater, currency must be USD, interval must be month, and the notification channel must use type email with recipient addresses.