NAME

OpenAPI::Client::OpenAI::Path::organization-spend_alerts - Documentation for the /organization/spend_alerts path.

OPERATIONS

GET /organization/spend_alerts

list-organization-spend-alerts

$client->list_organization_spend_alerts({
    body => { ... },
});

Lists organization spend alerts.

Path/query parameters

  • limit (in query, optional, integer) - A limit on the number of spend alerts to return. Defaults to 20.

  • order (in query, optional, string) - Sort order for the returned spend alerts.

    Allowed values: asc, desc

    Default: asc

  • after (in query, optional, string) - Cursor for pagination. Provide the ID of the last spend alert from the previous response to fetch the next page.

  • before (in query, optional, string) - Cursor for pagination. Provide the ID of the first spend alert from the previous response to fetch the previous page.

Responses

200 - Organization spend alerts listed successfully.

Content-Type: application/json

Example:

{
   "data" : [
      "{\n    \"id\": \"alert_abc123\",\n    \"object\": \"organization.spend_alert\",\n    \"threshold_amount\": 100000,\n    \"currency\": \"USD\",\n    \"interval\": \"month\",\n    \"notification_channel\": {\n        \"type\": \"email\",\n        \"recipients\": [\"finance@example.com\"],\n        \"subject_prefix\": \"OpenAI spend alert\"\n    }\n}\n"
   ],
   "first_id" : "string",
   "has_more" : false,
   "last_id" : "string",
   "object" : "list"
}

POST /organization/spend_alerts

create-organization-spend-alert

$client->create_organization_spend_alert({
    body => { ... },
});

Creates an organization spend alert.

Responses

200 - Organization spend alert created successfully.

Content-Type: application/json

Example:

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

SCHEMAS

CreateSpendAlertBody

Properties:

  • currency (string, required) - The currency for the threshold amount.

    Allowed values: USD

  • interval (string, required) - The time interval for evaluating spend against the threshold.

    Allowed values: month

  • notification_channel (SpendAlertNotificationChannel, required)

    See "SpendAlertNotificationChannel" below for shape.

  • threshold_amount (integer, required) - The alert threshold amount, in cents.

OrganizationSpendAlert

Properties:

  • currency (string, required) - The currency for the threshold amount.

    Allowed values: USD

  • id (string, required) - The identifier, which can be referenced in API endpoints.

  • interval (string, required) - The time interval for evaluating spend against the threshold.

    Allowed values: month

  • notification_channel (SpendAlertNotificationChannel, required)

    See "SpendAlertNotificationChannel" below for shape.

  • object (string, required) - The object type, which is always organization.spend_alert .

    Allowed values: organization.spend_alert

  • threshold_amount (integer, required) - The alert threshold amount, in cents.

OrganizationSpendAlertListResource

Properties:

  • data (array of OrganizationSpendAlert, required) - Spend alerts returned in the current page.

  • first_id (anyOf, required) - The ID of the first spend alert in this page.

  • has_more (boolean, required) - Whether more spend alerts are available when paginating.

  • last_id (anyOf, required) - The ID of the last spend alert in this page.

  • object (string, required) - Always list .

    Allowed values: list

SpendAlertNotificationChannel

Properties:

  • recipients (array of string, required) - Email addresses that receive the spend alert notification.

  • subject_prefix (anyOf) - Optional subject prefix for alert emails.

  • type (string, required) - The notification channel type. Currently only email is supported.

    Allowed values: email

SEE ALSO

OpenAPI::Client::OpenAI::Path

COPYRIGHT AND LICENSE

Copyright (C) 2023-2026 by Nelson Ferraz

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.0 or, at your option, any later version of Perl 5 you may have available.