Skip to content
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation
Theme

Update organization spend alert

client.admin.organization.spendAlerts.update(alertID, body, options?): OrganizationSpendAlert { id, currency, interval, 3 more }
POST
/organization/spend_alerts/{alert_id}

Updates an organization spend alert.

Update organization spend alert

import OpenAI from 'openai';

const client = new OpenAI({
  adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted
});

const organizationSpendAlert = await client.admin.organization.spendAlerts.update('alert_id', {
  currency: 'USD',
  interval: 'month',
  notification_channel: { recipients: ['string'], type: 'email' },
  threshold_amount: 0,
});

console.log(organizationSpendAlert.id);
Response example
{
    "id": "alert_abc123",
    "object": "organization.spend_alert",
    "threshold_amount": 150000,
    "currency": "USD",
    "interval": "month",
    "notification_channel": {
        "type": "email",
        "recipients": ["finance@example.com"],
        "subject_prefix": "OpenAI spend alert"
    }
}
Parameters
alertID: string
body: SpendAlertUpdateParams { currency, interval, notification_channel, threshold_amount }
Returns
OrganizationSpendAlert { id, currency, interval, 3 more }

Represents a spend alert configured at the organization level.

id: string

The identifier, which can be referenced in API endpoints.

currency: "USD"

The currency for the threshold amount.

interval: "month"

The time interval for evaluating spend against the threshold.

notification_channel: NotificationChannel { recipients, type, subject_prefix }

Email notification settings for a spend alert.

object: "organization.spend_alert"

The object type, which is always organization.spend_alert.

threshold_amount: number

The alert threshold amount, in cents.

Returns Examples
Response example
{
    "id": "alert_abc123",
    "object": "organization.spend_alert",
    "threshold_amount": 150000,
    "currency": "USD",
    "interval": "month",
    "notification_channel": {
        "type": "email",
        "recipients": ["finance@example.com"],
        "subject_prefix": "OpenAI spend alert"
    }
}