Skip to content
Primary navigation

List organization spend alerts

SpendAlertListPage admin().organization().spendAlerts().list(SpendAlertListParamsparams = SpendAlertListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
GET/organization/spend_alerts

Lists organization spend alerts.

ParametersExpand Collapse
SpendAlertListParams params
Optional<String> after

Cursor for pagination. Provide the ID of the last spend alert from the previous response to fetch the next page.

Optional<String> before

Cursor for pagination. Provide the ID of the first spend alert from the previous response to fetch the previous page.

Optional<Long> limit

A limit on the number of spend alerts to return. Defaults to 20.

minimum0
maximum100
Optional<Order> order

Sort order for the returned spend alerts.

ASC("asc")
DESC("desc")
ReturnsExpand Collapse
class OrganizationSpendAlert:

Represents a spend alert configured at the organization level.

String id

The identifier, which can be referenced in API endpoints.

Currency currency

The currency for the threshold amount.

Interval interval

The time interval for evaluating spend against the threshold.

NotificationChannel notificationChannel

Email notification settings for a spend alert.

List<String> recipients

Email addresses that receive the spend alert notification.

JsonValue; type "email"constant"email"constant

The notification channel type. Currently only email is supported.

Optional<String> subjectPrefix

Optional subject prefix for alert emails.

JsonValue; object_ "organization.spend_alert"constant"organization.spend_alert"constant

The object type, which is always organization.spend_alert.

long thresholdAmount

The alert threshold amount, in cents.

List organization spend alerts

package com.openai.example;

import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.spendalerts.SpendAlertListPage;
import com.openai.models.admin.organization.spendalerts.SpendAlertListParams;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        OpenAIClient client = OpenAIOkHttpClient.fromEnv();

        SpendAlertListPage page = client.admin().organization().spendAlerts().list();
    }
}
{
    "object": "list",
    "data": [
        {
            "id": "alert_abc123",
            "object": "organization.spend_alert",
            "threshold_amount": 100000,
            "currency": "USD",
            "interval": "month",
            "notification_channel": {
                "type": "email",
                "recipients": ["finance@example.com"],
                "subject_prefix": "OpenAI spend alert"
            }
        }
    ],
    "first_id": "alert_abc123",
    "last_id": "alert_abc123",
    "has_more": false
}
Returns Examples
{
    "object": "list",
    "data": [
        {
            "id": "alert_abc123",
            "object": "organization.spend_alert",
            "threshold_amount": 100000,
            "currency": "USD",
            "interval": "month",
            "notification_channel": {
                "type": "email",
                "recipients": ["finance@example.com"],
                "subject_prefix": "OpenAI spend alert"
            }
        }
    ],
    "first_id": "alert_abc123",
    "last_id": "alert_abc123",
    "has_more": false
}