Admin
Organization
Audit Logs
List audit logs
get /organization/audit_logs
List audit logs
Query Parameters
-
actor_emails: optional array of stringReturn only events performed by users with these emails.
-
actor_ids: optional array of stringReturn only events performed by these actors. Can be a user ID, a service account ID, or an api key tracking ID.
-
after: optional stringA cursor for use in pagination.
afteris an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. -
before: optional stringA cursor for use in pagination.
beforeis an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. -
effective_at: optional object { gt, gte, lt, lte }Return only events whose
effective_at(Unix seconds) is in this range.-
gt: optional numberReturn only events whose
effective_at(Unix seconds) is greater than this value. -
gte: optional numberReturn only events whose
effective_at(Unix seconds) is greater than or equal to this value. -
lt: optional numberReturn only events whose
effective_at(Unix seconds) is less than this value. -
lte: optional numberReturn only events whose
effective_at(Unix seconds) is less than or equal to this value.
-
-
event_types: optional array of "api_key.created" or "api_key.updated" or "api_key.deleted" or 56 moreReturn only events with a
typein one of these values. For example,project.created. For all options, see the documentation for the audit log object.-
"api_key.created" -
"api_key.updated" -
"api_key.deleted" -
"certificate.created" -
"certificate.updated" -
"certificate.deleted" -
"certificates.activated" -
"certificates.deactivated" -
"checkpoint.permission.created" -
"checkpoint.permission.deleted" -
"external_key.registered" -
"external_key.removed" -
"group.created" -
"group.updated" -
"group.deleted" -
"invite.sent" -
"invite.accepted" -
"invite.deleted" -
"ip_allowlist.created" -
"ip_allowlist.updated" -
"ip_allowlist.deleted" -
"ip_allowlist.config.activated" -
"ip_allowlist.config.deactivated" -
"login.succeeded" -
"login.failed" -
"logout.succeeded" -
"logout.failed" -
"organization.updated" -
"project.created" -
"project.updated" -
"project.archived" -
"project.deleted" -
"rate_limit.updated" -
"rate_limit.deleted" -
"resource.deleted" -
"tunnel.created" -
"tunnel.updated" -
"tunnel.deleted" -
"workload_identity_provider.created" -
"workload_identity_provider.updated" -
"workload_identity_provider.deleted" -
"workload_identity_provider_mapping.created" -
"workload_identity_provider_mapping.updated" -
"workload_identity_provider_mapping.deleted" -
"role.created" -
"role.updated" -
"role.deleted" -
"role.assignment.created" -
"role.assignment.deleted" -
"role.bound_to_resource" -
"role.unbound_from_resource" -
"scim.enabled" -
"scim.disabled" -
"service_account.created" -
"service_account.updated" -
"service_account.deleted" -
"user.added" -
"user.updated" -
"user.deleted"
-
-
limit: optional numberA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
-
project_ids: optional array of stringReturn only events for these projects.
-
resource_ids: optional array of stringReturn only events performed on these targets. For example, a project ID updated. For ChatGPT connector role events, use the workspace connector resource ID shown in
details.id, such as<workspace_id>__<connector_id>. -
tenant_only: optional booleanReturn only tenant-scoped events associated with this organization. Required for tenant-scoped events such as
role.bound_to_resourceandrole.unbound_from_resource. Whentrue, all supplied event types must be tenant-scoped.
Returns
-
data: array of object { id, effective_at, type, 57 more }-
id: stringThe ID of this log.
-
effective_at: numberThe Unix timestamp (in seconds) of the event.
-
type: "api_key.created" or "api_key.updated" or "api_key.deleted" or 56 moreThe event type.
-
"api_key.created" -
"api_key.updated" -
"api_key.deleted" -
"certificate.created" -
"certificate.updated" -
"certificate.deleted" -
"certificates.activated" -
"certificates.deactivated" -
"checkpoint.permission.created" -
"checkpoint.permission.deleted" -
"external_key.registered" -
"external_key.removed" -
"group.created" -
"group.updated" -
"group.deleted" -
"invite.sent" -
"invite.accepted" -
"invite.deleted" -
"ip_allowlist.created" -
"ip_allowlist.updated" -
"ip_allowlist.deleted" -
"ip_allowlist.config.activated" -
"ip_allowlist.config.deactivated" -
"login.succeeded" -
"login.failed" -
"logout.succeeded" -
"logout.failed" -
"organization.updated" -
"project.created" -
"project.updated" -
"project.archived" -
"project.deleted" -
"rate_limit.updated" -
"rate_limit.deleted" -
"resource.deleted" -
"tunnel.created" -
"tunnel.updated" -
"tunnel.deleted" -
"workload_identity_provider.created" -
"workload_identity_provider.updated" -
"workload_identity_provider.deleted" -
"workload_identity_provider_mapping.created" -
"workload_identity_provider_mapping.updated" -
"workload_identity_provider_mapping.deleted" -
"role.created" -
"role.updated" -
"role.deleted" -
"role.assignment.created" -
"role.assignment.deleted" -
"role.bound_to_resource" -
"role.unbound_from_resource" -
"scim.enabled" -
"scim.disabled" -
"service_account.created" -
"service_account.updated" -
"service_account.deleted" -
"user.added" -
"user.updated" -
"user.deleted"
-
-
actor: optional object { api_key, session, type }The actor who performed the audit logged action.
-
api_key: optional object { id, service_account, type, user }The API Key used to perform the audit logged action.
-
id: optional stringThe tracking id of the API key.
-
service_account: optional object { id }The service account that performed the audit logged action.
-
id: optional stringThe service account id.
-
-
type: optional "user" or "service_account"The type of API key. Can be either
userorservice_account.-
"user" -
"service_account"
-
-
user: optional object { id, email }The user who performed the audit logged action.
-
id: optional stringThe user id.
-
email: optional stringThe user email.
-
-
-
session: optional object { ip_address, user }The session in which the audit logged action was performed.
-
ip_address: optional stringThe IP address from which the action was performed.
-
user: optional object { id, email }The user who performed the audit logged action.
-
id: optional stringThe user id.
-
email: optional stringThe user email.
-
-
-
type: optional "session" or "api_key"The type of actor. Is either
sessionorapi_key.-
"session" -
"api_key"
-
-
-
"api_key.created": optional object { id, data }The details for events with this
type.-
id: optional stringThe tracking ID of the API key.
-
data: optional object { scopes }The payload used to create the API key.
-
scopes: optional array of stringA list of scopes allowed for the API key, e.g.
["api.model.request"]
-
-
-
"api_key.deleted": optional object { id }The details for events with this
type.-
id: optional stringThe tracking ID of the API key.
-
-
"api_key.updated": optional object { id, changes_requested }The details for events with this
type.-
id: optional stringThe tracking ID of the API key.
-
changes_requested: optional object { scopes }The payload used to update the API key.
-
scopes: optional array of stringA list of scopes allowed for the API key, e.g.
["api.model.request"]
-
-
-
"certificate.created": optional object { id, name }The details for events with this
type.-
id: optional stringThe certificate ID.
-
name: optional stringThe name of the certificate.
-
-
"certificate.deleted": optional object { id, certificate, name }The details for events with this
type.-
id: optional stringThe certificate ID.
-
certificate: optional stringThe certificate content in PEM format.
-
name: optional stringThe name of the certificate.
-
-
"certificate.updated": optional object { id, name }The details for events with this
type.-
id: optional stringThe certificate ID.
-
name: optional stringThe name of the certificate.
-
-
"certificates.activated": optional object { certificates }The details for events with this
type.-
certificates: optional array of object { id, name }-
id: optional stringThe certificate ID.
-
name: optional stringThe name of the certificate.
-
-
-
"certificates.deactivated": optional object { certificates }The details for events with this
type.-
certificates: optional array of object { id, name }-
id: optional stringThe certificate ID.
-
name: optional stringThe name of the certificate.
-
-
-
"checkpoint.permission.created": optional object { id, data }The project and fine-tuned model checkpoint that the checkpoint permission was created for.
-
id: optional stringThe ID of the checkpoint permission.
-
data: optional object { fine_tuned_model_checkpoint, project_id }The payload used to create the checkpoint permission.
-
fine_tuned_model_checkpoint: optional stringThe ID of the fine-tuned model checkpoint.
-
project_id: optional stringThe ID of the project that the checkpoint permission was created for.
-
-
-
"checkpoint.permission.deleted": optional object { id }The details for events with this
type.-
id: optional stringThe ID of the checkpoint permission.
-
-
"external_key.registered": optional object { id, data }The details for events with this
type.-
id: optional stringThe ID of the external key configuration.
-
data: optional unknownThe configuration for the external key.
-
-
"external_key.removed": optional object { id }The details for events with this
type.-
id: optional stringThe ID of the external key configuration.
-
-
"group.created": optional object { id, data }The details for events with this
type.-
id: optional stringThe ID of the group.
-
data: optional object { group_name }Information about the created group.
-
group_name: optional stringThe group name.
-
-
-
"group.deleted": optional object { id }The details for events with this
type.-
id: optional stringThe ID of the group.
-
-
"group.updated": optional object { id, changes_requested }The details for events with this
type.-
id: optional stringThe ID of the group.
-
changes_requested: optional object { group_name }The payload used to update the group.
-
group_name: optional stringThe updated group name.
-
-
-
"invite.accepted": optional object { id }The details for events with this
type.-
id: optional stringThe ID of the invite.
-
-
"invite.deleted": optional object { id }The details for events with this
type.-
id: optional stringThe ID of the invite.
-
-
"invite.sent": optional object { id, data }The details for events with this
type.-
id: optional stringThe ID of the invite.
-
data: optional object { email, role }The payload used to create the invite.
-
email: optional stringThe email invited to the organization.
-
role: optional stringThe role the email was invited to be. Is either
ownerormember.
-
-
-
"ip_allowlist.config.activated": optional object { configs }The details for events with this
type.-
configs: optional array of object { id, name }The configurations that were activated.
-
id: optional stringThe ID of the IP allowlist configuration.
-
name: optional stringThe name of the IP allowlist configuration.
-
-
-
"ip_allowlist.config.deactivated": optional object { configs }The details for events with this
type.-
configs: optional array of object { id, name }The configurations that were deactivated.
-
id: optional stringThe ID of the IP allowlist configuration.
-
name: optional stringThe name of the IP allowlist configuration.
-
-
-
"ip_allowlist.created": optional object { id, allowed_ips, name }The details for events with this
type.-
id: optional stringThe ID of the IP allowlist configuration.
-
allowed_ips: optional array of stringThe IP addresses or CIDR ranges included in the configuration.
-
name: optional stringThe name of the IP allowlist configuration.
-
-
"ip_allowlist.deleted": optional object { id, allowed_ips, name }The details for events with this
type.-
id: optional stringThe ID of the IP allowlist configuration.
-
allowed_ips: optional array of stringThe IP addresses or CIDR ranges that were in the configuration.
-
name: optional stringThe name of the IP allowlist configuration.
-
-
"ip_allowlist.updated": optional object { id, allowed_ips }The details for events with this
type.-
id: optional stringThe ID of the IP allowlist configuration.
-
allowed_ips: optional array of stringThe updated set of IP addresses or CIDR ranges in the configuration.
-
-
"login.failed": optional object { error_code, error_message }The details for events with this
type.-
error_code: optional stringThe error code of the failure.
-
error_message: optional stringThe error message of the failure.
-
-
"login.succeeded": optional unknownThis event has no additional fields beyond the standard audit log attributes.
-
"logout.failed": optional object { error_code, error_message }The details for events with this
type.-
error_code: optional stringThe error code of the failure.
-
error_message: optional stringThe error message of the failure.
-
-
"logout.succeeded": optional unknownThis event has no additional fields beyond the standard audit log attributes.
-
"organization.updated": optional object { id, changes_requested }The details for events with this
type.-
id: optional stringThe organization ID.
-
changes_requested: optional object { api_call_logging, api_call_logging_project_ids, description, 4 more }The payload used to update the organization settings.
-
api_call_logging: optional stringHow your organization logs data from supported API calls. One of
disabled,enabled_per_call,enabled_for_all_projects, orenabled_for_selected_projects -
api_call_logging_project_ids: optional stringThe list of project ids if api_call_logging is set to
enabled_for_selected_projects -
description: optional stringThe organization description.
-
name: optional stringThe organization name.
-
threads_ui_visibility: optional stringVisibility of the threads page which shows messages created with the Assistants API and Playground. One of
ANY_ROLE,OWNERS, orNONE. -
title: optional stringThe organization title.
-
usage_dashboard_visibility: optional stringVisibility of the usage dashboard which shows activity and costs for your organization. One of
ANY_ROLEorOWNERS.
-
-
-
project: optional object { id, name }The project that the action was scoped to. Absent for actions not scoped to projects. Note that any admin actions taken via Admin API keys are associated with the default project.
-
id: optional stringThe project ID.
-
name: optional stringThe project title.
-
-
"project.archived": optional object { id }The details for events with this
type.-
id: optional stringThe project ID.
-
-
"project.created": optional object { id, data }The details for events with this
type.-
id: optional stringThe project ID.
-
data: optional object { name, title }The payload used to create the project.
-
name: optional stringThe project name.
-
title: optional stringThe title of the project as seen on the dashboard.
-
-
-
"project.deleted": optional object { id }The details for events with this
type.-
id: optional stringThe project ID.
-
-
"project.updated": optional object { id, changes_requested }The details for events with this
type.-
id: optional stringThe project ID.
-
changes_requested: optional object { title }The payload used to update the project.
-
title: optional stringThe title of the project as seen on the dashboard.
-
-
-
"rate_limit.deleted": optional object { id }The details for events with this
type.-
id: optional stringThe rate limit ID
-
-
"rate_limit.updated": optional object { id, changes_requested }The details for events with this
type.-
id: optional stringThe rate limit ID
-
changes_requested: optional object { batch_1_day_max_input_tokens, max_audio_megabytes_per_1_minute, max_images_per_1_minute, 3 more }The payload used to update the rate limits.
-
batch_1_day_max_input_tokens: optional numberThe maximum batch input tokens per day. Only relevant for certain models.
-
max_audio_megabytes_per_1_minute: optional numberThe maximum audio megabytes per minute. Only relevant for certain models.
-
max_images_per_1_minute: optional numberThe maximum images per minute. Only relevant for certain models.
-
max_requests_per_1_day: optional numberThe maximum requests per day. Only relevant for certain models.
-
max_requests_per_1_minute: optional numberThe maximum requests per minute.
-
max_tokens_per_1_minute: optional numberThe maximum tokens per minute.
-
-
-
"role.assignment.created": optional object { id, principal_id, principal_type, 2 more }The details for events with this
type.-
id: optional stringThe identifier of the role assignment.
-
principal_id: optional stringThe principal (user or group) that received the role.
-
principal_type: optional stringThe type of principal (user or group) that received the role.
-
resource_id: optional stringThe resource the role assignment is scoped to.
-
resource_type: optional stringThe type of resource the role assignment is scoped to.
-
-
"role.assignment.deleted": optional object { id, principal_id, principal_type, 2 more }The details for events with this
type.-
id: optional stringThe identifier of the role assignment.
-
principal_id: optional stringThe principal (user or group) that had the role removed.
-
principal_type: optional stringThe type of principal (user or group) that had the role removed.
-
resource_id: optional stringThe resource the role assignment was scoped to.
-
resource_type: optional stringThe type of resource the role assignment was scoped to.
-
-
"role.bound_to_resource": optional object { id, connector_id, connector_name, 7 more }The details for events with this
type.-
id: optional stringThe ID of the resource the role was bound to. ChatGPT workspace connector resources use
<workspace_id>__<connector_id>. -
connector_id: optional stringThe connector ID for a ChatGPT workspace connector resource.
-
connector_name: optional stringThe connector display name for a ChatGPT workspace connector resource, or the connector ID when the display name could not be resolved.
-
enabled: optional booleanWhether the connector is enabled for the role.
-
permissions: optional array of stringThe permissions granted to the role for the resource.
-
resource_id: optional stringThe ID of the resource the role was bound to.
-
resource_type: optional stringThe type of resource the role was bound to.
-
role_id: optional stringThe ID of the role that was bound to the resource.
-
source: optional "role_toggle" or "role_connector_update" or "role_delete" or 2 moreThe connector role mutation path that produced the event.
-
"role_toggle" -
"role_connector_update" -
"role_delete" -
"workspace_permissions" -
"connector_publish"
-
-
workspace_id: optional stringThe workspace ID for a ChatGPT workspace connector resource.
-
-
"role.created": optional object { id, permissions, resource_id, 2 more }The details for events with this
type.-
id: optional stringThe role ID.
-
permissions: optional array of stringThe permissions granted by the role.
-
resource_id: optional stringThe resource the role is scoped to.
-
resource_type: optional stringThe type of resource the role belongs to.
-
role_name: optional stringThe name of the role.
-
-
"role.deleted": optional object { id }The details for events with this
type.-
id: optional stringThe role ID.
-
-
"role.unbound_from_resource": optional object { id, connector_id, connector_name, 7 more }The details for events with this
type.-
id: optional stringThe ID of the resource the role was unbound from. ChatGPT workspace connector resources use
<workspace_id>__<connector_id>. -
connector_id: optional stringThe connector ID for a ChatGPT workspace connector resource.
-
connector_name: optional stringThe connector display name for a ChatGPT workspace connector resource, or the connector ID when the display name could not be resolved.
-
enabled: optional booleanWhether the connector is enabled for the role.
-
permissions: optional array of stringThe permissions remaining for the role after the change.
-
resource_id: optional stringThe ID of the resource the role was unbound from.
-
resource_type: optional stringThe type of resource the role was unbound from.
-
role_id: optional stringThe ID of the role that was unbound from the resource.
-
source: optional "role_toggle" or "role_connector_update" or "role_delete" or 2 moreThe connector role mutation path that produced the event.
-
"role_toggle" -
"role_connector_update" -
"role_delete" -
"workspace_permissions" -
"connector_publish"
-
-
workspace_id: optional stringThe workspace ID for a ChatGPT workspace connector resource.
-
-
"role.updated": optional object { id, changes_requested }The details for events with this
type.-
id: optional stringThe role ID.
-
changes_requested: optional object { description, metadata, permissions_added, 4 more }The payload used to update the role.
-
description: optional stringThe updated role description, when provided.
-
metadata: optional unknownAdditional metadata stored on the role.
-
permissions_added: optional array of stringThe permissions added to the role.
-
permissions_removed: optional array of stringThe permissions removed from the role.
-
resource_id: optional stringThe resource the role is scoped to.
-
resource_type: optional stringThe type of resource the role belongs to.
-
role_name: optional stringThe updated role name, when provided.
-
-
-
"scim.disabled": optional object { id }The details for events with this
type.-
id: optional stringThe ID of the SCIM was disabled for.
-
-
"scim.enabled": optional object { id }The details for events with this
type.-
id: optional stringThe ID of the SCIM was enabled for.
-
-
"service_account.created": optional object { id, data }The details for events with this
type.-
id: optional stringThe service account ID.
-
data: optional object { role }The payload used to create the service account.
-
role: optional stringThe role of the service account. Is either
ownerormember.
-
-
-
"service_account.deleted": optional object { id }The details for events with this
type.-
id: optional stringThe service account ID.
-
-
"service_account.updated": optional object { id, changes_requested }The details for events with this
type.-
id: optional stringThe service account ID.
-
changes_requested: optional object { role }The payload used to updated the service account.
-
role: optional stringThe role of the service account. Is either
ownerormember.
-
-
-
"user.added": optional object { id, data }The details for events with this
type.-
id: optional stringThe user ID.
-
data: optional object { role }The payload used to add the user to the project.
-
role: optional stringThe role of the user. Is either
ownerormember.
-
-
-
"user.deleted": optional object { id }The details for events with this
type.-
id: optional stringThe user ID.
-
-
"user.updated": optional object { id, changes_requested }The details for events with this
type.-
id: optional stringThe project ID.
-
changes_requested: optional object { role }The payload used to update the user.
-
role: optional stringThe role of the user. Is either
ownerormember.
-
-
-
"workload_identity_provider_mapping.created": optional object { id, data, identity_provider_id }The details for events with this
type.-
id: optional stringThe workload identity provider mapping ID.
-
data: optional unknownThe payload used to create the workload identity provider mapping.
-
identity_provider_id: optional stringThe workload identity provider ID.
-
-
"workload_identity_provider_mapping.deleted": optional object { id, identity_provider_id, project_id, service_account_id }The details for events with this
type.-
id: optional stringThe workload identity provider mapping ID.
-
identity_provider_id: optional stringThe workload identity provider ID.
-
project_id: optional stringThe project ID.
-
service_account_id: optional stringThe mapped service account ID.
-
-
"workload_identity_provider_mapping.updated": optional object { id, changes_requested, identity_provider_id }The details for events with this
type.-
id: optional stringThe workload identity provider mapping ID.
-
changes_requested: optional unknownThe payload used to update the workload identity provider mapping.
-
identity_provider_id: optional stringThe workload identity provider ID.
-
-
"workload_identity_provider.created": optional object { id, data }The details for events with this
type.-
id: optional stringThe workload identity provider ID.
-
data: optional unknownThe payload used to create the workload identity provider.
-
-
"workload_identity_provider.deleted": optional object { id, name }The details for events with this
type.-
id: optional stringThe workload identity provider ID.
-
name: optional stringThe workload identity provider name.
-
-
"workload_identity_provider.updated": optional object { id, changes_requested }The details for events with this
type.-
id: optional stringThe workload identity provider ID.
-
changes_requested: optional unknownThe payload used to update the workload identity provider.
-
-
-
has_more: boolean -
object: "list""list"
-
first_id: optional string -
last_id: optional string
Example
curl https://api.openai.com/v1/organization/audit_logs \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"data": [
{
"id": "id",
"effective_at": 0,
"type": "api_key.created",
"actor": {
"api_key": {
"id": "id",
"service_account": {
"id": "id"
},
"type": "user",
"user": {
"id": "id",
"email": "email"
}
},
"session": {
"ip_address": "ip_address",
"user": {
"id": "id",
"email": "email"
}
},
"type": "session"
},
"api_key.created": {
"id": "id",
"data": {
"scopes": [
"string"
]
}
},
"api_key.deleted": {
"id": "id"
},
"api_key.updated": {
"id": "id",
"changes_requested": {
"scopes": [
"string"
]
}
},
"certificate.created": {
"id": "id",
"name": "name"
},
"certificate.deleted": {
"id": "id",
"certificate": "certificate",
"name": "name"
},
"certificate.updated": {
"id": "id",
"name": "name"
},
"certificates.activated": {
"certificates": [
{
"id": "id",
"name": "name"
}
]
},
"certificates.deactivated": {
"certificates": [
{
"id": "id",
"name": "name"
}
]
},
"checkpoint.permission.created": {
"id": "id",
"data": {
"fine_tuned_model_checkpoint": "fine_tuned_model_checkpoint",
"project_id": "project_id"
}
},
"checkpoint.permission.deleted": {
"id": "id"
},
"external_key.registered": {
"id": "id",
"data": {}
},
"external_key.removed": {
"id": "id"
},
"group.created": {
"id": "id",
"data": {
"group_name": "group_name"
}
},
"group.deleted": {
"id": "id"
},
"group.updated": {
"id": "id",
"changes_requested": {
"group_name": "group_name"
}
},
"invite.accepted": {
"id": "id"
},
"invite.deleted": {
"id": "id"
},
"invite.sent": {
"id": "id",
"data": {
"email": "email",
"role": "role"
}
},
"ip_allowlist.config.activated": {
"configs": [
{
"id": "id",
"name": "name"
}
]
},
"ip_allowlist.config.deactivated": {
"configs": [
{
"id": "id",
"name": "name"
}
]
},
"ip_allowlist.created": {
"id": "id",
"allowed_ips": [
"string"
],
"name": "name"
},
"ip_allowlist.deleted": {
"id": "id",
"allowed_ips": [
"string"
],
"name": "name"
},
"ip_allowlist.updated": {
"id": "id",
"allowed_ips": [
"string"
]
},
"login.failed": {
"error_code": "error_code",
"error_message": "error_message"
},
"login.succeeded": {},
"logout.failed": {
"error_code": "error_code",
"error_message": "error_message"
},
"logout.succeeded": {},
"organization.updated": {
"id": "id",
"changes_requested": {
"api_call_logging": "api_call_logging",
"api_call_logging_project_ids": "api_call_logging_project_ids",
"description": "description",
"name": "name",
"threads_ui_visibility": "threads_ui_visibility",
"title": "title",
"usage_dashboard_visibility": "usage_dashboard_visibility"
}
},
"project": {
"id": "id",
"name": "name"
},
"project.archived": {
"id": "id"
},
"project.created": {
"id": "id",
"data": {
"name": "name",
"title": "title"
}
},
"project.deleted": {
"id": "id"
},
"project.updated": {
"id": "id",
"changes_requested": {
"title": "title"
}
},
"rate_limit.deleted": {
"id": "id"
},
"rate_limit.updated": {
"id": "id",
"changes_requested": {
"batch_1_day_max_input_tokens": 0,
"max_audio_megabytes_per_1_minute": 0,
"max_images_per_1_minute": 0,
"max_requests_per_1_day": 0,
"max_requests_per_1_minute": 0,
"max_tokens_per_1_minute": 0
}
},
"role.assignment.created": {
"id": "id",
"principal_id": "principal_id",
"principal_type": "principal_type",
"resource_id": "resource_id",
"resource_type": "resource_type"
},
"role.assignment.deleted": {
"id": "id",
"principal_id": "principal_id",
"principal_type": "principal_type",
"resource_id": "resource_id",
"resource_type": "resource_type"
},
"role.bound_to_resource": {
"id": "id",
"connector_id": "connector_id",
"connector_name": "connector_name",
"enabled": true,
"permissions": [
"string"
],
"resource_id": "resource_id",
"resource_type": "resource_type",
"role_id": "role_id",
"source": "role_toggle",
"workspace_id": "workspace_id"
},
"role.created": {
"id": "id",
"permissions": [
"string"
],
"resource_id": "resource_id",
"resource_type": "resource_type",
"role_name": "role_name"
},
"role.deleted": {
"id": "id"
},
"role.unbound_from_resource": {
"id": "id",
"connector_id": "connector_id",
"connector_name": "connector_name",
"enabled": true,
"permissions": [
"string"
],
"resource_id": "resource_id",
"resource_type": "resource_type",
"role_id": "role_id",
"source": "role_toggle",
"workspace_id": "workspace_id"
},
"role.updated": {
"id": "id",
"changes_requested": {
"description": "description",
"metadata": {},
"permissions_added": [
"string"
],
"permissions_removed": [
"string"
],
"resource_id": "resource_id",
"resource_type": "resource_type",
"role_name": "role_name"
}
},
"scim.disabled": {
"id": "id"
},
"scim.enabled": {
"id": "id"
},
"service_account.created": {
"id": "id",
"data": {
"role": "role"
}
},
"service_account.deleted": {
"id": "id"
},
"service_account.updated": {
"id": "id",
"changes_requested": {
"role": "role"
}
},
"user.added": {
"id": "id",
"data": {
"role": "role"
}
},
"user.deleted": {
"id": "id"
},
"user.updated": {
"id": "id",
"changes_requested": {
"role": "role"
}
},
"workload_identity_provider_mapping.created": {
"id": "id",
"data": {},
"identity_provider_id": "identity_provider_id"
},
"workload_identity_provider_mapping.deleted": {
"id": "id",
"identity_provider_id": "identity_provider_id",
"project_id": "project_id",
"service_account_id": "service_account_id"
},
"workload_identity_provider_mapping.updated": {
"id": "id",
"changes_requested": {},
"identity_provider_id": "identity_provider_id"
},
"workload_identity_provider.created": {
"id": "id",
"data": {}
},
"workload_identity_provider.deleted": {
"id": "id",
"name": "name"
},
"workload_identity_provider.updated": {
"id": "id",
"changes_requested": {}
}
}
],
"has_more": true,
"object": "list",
"first_id": "audit_log-defb456h8dks",
"last_id": "audit_log-hnbkd8s93s"
}
Example
curl https://api.openai.com/v1/organization/audit_logs \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "list",
"data": [
{
"id": "audit_log-xxx_yyyymmdd",
"type": "project.archived",
"effective_at": 1722461446,
"actor": {
"type": "api_key",
"api_key": {
"type": "user",
"user": {
"id": "user-xxx",
"email": "user@example.com"
}
}
},
"project.archived": {
"id": "proj_abc"
},
},
{
"id": "audit_log-yyy__20240101",
"type": "api_key.updated",
"effective_at": 1720804190,
"actor": {
"type": "session",
"session": {
"user": {
"id": "user-xxx",
"email": "user@example.com"
},
"ip_address": "127.0.0.1",
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
"ja3": "a497151ce4338a12c4418c44d375173e",
"ja4": "q13d0313h3_55b375c5d22e_c7319ce65786",
"ip_address_details": {
"country": "US",
"city": "San Francisco",
"region": "California",
"region_code": "CA",
"asn": "1234",
"latitude": "37.77490",
"longitude": "-122.41940"
}
}
},
"api_key.updated": {
"id": "key_xxxx",
"data": {
"scopes": ["resource_2.operation_2"]
}
},
}
],
"first_id": "audit_log-xxx__20240101",
"last_id": "audit_log_yyy__20240101",
"has_more": true
}
Domain Types
Audit Log List Response
-
AuditLogListResponse object { id, effective_at, type, 57 more }A log of a user action or configuration change within this organization.
-
id: stringThe ID of this log.
-
effective_at: numberThe Unix timestamp (in seconds) of the event.
-
type: "api_key.created" or "api_key.updated" or "api_key.deleted" or 56 moreThe event type.
-
"api_key.created" -
"api_key.updated" -
"api_key.deleted" -
"certificate.created" -
"certificate.updated" -
"certificate.deleted" -
"certificates.activated" -
"certificates.deactivated" -
"checkpoint.permission.created" -
"checkpoint.permission.deleted" -
"external_key.registered" -
"external_key.removed" -
"group.created" -
"group.updated" -
"group.deleted" -
"invite.sent" -
"invite.accepted" -
"invite.deleted" -
"ip_allowlist.created" -
"ip_allowlist.updated" -
"ip_allowlist.deleted" -
"ip_allowlist.config.activated" -
"ip_allowlist.config.deactivated" -
"login.succeeded" -
"login.failed" -
"logout.succeeded" -
"logout.failed" -
"organization.updated" -
"project.created" -
"project.updated" -
"project.archived" -
"project.deleted" -
"rate_limit.updated" -
"rate_limit.deleted" -
"resource.deleted" -
"tunnel.created" -
"tunnel.updated" -
"tunnel.deleted" -
"workload_identity_provider.created" -
"workload_identity_provider.updated" -
"workload_identity_provider.deleted" -
"workload_identity_provider_mapping.created" -
"workload_identity_provider_mapping.updated" -
"workload_identity_provider_mapping.deleted" -
"role.created" -
"role.updated" -
"role.deleted" -
"role.assignment.created" -
"role.assignment.deleted" -
"role.bound_to_resource" -
"role.unbound_from_resource" -
"scim.enabled" -
"scim.disabled" -
"service_account.created" -
"service_account.updated" -
"service_account.deleted" -
"user.added" -
"user.updated" -
"user.deleted"
-
-
actor: optional object { api_key, session, type }The actor who performed the audit logged action.
-
api_key: optional object { id, service_account, type, user }The API Key used to perform the audit logged action.
-
id: optional stringThe tracking id of the API key.
-
service_account: optional object { id }The service account that performed the audit logged action.
-
id: optional stringThe service account id.
-
-
type: optional "user" or "service_account"The type of API key. Can be either
userorservice_account.-
"user" -
"service_account"
-
-
user: optional object { id, email }The user who performed the audit logged action.
-
id: optional stringThe user id.
-
email: optional stringThe user email.
-
-
-
session: optional object { ip_address, user }The session in which the audit logged action was performed.
-
ip_address: optional stringThe IP address from which the action was performed.
-
user: optional object { id, email }The user who performed the audit logged action.
-
id: optional stringThe user id.
-
email: optional stringThe user email.
-
-
-
type: optional "session" or "api_key"The type of actor. Is either
sessionorapi_key.-
"session" -
"api_key"
-
-
-
"api_key.created": optional object { id, data }The details for events with this
type.-
id: optional stringThe tracking ID of the API key.
-
data: optional object { scopes }The payload used to create the API key.
-
scopes: optional array of stringA list of scopes allowed for the API key, e.g.
["api.model.request"]
-
-
-
"api_key.deleted": optional object { id }The details for events with this
type.-
id: optional stringThe tracking ID of the API key.
-
-
"api_key.updated": optional object { id, changes_requested }The details for events with this
type.-
id: optional stringThe tracking ID of the API key.
-
changes_requested: optional object { scopes }The payload used to update the API key.
-
scopes: optional array of stringA list of scopes allowed for the API key, e.g.
["api.model.request"]
-
-
-
"certificate.created": optional object { id, name }The details for events with this
type.-
id: optional stringThe certificate ID.
-
name: optional stringThe name of the certificate.
-
-
"certificate.deleted": optional object { id, certificate, name }The details for events with this
type.-
id: optional stringThe certificate ID.
-
certificate: optional stringThe certificate content in PEM format.
-
name: optional stringThe name of the certificate.
-
-
"certificate.updated": optional object { id, name }The details for events with this
type.-
id: optional stringThe certificate ID.
-
name: optional stringThe name of the certificate.
-
-
"certificates.activated": optional object { certificates }The details for events with this
type.-
certificates: optional array of object { id, name }-
id: optional stringThe certificate ID.
-
name: optional stringThe name of the certificate.
-
-
-
"certificates.deactivated": optional object { certificates }The details for events with this
type.-
certificates: optional array of object { id, name }-
id: optional stringThe certificate ID.
-
name: optional stringThe name of the certificate.
-
-
-
"checkpoint.permission.created": optional object { id, data }The project and fine-tuned model checkpoint that the checkpoint permission was created for.
-
id: optional stringThe ID of the checkpoint permission.
-
data: optional object { fine_tuned_model_checkpoint, project_id }The payload used to create the checkpoint permission.
-
fine_tuned_model_checkpoint: optional stringThe ID of the fine-tuned model checkpoint.
-
project_id: optional stringThe ID of the project that the checkpoint permission was created for.
-
-
-
"checkpoint.permission.deleted": optional object { id }The details for events with this
type.-
id: optional stringThe ID of the checkpoint permission.
-
-
"external_key.registered": optional object { id, data }The details for events with this
type.-
id: optional stringThe ID of the external key configuration.
-
data: optional unknownThe configuration for the external key.
-
-
"external_key.removed": optional object { id }The details for events with this
type.-
id: optional stringThe ID of the external key configuration.
-
-
"group.created": optional object { id, data }The details for events with this
type.-
id: optional stringThe ID of the group.
-
data: optional object { group_name }Information about the created group.
-
group_name: optional stringThe group name.
-
-
-
"group.deleted": optional object { id }The details for events with this
type.-
id: optional stringThe ID of the group.
-
-
"group.updated": optional object { id, changes_requested }The details for events with this
type.-
id: optional stringThe ID of the group.
-
changes_requested: optional object { group_name }The payload used to update the group.
-
group_name: optional stringThe updated group name.
-
-
-
"invite.accepted": optional object { id }The details for events with this
type.-
id: optional stringThe ID of the invite.
-
-
"invite.deleted": optional object { id }The details for events with this
type.-
id: optional stringThe ID of the invite.
-
-
"invite.sent": optional object { id, data }The details for events with this
type.-
id: optional stringThe ID of the invite.
-
data: optional object { email, role }The payload used to create the invite.
-
email: optional stringThe email invited to the organization.
-
role: optional stringThe role the email was invited to be. Is either
ownerormember.
-
-
-
"ip_allowlist.config.activated": optional object { configs }The details for events with this
type.-
configs: optional array of object { id, name }The configurations that were activated.
-
id: optional stringThe ID of the IP allowlist configuration.
-
name: optional stringThe name of the IP allowlist configuration.
-
-
-
"ip_allowlist.config.deactivated": optional object { configs }The details for events with this
type.-
configs: optional array of object { id, name }The configurations that were deactivated.
-
id: optional stringThe ID of the IP allowlist configuration.
-
name: optional stringThe name of the IP allowlist configuration.
-
-
-
"ip_allowlist.created": optional object { id, allowed_ips, name }The details for events with this
type.-
id: optional stringThe ID of the IP allowlist configuration.
-
allowed_ips: optional array of stringThe IP addresses or CIDR ranges included in the configuration.
-
name: optional stringThe name of the IP allowlist configuration.
-
-
"ip_allowlist.deleted": optional object { id, allowed_ips, name }The details for events with this
type.-
id: optional stringThe ID of the IP allowlist configuration.
-
allowed_ips: optional array of stringThe IP addresses or CIDR ranges that were in the configuration.
-
name: optional stringThe name of the IP allowlist configuration.
-
-
"ip_allowlist.updated": optional object { id, allowed_ips }The details for events with this
type.-
id: optional stringThe ID of the IP allowlist configuration.
-
allowed_ips: optional array of stringThe updated set of IP addresses or CIDR ranges in the configuration.
-
-
"login.failed": optional object { error_code, error_message }The details for events with this
type.-
error_code: optional stringThe error code of the failure.
-
error_message: optional stringThe error message of the failure.
-
-
"login.succeeded": optional unknownThis event has no additional fields beyond the standard audit log attributes.
-
"logout.failed": optional object { error_code, error_message }The details for events with this
type.-
error_code: optional stringThe error code of the failure.
-
error_message: optional stringThe error message of the failure.
-
-
"logout.succeeded": optional unknownThis event has no additional fields beyond the standard audit log attributes.
-
"organization.updated": optional object { id, changes_requested }The details for events with this
type.-
id: optional stringThe organization ID.
-
changes_requested: optional object { api_call_logging, api_call_logging_project_ids, description, 4 more }The payload used to update the organization settings.
-
api_call_logging: optional stringHow your organization logs data from supported API calls. One of
disabled,enabled_per_call,enabled_for_all_projects, orenabled_for_selected_projects -
api_call_logging_project_ids: optional stringThe list of project ids if api_call_logging is set to
enabled_for_selected_projects -
description: optional stringThe organization description.
-
name: optional stringThe organization name.
-
threads_ui_visibility: optional stringVisibility of the threads page which shows messages created with the Assistants API and Playground. One of
ANY_ROLE,OWNERS, orNONE. -
title: optional stringThe organization title.
-
usage_dashboard_visibility: optional stringVisibility of the usage dashboard which shows activity and costs for your organization. One of
ANY_ROLEorOWNERS.
-
-
-
project: optional object { id, name }The project that the action was scoped to. Absent for actions not scoped to projects. Note that any admin actions taken via Admin API keys are associated with the default project.
-
id: optional stringThe project ID.
-
name: optional stringThe project title.
-
-
"project.archived": optional object { id }The details for events with this
type.-
id: optional stringThe project ID.
-
-
"project.created": optional object { id, data }The details for events with this
type.-
id: optional stringThe project ID.
-
data: optional object { name, title }The payload used to create the project.
-
name: optional stringThe project name.
-
title: optional stringThe title of the project as seen on the dashboard.
-
-
-
"project.deleted": optional object { id }The details for events with this
type.-
id: optional stringThe project ID.
-
-
"project.updated": optional object { id, changes_requested }The details for events with this
type.-
id: optional stringThe project ID.
-
changes_requested: optional object { title }The payload used to update the project.
-
title: optional stringThe title of the project as seen on the dashboard.
-
-
-
"rate_limit.deleted": optional object { id }The details for events with this
type.-
id: optional stringThe rate limit ID
-
-
"rate_limit.updated": optional object { id, changes_requested }The details for events with this
type.-
id: optional stringThe rate limit ID
-
changes_requested: optional object { batch_1_day_max_input_tokens, max_audio_megabytes_per_1_minute, max_images_per_1_minute, 3 more }The payload used to update the rate limits.
-
batch_1_day_max_input_tokens: optional numberThe maximum batch input tokens per day. Only relevant for certain models.
-
max_audio_megabytes_per_1_minute: optional numberThe maximum audio megabytes per minute. Only relevant for certain models.
-
max_images_per_1_minute: optional numberThe maximum images per minute. Only relevant for certain models.
-
max_requests_per_1_day: optional numberThe maximum requests per day. Only relevant for certain models.
-
max_requests_per_1_minute: optional numberThe maximum requests per minute.
-
max_tokens_per_1_minute: optional numberThe maximum tokens per minute.
-
-
-
"role.assignment.created": optional object { id, principal_id, principal_type, 2 more }The details for events with this
type.-
id: optional stringThe identifier of the role assignment.
-
principal_id: optional stringThe principal (user or group) that received the role.
-
principal_type: optional stringThe type of principal (user or group) that received the role.
-
resource_id: optional stringThe resource the role assignment is scoped to.
-
resource_type: optional stringThe type of resource the role assignment is scoped to.
-
-
"role.assignment.deleted": optional object { id, principal_id, principal_type, 2 more }The details for events with this
type.-
id: optional stringThe identifier of the role assignment.
-
principal_id: optional stringThe principal (user or group) that had the role removed.
-
principal_type: optional stringThe type of principal (user or group) that had the role removed.
-
resource_id: optional stringThe resource the role assignment was scoped to.
-
resource_type: optional stringThe type of resource the role assignment was scoped to.
-
-
"role.bound_to_resource": optional object { id, connector_id, connector_name, 7 more }The details for events with this
type.-
id: optional stringThe ID of the resource the role was bound to. ChatGPT workspace connector resources use
<workspace_id>__<connector_id>. -
connector_id: optional stringThe connector ID for a ChatGPT workspace connector resource.
-
connector_name: optional stringThe connector display name for a ChatGPT workspace connector resource, or the connector ID when the display name could not be resolved.
-
enabled: optional booleanWhether the connector is enabled for the role.
-
permissions: optional array of stringThe permissions granted to the role for the resource.
-
resource_id: optional stringThe ID of the resource the role was bound to.
-
resource_type: optional stringThe type of resource the role was bound to.
-
role_id: optional stringThe ID of the role that was bound to the resource.
-
source: optional "role_toggle" or "role_connector_update" or "role_delete" or 2 moreThe connector role mutation path that produced the event.
-
"role_toggle" -
"role_connector_update" -
"role_delete" -
"workspace_permissions" -
"connector_publish"
-
-
workspace_id: optional stringThe workspace ID for a ChatGPT workspace connector resource.
-
-
"role.created": optional object { id, permissions, resource_id, 2 more }The details for events with this
type.-
id: optional stringThe role ID.
-
permissions: optional array of stringThe permissions granted by the role.
-
resource_id: optional stringThe resource the role is scoped to.
-
resource_type: optional stringThe type of resource the role belongs to.
-
role_name: optional stringThe name of the role.
-
-
"role.deleted": optional object { id }The details for events with this
type.-
id: optional stringThe role ID.
-
-
"role.unbound_from_resource": optional object { id, connector_id, connector_name, 7 more }The details for events with this
type.-
id: optional stringThe ID of the resource the role was unbound from. ChatGPT workspace connector resources use
<workspace_id>__<connector_id>. -
connector_id: optional stringThe connector ID for a ChatGPT workspace connector resource.
-
connector_name: optional stringThe connector display name for a ChatGPT workspace connector resource, or the connector ID when the display name could not be resolved.
-
enabled: optional booleanWhether the connector is enabled for the role.
-
permissions: optional array of stringThe permissions remaining for the role after the change.
-
resource_id: optional stringThe ID of the resource the role was unbound from.
-
resource_type: optional stringThe type of resource the role was unbound from.
-
role_id: optional stringThe ID of the role that was unbound from the resource.
-
source: optional "role_toggle" or "role_connector_update" or "role_delete" or 2 moreThe connector role mutation path that produced the event.
-
"role_toggle" -
"role_connector_update" -
"role_delete" -
"workspace_permissions" -
"connector_publish"
-
-
workspace_id: optional stringThe workspace ID for a ChatGPT workspace connector resource.
-
-
"role.updated": optional object { id, changes_requested }The details for events with this
type.-
id: optional stringThe role ID.
-
changes_requested: optional object { description, metadata, permissions_added, 4 more }The payload used to update the role.
-
description: optional stringThe updated role description, when provided.
-
metadata: optional unknownAdditional metadata stored on the role.
-
permissions_added: optional array of stringThe permissions added to the role.
-
permissions_removed: optional array of stringThe permissions removed from the role.
-
resource_id: optional stringThe resource the role is scoped to.
-
resource_type: optional stringThe type of resource the role belongs to.
-
role_name: optional stringThe updated role name, when provided.
-
-
-
"scim.disabled": optional object { id }The details for events with this
type.-
id: optional stringThe ID of the SCIM was disabled for.
-
-
"scim.enabled": optional object { id }The details for events with this
type.-
id: optional stringThe ID of the SCIM was enabled for.
-
-
"service_account.created": optional object { id, data }The details for events with this
type.-
id: optional stringThe service account ID.
-
data: optional object { role }The payload used to create the service account.
-
role: optional stringThe role of the service account. Is either
ownerormember.
-
-
-
"service_account.deleted": optional object { id }The details for events with this
type.-
id: optional stringThe service account ID.
-
-
"service_account.updated": optional object { id, changes_requested }The details for events with this
type.-
id: optional stringThe service account ID.
-
changes_requested: optional object { role }The payload used to updated the service account.
-
role: optional stringThe role of the service account. Is either
ownerormember.
-
-
-
"user.added": optional object { id, data }The details for events with this
type.-
id: optional stringThe user ID.
-
data: optional object { role }The payload used to add the user to the project.
-
role: optional stringThe role of the user. Is either
ownerormember.
-
-
-
"user.deleted": optional object { id }The details for events with this
type.-
id: optional stringThe user ID.
-
-
"user.updated": optional object { id, changes_requested }The details for events with this
type.-
id: optional stringThe project ID.
-
changes_requested: optional object { role }The payload used to update the user.
-
role: optional stringThe role of the user. Is either
ownerormember.
-
-
-
"workload_identity_provider_mapping.created": optional object { id, data, identity_provider_id }The details for events with this
type.-
id: optional stringThe workload identity provider mapping ID.
-
data: optional unknownThe payload used to create the workload identity provider mapping.
-
identity_provider_id: optional stringThe workload identity provider ID.
-
-
"workload_identity_provider_mapping.deleted": optional object { id, identity_provider_id, project_id, service_account_id }The details for events with this
type.-
id: optional stringThe workload identity provider mapping ID.
-
identity_provider_id: optional stringThe workload identity provider ID.
-
project_id: optional stringThe project ID.
-
service_account_id: optional stringThe mapped service account ID.
-
-
"workload_identity_provider_mapping.updated": optional object { id, changes_requested, identity_provider_id }The details for events with this
type.-
id: optional stringThe workload identity provider mapping ID.
-
changes_requested: optional unknownThe payload used to update the workload identity provider mapping.
-
identity_provider_id: optional stringThe workload identity provider ID.
-
-
"workload_identity_provider.created": optional object { id, data }The details for events with this
type.-
id: optional stringThe workload identity provider ID.
-
data: optional unknownThe payload used to create the workload identity provider.
-
-
"workload_identity_provider.deleted": optional object { id, name }The details for events with this
type.-
id: optional stringThe workload identity provider ID.
-
name: optional stringThe workload identity provider name.
-
-
"workload_identity_provider.updated": optional object { id, changes_requested }The details for events with this
type.-
id: optional stringThe workload identity provider ID.
-
changes_requested: optional unknownThe payload used to update the workload identity provider.
-
-
Admin API Keys
List all organization and project API keys.
get /organization/admin_api_keys
List all organization and project API keys.
Query Parameters
-
after: optional stringReturn keys with IDs that come after this ID in the pagination order.
-
limit: optional numberMaximum number of keys to return.
-
order: optional "asc" or "desc"Order results by creation time, ascending or descending.
-
"asc" -
"desc"
-
Returns
-
data: array of AdminAPIKey-
id: stringThe identifier, which can be referenced in API endpoints
-
created_at: numberThe Unix timestamp (in seconds) of when the API key was created
-
expires_at: numberThe Unix timestamp (in seconds) of when the API key expires
-
object: "organization.admin_api_key"The object type, which is always
organization.admin_api_key"organization.admin_api_key"
-
owner: object { id, created_at, name, 3 more }-
id: optional stringThe identifier, which can be referenced in API endpoints
-
created_at: optional numberThe Unix timestamp (in seconds) of when the user was created
-
name: optional stringThe name of the user
-
object: optional stringThe object type, which is always organization.user
-
role: optional stringAlways
owner -
type: optional stringAlways
user
-
-
redacted_value: stringThe redacted value of the API key
-
last_used_at: optional numberThe Unix timestamp (in seconds) of when the API key was last used
-
name: optional stringThe name of the API key
-
-
has_more: boolean -
object: "list""list"
-
first_id: optional string -
last_id: optional string
Example
curl https://api.openai.com/v1/organization/admin_api_keys \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"data": [
{
"id": "key_abc",
"created_at": 1711471533,
"expires_at": 1714063533,
"object": "organization.admin_api_key",
"owner": {
"id": "sa_456",
"created_at": 1711471533,
"name": "My Service Account",
"object": "organization.user",
"role": "owner",
"type": "user"
},
"redacted_value": "sk-admin...def",
"last_used_at": 1711471534,
"name": "Administration Key"
}
],
"has_more": false,
"object": "list",
"first_id": "key_abc",
"last_id": "key_xyz"
}
Example
curl https://api.openai.com/v1/organization/admin_api_keys?after=key_abc&limit=20 \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "list",
"data": [
{
"object": "organization.admin_api_key",
"id": "key_abc",
"name": "Main Admin Key",
"redacted_value": "sk-admin...def",
"created_at": 1711471533,
"expires_at": 1714063533,
"last_used_at": 1711471534,
"owner": {
"type": "service_account",
"object": "organization.service_account",
"id": "sa_456",
"name": "My Service Account",
"created_at": 1711471533,
"role": "member"
}
}
],
"first_id": "key_abc",
"last_id": "key_abc",
"has_more": false
}
Create admin API key
post /organization/admin_api_keys
Create admin API key
Body Parameters
-
name: string -
expires_in_seconds: optional numberThe number of seconds until the API key expires. Omit this field for a key that does not expire.
Returns
-
value: stringThe value of the API key. Only shown on create.
Example
curl https://api.openai.com/v1/organization/admin_api_keys \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-d '{
"name": "New Admin Key",
"expires_in_seconds": 2592000
}'
Response
{
"id": "key_abc",
"created_at": 1711471533,
"expires_at": 1714063533,
"object": "organization.admin_api_key",
"owner": {
"id": "sa_456",
"created_at": 1711471533,
"name": "My Service Account",
"object": "organization.user",
"role": "owner",
"type": "user"
},
"redacted_value": "sk-admin...def",
"last_used_at": 1711471534,
"name": "Administration Key",
"value": "sk-admin-1234abcd"
}
Example
curl -X POST https://api.openai.com/v1/organization/admin_api_keys \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "New Admin Key",
"expires_in_seconds": 2592000
}'
Response
{
"object": "organization.admin_api_key",
"id": "key_xyz",
"name": "New Admin Key",
"redacted_value": "sk-admin...xyz",
"created_at": 1711471533,
"expires_at": 1714063533,
"last_used_at": 1711471534,
"owner": {
"type": "user",
"object": "organization.user",
"id": "user_123",
"name": "John Doe",
"created_at": 1711471533,
"role": "owner"
},
"value": "sk-admin-1234abcd"
}
Retrieve admin API key
get /organization/admin_api_keys/{key_id}
Retrieve admin API key
Path Parameters
-
key_id: stringThe ID of the API key.
Returns
-
AdminAPIKey object { id, created_at, expires_at, 5 more }Represents an individual Admin API key in an org.
-
id: stringThe identifier, which can be referenced in API endpoints
-
created_at: numberThe Unix timestamp (in seconds) of when the API key was created
-
expires_at: numberThe Unix timestamp (in seconds) of when the API key expires
-
object: "organization.admin_api_key"The object type, which is always
organization.admin_api_key"organization.admin_api_key"
-
owner: object { id, created_at, name, 3 more }-
id: optional stringThe identifier, which can be referenced in API endpoints
-
created_at: optional numberThe Unix timestamp (in seconds) of when the user was created
-
name: optional stringThe name of the user
-
object: optional stringThe object type, which is always organization.user
-
role: optional stringAlways
owner -
type: optional stringAlways
user
-
-
redacted_value: stringThe redacted value of the API key
-
last_used_at: optional numberThe Unix timestamp (in seconds) of when the API key was last used
-
name: optional stringThe name of the API key
-
Example
curl https://api.openai.com/v1/organization/admin_api_keys/$KEY_ID \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"id": "key_abc",
"created_at": 1711471533,
"expires_at": 1714063533,
"object": "organization.admin_api_key",
"owner": {
"id": "sa_456",
"created_at": 1711471533,
"name": "My Service Account",
"object": "organization.user",
"role": "owner",
"type": "user"
},
"redacted_value": "sk-admin...def",
"last_used_at": 1711471534,
"name": "Administration Key"
}
Example
curl https://api.openai.com/v1/organization/admin_api_keys/key_abc \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "organization.admin_api_key",
"id": "key_abc",
"name": "Main Admin Key",
"redacted_value": "sk-admin...xyz",
"created_at": 1711471533,
"last_used_at": 1711471534,
"owner": {
"type": "user",
"object": "organization.user",
"id": "user_123",
"name": "John Doe",
"created_at": 1711471533,
"role": "owner"
}
}
Delete admin API key
delete /organization/admin_api_keys/{key_id}
Delete admin API key
Path Parameters
-
key_id: stringThe ID of the API key to be deleted.
Returns
-
id: string -
deleted: boolean -
object: "organization.admin_api_key.deleted""organization.admin_api_key.deleted"
Example
curl https://api.openai.com/v1/organization/admin_api_keys/$KEY_ID \
-X DELETE \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"id": "key_abc",
"deleted": true,
"object": "organization.admin_api_key.deleted"
}
Example
curl -X DELETE https://api.openai.com/v1/organization/admin_api_keys/key_abc \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"id": "key_abc",
"object": "organization.admin_api_key.deleted",
"deleted": true
}
Domain Types
Admin API Key
-
AdminAPIKey object { id, created_at, expires_at, 5 more }Represents an individual Admin API key in an org.
-
id: stringThe identifier, which can be referenced in API endpoints
-
created_at: numberThe Unix timestamp (in seconds) of when the API key was created
-
expires_at: numberThe Unix timestamp (in seconds) of when the API key expires
-
object: "organization.admin_api_key"The object type, which is always
organization.admin_api_key"organization.admin_api_key"
-
owner: object { id, created_at, name, 3 more }-
id: optional stringThe identifier, which can be referenced in API endpoints
-
created_at: optional numberThe Unix timestamp (in seconds) of when the user was created
-
name: optional stringThe name of the user
-
object: optional stringThe object type, which is always organization.user
-
role: optional stringAlways
owner -
type: optional stringAlways
user
-
-
redacted_value: stringThe redacted value of the API key
-
last_used_at: optional numberThe Unix timestamp (in seconds) of when the API key was last used
-
name: optional stringThe name of the API key
-
Admin API Key Create Response
-
AdminAPIKeyCreateResponse = AdminAPIKeyRepresents an individual Admin API key in an org.
-
value: stringThe value of the API key. Only shown on create.
-
Admin API Key Delete Response
-
AdminAPIKeyDeleteResponse object { id, deleted, object }-
id: string -
deleted: boolean -
object: "organization.admin_api_key.deleted""organization.admin_api_key.deleted"
-
Usage
Audio speeches
get /organization/usage/audio_speeches
Audio speeches
Query Parameters
-
start_time: numberStart time (Unix seconds) of the query time range, inclusive.
-
api_key_ids: optional array of stringReturn only usage for these API keys.
-
bucket_width: optional "1m" or "1h" or "1d"Width of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
"1m" -
"1h" -
"1d"
-
-
end_time: optional numberEnd time (Unix seconds) of the query time range, exclusive.
-
group_by: optional array of "project_id" or "user_id" or "api_key_id" or "model"Group the usage data by the specified fields. Support fields include
project_id,user_id,api_key_id,modelor any combination of them.-
"project_id" -
"user_id" -
"api_key_id" -
"model"
-
-
limit: optional numberSpecifies the number of buckets to return.
bucket_width=1d: default: 7, max: 31bucket_width=1h: default: 24, max: 168bucket_width=1m: default: 60, max: 1440
-
models: optional array of stringReturn only usage for these models.
-
page: optional stringA cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
project_ids: optional array of stringReturn only usage for these projects.
-
user_ids: optional array of stringReturn only usage for these users.
Returns
-
data: array of object { end_time, object, results, start_time }-
end_time: number -
object: "bucket""bucket"
-
results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more-
OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }The aggregated completions usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.completions.result""organization.usage.completions.result"
-
output_tokens: numberThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: optional booleanWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: optional numberThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: optional numberThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: optional numberThe aggregated number of audio output tokens used.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: optional stringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageEmbeddingsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated embeddings usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.embeddings.result""organization.usage.embeddings.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageModerationsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated moderations usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.moderations.result""organization.usage.moderations.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageImagesResult object { images, num_model_requests, object, 6 more }The aggregated images usage details of the specific time bucket.
-
images: numberThe number of images processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.images.result""organization.usage.images.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: optional stringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: optional stringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioSpeechesResult object { characters, num_model_requests, object, 4 more }The aggregated audio speeches usage details of the specific time bucket.
-
characters: numberThe number of characters processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_speeches.result""organization.usage.audio_speeches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioTranscriptionsResult object { num_model_requests, object, seconds, 4 more }The aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_transcriptions.result""organization.usage.audio_transcriptions.result"
-
seconds: numberThe number of seconds processed.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageVectorStoresResult object { object, usage_bytes, project_id }The aggregated vector stores usage details of the specific time bucket.
-
object: "organization.usage.vector_stores.result""organization.usage.vector_stores.result"
-
usage_bytes: numberThe vector stores usage in bytes.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageCodeInterpreterSessionsResult object { num_sessions, object, project_id }The aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: numberThe number of code interpreter sessions.
-
object: "organization.usage.code_interpreter_sessions.result""organization.usage.code_interpreter_sessions.result"
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }The aggregated file search calls usage details of the specific time bucket.
-
num_requests: numberThe count of file search calls.
-
object: "organization.usage.file_searches.result""organization.usage.file_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: optional stringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }The aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: numberThe count of model requests.
-
num_requests: numberThe count of web search calls.
-
object: "organization.usage.web_searches.result""organization.usage.web_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: optional stringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationCostsResult object { object, amount, api_key_id, 3 more }The aggregated costs details of the specific time bucket.
-
object: "organization.costs.result""organization.costs.result"
-
amount: optional object { currency, value }The monetary value in its associated currency.
-
currency: optional stringLowercase ISO-4217 currency e.g. "usd"
-
value: optional numberThe numeric value of the cost.
-
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: optional stringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: optional numberWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: number
-
-
has_more: boolean -
next_page: string -
object: "page""page"
Example
curl https://api.openai.com/v1/organization/usage/audio_speeches \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"data": [
{
"end_time": 0,
"object": "bucket",
"results": [
{
"input_tokens": 0,
"num_model_requests": 0,
"object": "organization.usage.completions.result",
"output_tokens": 0,
"api_key_id": "api_key_id",
"batch": true,
"input_audio_tokens": 0,
"input_cached_tokens": 0,
"model": "model",
"output_audio_tokens": 0,
"project_id": "project_id",
"service_tier": "service_tier",
"user_id": "user_id"
}
],
"start_time": 0
}
],
"has_more": true,
"next_page": "next_page",
"object": "page"
}
Example
curl "https://api.openai.com/v1/organization/usage/audio_speeches?start_time=1730419200&limit=1" \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "page",
"data": [
{
"object": "bucket",
"start_time": 1730419200,
"end_time": 1730505600,
"results": [
{
"object": "organization.usage.audio_speeches.result",
"characters": 45,
"num_model_requests": 1,
"project_id": null,
"user_id": null,
"api_key_id": null,
"model": null
}
]
}
],
"has_more": false,
"next_page": null
}
Audio transcriptions
get /organization/usage/audio_transcriptions
Audio transcriptions
Query Parameters
-
start_time: numberStart time (Unix seconds) of the query time range, inclusive.
-
api_key_ids: optional array of stringReturn only usage for these API keys.
-
bucket_width: optional "1m" or "1h" or "1d"Width of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
"1m" -
"1h" -
"1d"
-
-
end_time: optional numberEnd time (Unix seconds) of the query time range, exclusive.
-
group_by: optional array of "project_id" or "user_id" or "api_key_id" or "model"Group the usage data by the specified fields. Support fields include
project_id,user_id,api_key_id,modelor any combination of them.-
"project_id" -
"user_id" -
"api_key_id" -
"model"
-
-
limit: optional numberSpecifies the number of buckets to return.
bucket_width=1d: default: 7, max: 31bucket_width=1h: default: 24, max: 168bucket_width=1m: default: 60, max: 1440
-
models: optional array of stringReturn only usage for these models.
-
page: optional stringA cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
project_ids: optional array of stringReturn only usage for these projects.
-
user_ids: optional array of stringReturn only usage for these users.
Returns
-
data: array of object { end_time, object, results, start_time }-
end_time: number -
object: "bucket""bucket"
-
results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more-
OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }The aggregated completions usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.completions.result""organization.usage.completions.result"
-
output_tokens: numberThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: optional booleanWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: optional numberThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: optional numberThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: optional numberThe aggregated number of audio output tokens used.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: optional stringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageEmbeddingsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated embeddings usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.embeddings.result""organization.usage.embeddings.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageModerationsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated moderations usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.moderations.result""organization.usage.moderations.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageImagesResult object { images, num_model_requests, object, 6 more }The aggregated images usage details of the specific time bucket.
-
images: numberThe number of images processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.images.result""organization.usage.images.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: optional stringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: optional stringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioSpeechesResult object { characters, num_model_requests, object, 4 more }The aggregated audio speeches usage details of the specific time bucket.
-
characters: numberThe number of characters processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_speeches.result""organization.usage.audio_speeches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioTranscriptionsResult object { num_model_requests, object, seconds, 4 more }The aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_transcriptions.result""organization.usage.audio_transcriptions.result"
-
seconds: numberThe number of seconds processed.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageVectorStoresResult object { object, usage_bytes, project_id }The aggregated vector stores usage details of the specific time bucket.
-
object: "organization.usage.vector_stores.result""organization.usage.vector_stores.result"
-
usage_bytes: numberThe vector stores usage in bytes.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageCodeInterpreterSessionsResult object { num_sessions, object, project_id }The aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: numberThe number of code interpreter sessions.
-
object: "organization.usage.code_interpreter_sessions.result""organization.usage.code_interpreter_sessions.result"
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }The aggregated file search calls usage details of the specific time bucket.
-
num_requests: numberThe count of file search calls.
-
object: "organization.usage.file_searches.result""organization.usage.file_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: optional stringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }The aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: numberThe count of model requests.
-
num_requests: numberThe count of web search calls.
-
object: "organization.usage.web_searches.result""organization.usage.web_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: optional stringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationCostsResult object { object, amount, api_key_id, 3 more }The aggregated costs details of the specific time bucket.
-
object: "organization.costs.result""organization.costs.result"
-
amount: optional object { currency, value }The monetary value in its associated currency.
-
currency: optional stringLowercase ISO-4217 currency e.g. "usd"
-
value: optional numberThe numeric value of the cost.
-
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: optional stringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: optional numberWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: number
-
-
has_more: boolean -
next_page: string -
object: "page""page"
Example
curl https://api.openai.com/v1/organization/usage/audio_transcriptions \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"data": [
{
"end_time": 0,
"object": "bucket",
"results": [
{
"input_tokens": 0,
"num_model_requests": 0,
"object": "organization.usage.completions.result",
"output_tokens": 0,
"api_key_id": "api_key_id",
"batch": true,
"input_audio_tokens": 0,
"input_cached_tokens": 0,
"model": "model",
"output_audio_tokens": 0,
"project_id": "project_id",
"service_tier": "service_tier",
"user_id": "user_id"
}
],
"start_time": 0
}
],
"has_more": true,
"next_page": "next_page",
"object": "page"
}
Example
curl "https://api.openai.com/v1/organization/usage/audio_transcriptions?start_time=1730419200&limit=1" \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "page",
"data": [
{
"object": "bucket",
"start_time": 1730419200,
"end_time": 1730505600,
"results": [
{
"object": "organization.usage.audio_transcriptions.result",
"seconds": 20,
"num_model_requests": 1,
"project_id": null,
"user_id": null,
"api_key_id": null,
"model": null
}
]
}
],
"has_more": false,
"next_page": null
}
Code interpreter sessions
get /organization/usage/code_interpreter_sessions
Code interpreter sessions
Query Parameters
-
start_time: numberStart time (Unix seconds) of the query time range, inclusive.
-
bucket_width: optional "1m" or "1h" or "1d"Width of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
"1m" -
"1h" -
"1d"
-
-
end_time: optional numberEnd time (Unix seconds) of the query time range, exclusive.
-
group_by: optional array of "project_id"Group the usage data by the specified fields. Support fields include
project_id."project_id"
-
limit: optional numberSpecifies the number of buckets to return.
bucket_width=1d: default: 7, max: 31bucket_width=1h: default: 24, max: 168bucket_width=1m: default: 60, max: 1440
-
page: optional stringA cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
project_ids: optional array of stringReturn only usage for these projects.
Returns
-
data: array of object { end_time, object, results, start_time }-
end_time: number -
object: "bucket""bucket"
-
results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more-
OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }The aggregated completions usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.completions.result""organization.usage.completions.result"
-
output_tokens: numberThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: optional booleanWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: optional numberThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: optional numberThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: optional numberThe aggregated number of audio output tokens used.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: optional stringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageEmbeddingsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated embeddings usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.embeddings.result""organization.usage.embeddings.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageModerationsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated moderations usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.moderations.result""organization.usage.moderations.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageImagesResult object { images, num_model_requests, object, 6 more }The aggregated images usage details of the specific time bucket.
-
images: numberThe number of images processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.images.result""organization.usage.images.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: optional stringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: optional stringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioSpeechesResult object { characters, num_model_requests, object, 4 more }The aggregated audio speeches usage details of the specific time bucket.
-
characters: numberThe number of characters processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_speeches.result""organization.usage.audio_speeches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioTranscriptionsResult object { num_model_requests, object, seconds, 4 more }The aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_transcriptions.result""organization.usage.audio_transcriptions.result"
-
seconds: numberThe number of seconds processed.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageVectorStoresResult object { object, usage_bytes, project_id }The aggregated vector stores usage details of the specific time bucket.
-
object: "organization.usage.vector_stores.result""organization.usage.vector_stores.result"
-
usage_bytes: numberThe vector stores usage in bytes.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageCodeInterpreterSessionsResult object { num_sessions, object, project_id }The aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: numberThe number of code interpreter sessions.
-
object: "organization.usage.code_interpreter_sessions.result""organization.usage.code_interpreter_sessions.result"
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }The aggregated file search calls usage details of the specific time bucket.
-
num_requests: numberThe count of file search calls.
-
object: "organization.usage.file_searches.result""organization.usage.file_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: optional stringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }The aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: numberThe count of model requests.
-
num_requests: numberThe count of web search calls.
-
object: "organization.usage.web_searches.result""organization.usage.web_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: optional stringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationCostsResult object { object, amount, api_key_id, 3 more }The aggregated costs details of the specific time bucket.
-
object: "organization.costs.result""organization.costs.result"
-
amount: optional object { currency, value }The monetary value in its associated currency.
-
currency: optional stringLowercase ISO-4217 currency e.g. "usd"
-
value: optional numberThe numeric value of the cost.
-
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: optional stringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: optional numberWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: number
-
-
has_more: boolean -
next_page: string -
object: "page""page"
Example
curl https://api.openai.com/v1/organization/usage/code_interpreter_sessions \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"data": [
{
"end_time": 0,
"object": "bucket",
"results": [
{
"input_tokens": 0,
"num_model_requests": 0,
"object": "organization.usage.completions.result",
"output_tokens": 0,
"api_key_id": "api_key_id",
"batch": true,
"input_audio_tokens": 0,
"input_cached_tokens": 0,
"model": "model",
"output_audio_tokens": 0,
"project_id": "project_id",
"service_tier": "service_tier",
"user_id": "user_id"
}
],
"start_time": 0
}
],
"has_more": true,
"next_page": "next_page",
"object": "page"
}
Example
curl "https://api.openai.com/v1/organization/usage/code_interpreter_sessions?start_time=1730419200&limit=1" \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "page",
"data": [
{
"object": "bucket",
"start_time": 1730419200,
"end_time": 1730505600,
"results": [
{
"object": "organization.usage.code_interpreter_sessions.result",
"num_sessions": 1,
"project_id": null
}
]
}
],
"has_more": false,
"next_page": null
}
Completions
get /organization/usage/completions
Completions
Query Parameters
-
start_time: numberStart time (Unix seconds) of the query time range, inclusive.
-
api_key_ids: optional array of stringReturn only usage for these API keys.
-
batch: optional booleanIf
true, return batch jobs only. Iffalse, return non-batch jobs only. By default, return both. -
bucket_width: optional "1m" or "1h" or "1d"Width of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
"1m" -
"1h" -
"1d"
-
-
end_time: optional numberEnd time (Unix seconds) of the query time range, exclusive.
-
group_by: optional array of "project_id" or "user_id" or "api_key_id" or 3 moreGroup the usage data by the specified fields. Support fields include
project_id,user_id,api_key_id,model,batch,service_tieror any combination of them.-
"project_id" -
"user_id" -
"api_key_id" -
"model" -
"batch" -
"service_tier"
-
-
limit: optional numberSpecifies the number of buckets to return.
bucket_width=1d: default: 7, max: 31bucket_width=1h: default: 24, max: 168bucket_width=1m: default: 60, max: 1440
-
models: optional array of stringReturn only usage for these models.
-
page: optional stringA cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
project_ids: optional array of stringReturn only usage for these projects.
-
user_ids: optional array of stringReturn only usage for these users.
Returns
-
data: array of object { end_time, object, results, start_time }-
end_time: number -
object: "bucket""bucket"
-
results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more-
OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }The aggregated completions usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.completions.result""organization.usage.completions.result"
-
output_tokens: numberThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: optional booleanWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: optional numberThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: optional numberThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: optional numberThe aggregated number of audio output tokens used.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: optional stringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageEmbeddingsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated embeddings usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.embeddings.result""organization.usage.embeddings.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageModerationsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated moderations usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.moderations.result""organization.usage.moderations.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageImagesResult object { images, num_model_requests, object, 6 more }The aggregated images usage details of the specific time bucket.
-
images: numberThe number of images processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.images.result""organization.usage.images.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: optional stringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: optional stringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioSpeechesResult object { characters, num_model_requests, object, 4 more }The aggregated audio speeches usage details of the specific time bucket.
-
characters: numberThe number of characters processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_speeches.result""organization.usage.audio_speeches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioTranscriptionsResult object { num_model_requests, object, seconds, 4 more }The aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_transcriptions.result""organization.usage.audio_transcriptions.result"
-
seconds: numberThe number of seconds processed.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageVectorStoresResult object { object, usage_bytes, project_id }The aggregated vector stores usage details of the specific time bucket.
-
object: "organization.usage.vector_stores.result""organization.usage.vector_stores.result"
-
usage_bytes: numberThe vector stores usage in bytes.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageCodeInterpreterSessionsResult object { num_sessions, object, project_id }The aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: numberThe number of code interpreter sessions.
-
object: "organization.usage.code_interpreter_sessions.result""organization.usage.code_interpreter_sessions.result"
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }The aggregated file search calls usage details of the specific time bucket.
-
num_requests: numberThe count of file search calls.
-
object: "organization.usage.file_searches.result""organization.usage.file_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: optional stringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }The aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: numberThe count of model requests.
-
num_requests: numberThe count of web search calls.
-
object: "organization.usage.web_searches.result""organization.usage.web_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: optional stringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationCostsResult object { object, amount, api_key_id, 3 more }The aggregated costs details of the specific time bucket.
-
object: "organization.costs.result""organization.costs.result"
-
amount: optional object { currency, value }The monetary value in its associated currency.
-
currency: optional stringLowercase ISO-4217 currency e.g. "usd"
-
value: optional numberThe numeric value of the cost.
-
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: optional stringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: optional numberWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: number
-
-
has_more: boolean -
next_page: string -
object: "page""page"
Example
curl https://api.openai.com/v1/organization/usage/completions \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"data": [
{
"end_time": 0,
"object": "bucket",
"results": [
{
"input_tokens": 0,
"num_model_requests": 0,
"object": "organization.usage.completions.result",
"output_tokens": 0,
"api_key_id": "api_key_id",
"batch": true,
"input_audio_tokens": 0,
"input_cached_tokens": 0,
"model": "model",
"output_audio_tokens": 0,
"project_id": "project_id",
"service_tier": "service_tier",
"user_id": "user_id"
}
],
"start_time": 0
}
],
"has_more": true,
"next_page": "next_page",
"object": "page"
}
Example
curl "https://api.openai.com/v1/organization/usage/completions?start_time=1730419200&limit=1" \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "page",
"data": [
{
"object": "bucket",
"start_time": 1730419200,
"end_time": 1730505600,
"results": [
{
"object": "organization.usage.completions.result",
"input_tokens": 1000,
"output_tokens": 500,
"input_cached_tokens": 800,
"input_audio_tokens": 0,
"output_audio_tokens": 0,
"num_model_requests": 5,
"project_id": null,
"user_id": null,
"api_key_id": null,
"model": null,
"batch": null,
"service_tier": null
}
]
}
],
"has_more": true,
"next_page": "page_AAAAAGdGxdEiJdKOAAAAAGcqsYA="
}
Embeddings
get /organization/usage/embeddings
Embeddings
Query Parameters
-
start_time: numberStart time (Unix seconds) of the query time range, inclusive.
-
api_key_ids: optional array of stringReturn only usage for these API keys.
-
bucket_width: optional "1m" or "1h" or "1d"Width of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
"1m" -
"1h" -
"1d"
-
-
end_time: optional numberEnd time (Unix seconds) of the query time range, exclusive.
-
group_by: optional array of "project_id" or "user_id" or "api_key_id" or "model"Group the usage data by the specified fields. Support fields include
project_id,user_id,api_key_id,modelor any combination of them.-
"project_id" -
"user_id" -
"api_key_id" -
"model"
-
-
limit: optional numberSpecifies the number of buckets to return.
bucket_width=1d: default: 7, max: 31bucket_width=1h: default: 24, max: 168bucket_width=1m: default: 60, max: 1440
-
models: optional array of stringReturn only usage for these models.
-
page: optional stringA cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
project_ids: optional array of stringReturn only usage for these projects.
-
user_ids: optional array of stringReturn only usage for these users.
Returns
-
data: array of object { end_time, object, results, start_time }-
end_time: number -
object: "bucket""bucket"
-
results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more-
OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }The aggregated completions usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.completions.result""organization.usage.completions.result"
-
output_tokens: numberThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: optional booleanWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: optional numberThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: optional numberThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: optional numberThe aggregated number of audio output tokens used.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: optional stringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageEmbeddingsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated embeddings usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.embeddings.result""organization.usage.embeddings.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageModerationsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated moderations usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.moderations.result""organization.usage.moderations.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageImagesResult object { images, num_model_requests, object, 6 more }The aggregated images usage details of the specific time bucket.
-
images: numberThe number of images processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.images.result""organization.usage.images.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: optional stringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: optional stringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioSpeechesResult object { characters, num_model_requests, object, 4 more }The aggregated audio speeches usage details of the specific time bucket.
-
characters: numberThe number of characters processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_speeches.result""organization.usage.audio_speeches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioTranscriptionsResult object { num_model_requests, object, seconds, 4 more }The aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_transcriptions.result""organization.usage.audio_transcriptions.result"
-
seconds: numberThe number of seconds processed.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageVectorStoresResult object { object, usage_bytes, project_id }The aggregated vector stores usage details of the specific time bucket.
-
object: "organization.usage.vector_stores.result""organization.usage.vector_stores.result"
-
usage_bytes: numberThe vector stores usage in bytes.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageCodeInterpreterSessionsResult object { num_sessions, object, project_id }The aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: numberThe number of code interpreter sessions.
-
object: "organization.usage.code_interpreter_sessions.result""organization.usage.code_interpreter_sessions.result"
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }The aggregated file search calls usage details of the specific time bucket.
-
num_requests: numberThe count of file search calls.
-
object: "organization.usage.file_searches.result""organization.usage.file_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: optional stringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }The aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: numberThe count of model requests.
-
num_requests: numberThe count of web search calls.
-
object: "organization.usage.web_searches.result""organization.usage.web_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: optional stringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationCostsResult object { object, amount, api_key_id, 3 more }The aggregated costs details of the specific time bucket.
-
object: "organization.costs.result""organization.costs.result"
-
amount: optional object { currency, value }The monetary value in its associated currency.
-
currency: optional stringLowercase ISO-4217 currency e.g. "usd"
-
value: optional numberThe numeric value of the cost.
-
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: optional stringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: optional numberWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: number
-
-
has_more: boolean -
next_page: string -
object: "page""page"
Example
curl https://api.openai.com/v1/organization/usage/embeddings \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"data": [
{
"end_time": 0,
"object": "bucket",
"results": [
{
"input_tokens": 0,
"num_model_requests": 0,
"object": "organization.usage.completions.result",
"output_tokens": 0,
"api_key_id": "api_key_id",
"batch": true,
"input_audio_tokens": 0,
"input_cached_tokens": 0,
"model": "model",
"output_audio_tokens": 0,
"project_id": "project_id",
"service_tier": "service_tier",
"user_id": "user_id"
}
],
"start_time": 0
}
],
"has_more": true,
"next_page": "next_page",
"object": "page"
}
Example
curl "https://api.openai.com/v1/organization/usage/embeddings?start_time=1730419200&limit=1" \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "page",
"data": [
{
"object": "bucket",
"start_time": 1730419200,
"end_time": 1730505600,
"results": [
{
"object": "organization.usage.embeddings.result",
"input_tokens": 16,
"num_model_requests": 2,
"project_id": null,
"user_id": null,
"api_key_id": null,
"model": null
}
]
}
],
"has_more": false,
"next_page": null
}
Images
get /organization/usage/images
Images
Query Parameters
-
start_time: numberStart time (Unix seconds) of the query time range, inclusive.
-
api_key_ids: optional array of stringReturn only usage for these API keys.
-
bucket_width: optional "1m" or "1h" or "1d"Width of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
"1m" -
"1h" -
"1d"
-
-
end_time: optional numberEnd time (Unix seconds) of the query time range, exclusive.
-
group_by: optional array of "project_id" or "user_id" or "api_key_id" or 3 moreGroup the usage data by the specified fields. Support fields include
project_id,user_id,api_key_id,model,size,sourceor any combination of them.-
"project_id" -
"user_id" -
"api_key_id" -
"model" -
"size" -
"source"
-
-
limit: optional numberSpecifies the number of buckets to return.
bucket_width=1d: default: 7, max: 31bucket_width=1h: default: 24, max: 168bucket_width=1m: default: 60, max: 1440
-
models: optional array of stringReturn only usage for these models.
-
page: optional stringA cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
project_ids: optional array of stringReturn only usage for these projects.
-
sizes: optional array of "256x256" or "512x512" or "1024x1024" or 2 moreReturn only usages for these image sizes. Possible values are
256x256,512x512,1024x1024,1792x1792,1024x1792or any combination of them.-
"256x256" -
"512x512" -
"1024x1024" -
"1792x1792" -
"1024x1792"
-
-
sources: optional array of "image.generation" or "image.edit" or "image.variation"Return only usages for these sources. Possible values are
image.generation,image.edit,image.variationor any combination of them.-
"image.generation" -
"image.edit" -
"image.variation"
-
-
user_ids: optional array of stringReturn only usage for these users.
Returns
-
data: array of object { end_time, object, results, start_time }-
end_time: number -
object: "bucket""bucket"
-
results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more-
OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }The aggregated completions usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.completions.result""organization.usage.completions.result"
-
output_tokens: numberThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: optional booleanWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: optional numberThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: optional numberThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: optional numberThe aggregated number of audio output tokens used.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: optional stringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageEmbeddingsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated embeddings usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.embeddings.result""organization.usage.embeddings.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageModerationsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated moderations usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.moderations.result""organization.usage.moderations.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageImagesResult object { images, num_model_requests, object, 6 more }The aggregated images usage details of the specific time bucket.
-
images: numberThe number of images processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.images.result""organization.usage.images.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: optional stringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: optional stringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioSpeechesResult object { characters, num_model_requests, object, 4 more }The aggregated audio speeches usage details of the specific time bucket.
-
characters: numberThe number of characters processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_speeches.result""organization.usage.audio_speeches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioTranscriptionsResult object { num_model_requests, object, seconds, 4 more }The aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_transcriptions.result""organization.usage.audio_transcriptions.result"
-
seconds: numberThe number of seconds processed.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageVectorStoresResult object { object, usage_bytes, project_id }The aggregated vector stores usage details of the specific time bucket.
-
object: "organization.usage.vector_stores.result""organization.usage.vector_stores.result"
-
usage_bytes: numberThe vector stores usage in bytes.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageCodeInterpreterSessionsResult object { num_sessions, object, project_id }The aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: numberThe number of code interpreter sessions.
-
object: "organization.usage.code_interpreter_sessions.result""organization.usage.code_interpreter_sessions.result"
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }The aggregated file search calls usage details of the specific time bucket.
-
num_requests: numberThe count of file search calls.
-
object: "organization.usage.file_searches.result""organization.usage.file_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: optional stringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }The aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: numberThe count of model requests.
-
num_requests: numberThe count of web search calls.
-
object: "organization.usage.web_searches.result""organization.usage.web_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: optional stringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationCostsResult object { object, amount, api_key_id, 3 more }The aggregated costs details of the specific time bucket.
-
object: "organization.costs.result""organization.costs.result"
-
amount: optional object { currency, value }The monetary value in its associated currency.
-
currency: optional stringLowercase ISO-4217 currency e.g. "usd"
-
value: optional numberThe numeric value of the cost.
-
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: optional stringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: optional numberWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: number
-
-
has_more: boolean -
next_page: string -
object: "page""page"
Example
curl https://api.openai.com/v1/organization/usage/images \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"data": [
{
"end_time": 0,
"object": "bucket",
"results": [
{
"input_tokens": 0,
"num_model_requests": 0,
"object": "organization.usage.completions.result",
"output_tokens": 0,
"api_key_id": "api_key_id",
"batch": true,
"input_audio_tokens": 0,
"input_cached_tokens": 0,
"model": "model",
"output_audio_tokens": 0,
"project_id": "project_id",
"service_tier": "service_tier",
"user_id": "user_id"
}
],
"start_time": 0
}
],
"has_more": true,
"next_page": "next_page",
"object": "page"
}
Example
curl "https://api.openai.com/v1/organization/usage/images?start_time=1730419200&limit=1" \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "page",
"data": [
{
"object": "bucket",
"start_time": 1730419200,
"end_time": 1730505600,
"results": [
{
"object": "organization.usage.images.result",
"images": 2,
"num_model_requests": 2,
"size": null,
"source": null,
"project_id": null,
"user_id": null,
"api_key_id": null,
"model": null
}
]
}
],
"has_more": false,
"next_page": null
}
Moderations
get /organization/usage/moderations
Moderations
Query Parameters
-
start_time: numberStart time (Unix seconds) of the query time range, inclusive.
-
api_key_ids: optional array of stringReturn only usage for these API keys.
-
bucket_width: optional "1m" or "1h" or "1d"Width of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
"1m" -
"1h" -
"1d"
-
-
end_time: optional numberEnd time (Unix seconds) of the query time range, exclusive.
-
group_by: optional array of "project_id" or "user_id" or "api_key_id" or "model"Group the usage data by the specified fields. Support fields include
project_id,user_id,api_key_id,modelor any combination of them.-
"project_id" -
"user_id" -
"api_key_id" -
"model"
-
-
limit: optional numberSpecifies the number of buckets to return.
bucket_width=1d: default: 7, max: 31bucket_width=1h: default: 24, max: 168bucket_width=1m: default: 60, max: 1440
-
models: optional array of stringReturn only usage for these models.
-
page: optional stringA cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
project_ids: optional array of stringReturn only usage for these projects.
-
user_ids: optional array of stringReturn only usage for these users.
Returns
-
data: array of object { end_time, object, results, start_time }-
end_time: number -
object: "bucket""bucket"
-
results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more-
OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }The aggregated completions usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.completions.result""organization.usage.completions.result"
-
output_tokens: numberThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: optional booleanWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: optional numberThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: optional numberThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: optional numberThe aggregated number of audio output tokens used.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: optional stringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageEmbeddingsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated embeddings usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.embeddings.result""organization.usage.embeddings.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageModerationsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated moderations usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.moderations.result""organization.usage.moderations.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageImagesResult object { images, num_model_requests, object, 6 more }The aggregated images usage details of the specific time bucket.
-
images: numberThe number of images processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.images.result""organization.usage.images.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: optional stringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: optional stringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioSpeechesResult object { characters, num_model_requests, object, 4 more }The aggregated audio speeches usage details of the specific time bucket.
-
characters: numberThe number of characters processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_speeches.result""organization.usage.audio_speeches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioTranscriptionsResult object { num_model_requests, object, seconds, 4 more }The aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_transcriptions.result""organization.usage.audio_transcriptions.result"
-
seconds: numberThe number of seconds processed.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageVectorStoresResult object { object, usage_bytes, project_id }The aggregated vector stores usage details of the specific time bucket.
-
object: "organization.usage.vector_stores.result""organization.usage.vector_stores.result"
-
usage_bytes: numberThe vector stores usage in bytes.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageCodeInterpreterSessionsResult object { num_sessions, object, project_id }The aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: numberThe number of code interpreter sessions.
-
object: "organization.usage.code_interpreter_sessions.result""organization.usage.code_interpreter_sessions.result"
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }The aggregated file search calls usage details of the specific time bucket.
-
num_requests: numberThe count of file search calls.
-
object: "organization.usage.file_searches.result""organization.usage.file_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: optional stringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }The aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: numberThe count of model requests.
-
num_requests: numberThe count of web search calls.
-
object: "organization.usage.web_searches.result""organization.usage.web_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: optional stringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationCostsResult object { object, amount, api_key_id, 3 more }The aggregated costs details of the specific time bucket.
-
object: "organization.costs.result""organization.costs.result"
-
amount: optional object { currency, value }The monetary value in its associated currency.
-
currency: optional stringLowercase ISO-4217 currency e.g. "usd"
-
value: optional numberThe numeric value of the cost.
-
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: optional stringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: optional numberWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: number
-
-
has_more: boolean -
next_page: string -
object: "page""page"
Example
curl https://api.openai.com/v1/organization/usage/moderations \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"data": [
{
"end_time": 0,
"object": "bucket",
"results": [
{
"input_tokens": 0,
"num_model_requests": 0,
"object": "organization.usage.completions.result",
"output_tokens": 0,
"api_key_id": "api_key_id",
"batch": true,
"input_audio_tokens": 0,
"input_cached_tokens": 0,
"model": "model",
"output_audio_tokens": 0,
"project_id": "project_id",
"service_tier": "service_tier",
"user_id": "user_id"
}
],
"start_time": 0
}
],
"has_more": true,
"next_page": "next_page",
"object": "page"
}
Example
curl "https://api.openai.com/v1/organization/usage/moderations?start_time=1730419200&limit=1" \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "page",
"data": [
{
"object": "bucket",
"start_time": 1730419200,
"end_time": 1730505600,
"results": [
{
"object": "organization.usage.moderations.result",
"input_tokens": 16,
"num_model_requests": 2,
"project_id": null,
"user_id": null,
"api_key_id": null,
"model": null
}
]
}
],
"has_more": false,
"next_page": null
}
Vector stores
get /organization/usage/vector_stores
Vector stores
Query Parameters
-
start_time: numberStart time (Unix seconds) of the query time range, inclusive.
-
bucket_width: optional "1m" or "1h" or "1d"Width of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
"1m" -
"1h" -
"1d"
-
-
end_time: optional numberEnd time (Unix seconds) of the query time range, exclusive.
-
group_by: optional array of "project_id"Group the usage data by the specified fields. Support fields include
project_id."project_id"
-
limit: optional numberSpecifies the number of buckets to return.
bucket_width=1d: default: 7, max: 31bucket_width=1h: default: 24, max: 168bucket_width=1m: default: 60, max: 1440
-
page: optional stringA cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
project_ids: optional array of stringReturn only usage for these projects.
Returns
-
data: array of object { end_time, object, results, start_time }-
end_time: number -
object: "bucket""bucket"
-
results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more-
OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }The aggregated completions usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.completions.result""organization.usage.completions.result"
-
output_tokens: numberThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: optional booleanWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: optional numberThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: optional numberThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: optional numberThe aggregated number of audio output tokens used.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: optional stringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageEmbeddingsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated embeddings usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.embeddings.result""organization.usage.embeddings.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageModerationsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated moderations usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.moderations.result""organization.usage.moderations.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageImagesResult object { images, num_model_requests, object, 6 more }The aggregated images usage details of the specific time bucket.
-
images: numberThe number of images processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.images.result""organization.usage.images.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: optional stringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: optional stringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioSpeechesResult object { characters, num_model_requests, object, 4 more }The aggregated audio speeches usage details of the specific time bucket.
-
characters: numberThe number of characters processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_speeches.result""organization.usage.audio_speeches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioTranscriptionsResult object { num_model_requests, object, seconds, 4 more }The aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_transcriptions.result""organization.usage.audio_transcriptions.result"
-
seconds: numberThe number of seconds processed.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageVectorStoresResult object { object, usage_bytes, project_id }The aggregated vector stores usage details of the specific time bucket.
-
object: "organization.usage.vector_stores.result""organization.usage.vector_stores.result"
-
usage_bytes: numberThe vector stores usage in bytes.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageCodeInterpreterSessionsResult object { num_sessions, object, project_id }The aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: numberThe number of code interpreter sessions.
-
object: "organization.usage.code_interpreter_sessions.result""organization.usage.code_interpreter_sessions.result"
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }The aggregated file search calls usage details of the specific time bucket.
-
num_requests: numberThe count of file search calls.
-
object: "organization.usage.file_searches.result""organization.usage.file_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: optional stringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }The aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: numberThe count of model requests.
-
num_requests: numberThe count of web search calls.
-
object: "organization.usage.web_searches.result""organization.usage.web_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: optional stringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationCostsResult object { object, amount, api_key_id, 3 more }The aggregated costs details of the specific time bucket.
-
object: "organization.costs.result""organization.costs.result"
-
amount: optional object { currency, value }The monetary value in its associated currency.
-
currency: optional stringLowercase ISO-4217 currency e.g. "usd"
-
value: optional numberThe numeric value of the cost.
-
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: optional stringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: optional numberWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: number
-
-
has_more: boolean -
next_page: string -
object: "page""page"
Example
curl https://api.openai.com/v1/organization/usage/vector_stores \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"data": [
{
"end_time": 0,
"object": "bucket",
"results": [
{
"input_tokens": 0,
"num_model_requests": 0,
"object": "organization.usage.completions.result",
"output_tokens": 0,
"api_key_id": "api_key_id",
"batch": true,
"input_audio_tokens": 0,
"input_cached_tokens": 0,
"model": "model",
"output_audio_tokens": 0,
"project_id": "project_id",
"service_tier": "service_tier",
"user_id": "user_id"
}
],
"start_time": 0
}
],
"has_more": true,
"next_page": "next_page",
"object": "page"
}
Example
curl "https://api.openai.com/v1/organization/usage/vector_stores?start_time=1730419200&limit=1" \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "page",
"data": [
{
"object": "bucket",
"start_time": 1730419200,
"end_time": 1730505600,
"results": [
{
"object": "organization.usage.vector_stores.result",
"usage_bytes": 1024,
"project_id": null
}
]
}
],
"has_more": false,
"next_page": null
}
File search calls
get /organization/usage/file_search_calls
File search calls
Query Parameters
-
start_time: numberStart time (Unix seconds) of the query time range, inclusive.
-
api_key_ids: optional array of stringReturn only usage for these API keys.
-
bucket_width: optional "1m" or "1h" or "1d"Width of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
"1m" -
"1h" -
"1d"
-
-
end_time: optional numberEnd time (Unix seconds) of the query time range, exclusive.
-
group_by: optional array of "project_id" or "user_id" or "api_key_id" or "vector_store_id"Group the usage data by the specified fields. Support fields include
project_id,user_id,api_key_id,vector_store_idor any combination of them.-
"project_id" -
"user_id" -
"api_key_id" -
"vector_store_id"
-
-
limit: optional numberSpecifies the number of buckets to return.
bucket_width=1d: default: 7, max: 31bucket_width=1h: default: 24, max: 168bucket_width=1m: default: 60, max: 1440
-
page: optional stringA cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
project_ids: optional array of stringReturn only usage for these projects.
-
user_ids: optional array of stringReturn only usage for these users.
-
vector_store_ids: optional array of stringReturn only usage for these vector stores.
Returns
-
data: array of object { end_time, object, results, start_time }-
end_time: number -
object: "bucket""bucket"
-
results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more-
OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }The aggregated completions usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.completions.result""organization.usage.completions.result"
-
output_tokens: numberThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: optional booleanWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: optional numberThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: optional numberThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: optional numberThe aggregated number of audio output tokens used.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: optional stringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageEmbeddingsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated embeddings usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.embeddings.result""organization.usage.embeddings.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageModerationsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated moderations usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.moderations.result""organization.usage.moderations.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageImagesResult object { images, num_model_requests, object, 6 more }The aggregated images usage details of the specific time bucket.
-
images: numberThe number of images processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.images.result""organization.usage.images.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: optional stringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: optional stringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioSpeechesResult object { characters, num_model_requests, object, 4 more }The aggregated audio speeches usage details of the specific time bucket.
-
characters: numberThe number of characters processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_speeches.result""organization.usage.audio_speeches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioTranscriptionsResult object { num_model_requests, object, seconds, 4 more }The aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_transcriptions.result""organization.usage.audio_transcriptions.result"
-
seconds: numberThe number of seconds processed.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageVectorStoresResult object { object, usage_bytes, project_id }The aggregated vector stores usage details of the specific time bucket.
-
object: "organization.usage.vector_stores.result""organization.usage.vector_stores.result"
-
usage_bytes: numberThe vector stores usage in bytes.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageCodeInterpreterSessionsResult object { num_sessions, object, project_id }The aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: numberThe number of code interpreter sessions.
-
object: "organization.usage.code_interpreter_sessions.result""organization.usage.code_interpreter_sessions.result"
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }The aggregated file search calls usage details of the specific time bucket.
-
num_requests: numberThe count of file search calls.
-
object: "organization.usage.file_searches.result""organization.usage.file_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: optional stringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }The aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: numberThe count of model requests.
-
num_requests: numberThe count of web search calls.
-
object: "organization.usage.web_searches.result""organization.usage.web_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: optional stringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationCostsResult object { object, amount, api_key_id, 3 more }The aggregated costs details of the specific time bucket.
-
object: "organization.costs.result""organization.costs.result"
-
amount: optional object { currency, value }The monetary value in its associated currency.
-
currency: optional stringLowercase ISO-4217 currency e.g. "usd"
-
value: optional numberThe numeric value of the cost.
-
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: optional stringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: optional numberWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: number
-
-
has_more: boolean -
next_page: string -
object: "page""page"
Example
curl https://api.openai.com/v1/organization/usage/file_search_calls \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"data": [
{
"end_time": 0,
"object": "bucket",
"results": [
{
"input_tokens": 0,
"num_model_requests": 0,
"object": "organization.usage.completions.result",
"output_tokens": 0,
"api_key_id": "api_key_id",
"batch": true,
"input_audio_tokens": 0,
"input_cached_tokens": 0,
"model": "model",
"output_audio_tokens": 0,
"project_id": "project_id",
"service_tier": "service_tier",
"user_id": "user_id"
}
],
"start_time": 0
}
],
"has_more": true,
"next_page": "next_page",
"object": "page"
}
Example
curl "https://api.openai.com/v1/organization/usage/file_search_calls?start_time=1730419200&limit=1" \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "page",
"data": [
{
"object": "bucket",
"start_time": 1730419200,
"end_time": 1730505600,
"results": [
{
"object": "organization.usage.file_searches.result",
"num_requests": 2,
"project_id": null,
"user_id": null,
"api_key_id": null,
"vector_store_id": null
}
]
}
],
"has_more": false,
"next_page": null
}
Web search calls
get /organization/usage/web_search_calls
Web search calls
Query Parameters
-
start_time: numberStart time (Unix seconds) of the query time range, inclusive.
-
api_key_ids: optional array of stringReturn only usage for these API keys.
-
bucket_width: optional "1m" or "1h" or "1d"Width of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
"1m" -
"1h" -
"1d"
-
-
context_levels: optional array of "low" or "medium" or "high"Return only web search usage for these context levels.
-
"low" -
"medium" -
"high"
-
-
end_time: optional numberEnd time (Unix seconds) of the query time range, exclusive.
-
group_by: optional array of "project_id" or "user_id" or "api_key_id" or 2 moreGroup the usage data by the specified fields. Support fields include
project_id,user_id,api_key_id,model,context_levelor any combination of them.-
"project_id" -
"user_id" -
"api_key_id" -
"model" -
"context_level"
-
-
limit: optional numberSpecifies the number of buckets to return.
bucket_width=1d: default: 7, max: 31bucket_width=1h: default: 24, max: 168bucket_width=1m: default: 60, max: 1440
-
models: optional array of stringReturn only usage for these models.
-
page: optional stringA cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
project_ids: optional array of stringReturn only usage for these projects.
-
user_ids: optional array of stringReturn only usage for these users.
Returns
-
data: array of object { end_time, object, results, start_time }-
end_time: number -
object: "bucket""bucket"
-
results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more-
OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }The aggregated completions usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.completions.result""organization.usage.completions.result"
-
output_tokens: numberThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: optional booleanWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: optional numberThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: optional numberThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: optional numberThe aggregated number of audio output tokens used.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: optional stringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageEmbeddingsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated embeddings usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.embeddings.result""organization.usage.embeddings.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageModerationsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated moderations usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.moderations.result""organization.usage.moderations.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageImagesResult object { images, num_model_requests, object, 6 more }The aggregated images usage details of the specific time bucket.
-
images: numberThe number of images processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.images.result""organization.usage.images.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: optional stringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: optional stringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioSpeechesResult object { characters, num_model_requests, object, 4 more }The aggregated audio speeches usage details of the specific time bucket.
-
characters: numberThe number of characters processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_speeches.result""organization.usage.audio_speeches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioTranscriptionsResult object { num_model_requests, object, seconds, 4 more }The aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_transcriptions.result""organization.usage.audio_transcriptions.result"
-
seconds: numberThe number of seconds processed.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageVectorStoresResult object { object, usage_bytes, project_id }The aggregated vector stores usage details of the specific time bucket.
-
object: "organization.usage.vector_stores.result""organization.usage.vector_stores.result"
-
usage_bytes: numberThe vector stores usage in bytes.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageCodeInterpreterSessionsResult object { num_sessions, object, project_id }The aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: numberThe number of code interpreter sessions.
-
object: "organization.usage.code_interpreter_sessions.result""organization.usage.code_interpreter_sessions.result"
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }The aggregated file search calls usage details of the specific time bucket.
-
num_requests: numberThe count of file search calls.
-
object: "organization.usage.file_searches.result""organization.usage.file_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: optional stringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }The aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: numberThe count of model requests.
-
num_requests: numberThe count of web search calls.
-
object: "organization.usage.web_searches.result""organization.usage.web_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: optional stringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationCostsResult object { object, amount, api_key_id, 3 more }The aggregated costs details of the specific time bucket.
-
object: "organization.costs.result""organization.costs.result"
-
amount: optional object { currency, value }The monetary value in its associated currency.
-
currency: optional stringLowercase ISO-4217 currency e.g. "usd"
-
value: optional numberThe numeric value of the cost.
-
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: optional stringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: optional numberWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: number
-
-
has_more: boolean -
next_page: string -
object: "page""page"
Example
curl https://api.openai.com/v1/organization/usage/web_search_calls \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"data": [
{
"end_time": 0,
"object": "bucket",
"results": [
{
"input_tokens": 0,
"num_model_requests": 0,
"object": "organization.usage.completions.result",
"output_tokens": 0,
"api_key_id": "api_key_id",
"batch": true,
"input_audio_tokens": 0,
"input_cached_tokens": 0,
"model": "model",
"output_audio_tokens": 0,
"project_id": "project_id",
"service_tier": "service_tier",
"user_id": "user_id"
}
],
"start_time": 0
}
],
"has_more": true,
"next_page": "next_page",
"object": "page"
}
Example
curl "https://api.openai.com/v1/organization/usage/web_search_calls?start_time=1730419200&limit=1" \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "page",
"data": [
{
"object": "bucket",
"start_time": 1730419200,
"end_time": 1730505600,
"results": [
{
"object": "organization.usage.web_searches.result",
"num_model_requests": 2,
"num_requests": 2,
"project_id": null,
"user_id": null,
"api_key_id": null,
"model": null,
"context_level": null
}
]
}
],
"has_more": false,
"next_page": null
}
Costs
get /organization/costs
Costs
Query Parameters
-
start_time: numberStart time (Unix seconds) of the query time range, inclusive.
-
api_key_ids: optional array of stringReturn only costs for these API keys.
-
bucket_width: optional "1d"Width of each time bucket in response. Currently only
1dis supported, default to1d."1d"
-
end_time: optional numberEnd time (Unix seconds) of the query time range, exclusive.
-
group_by: optional array of "project_id" or "line_item" or "api_key_id"Group the costs by the specified fields. Support fields include
project_id,line_item,api_key_idand any combination of them.-
"project_id" -
"line_item" -
"api_key_id"
-
-
limit: optional numberA limit on the number of buckets to be returned. Limit can range between 1 and 180, and the default is 7.
-
page: optional stringA cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
project_ids: optional array of stringReturn only costs for these projects.
Returns
-
data: array of object { end_time, object, results, start_time }-
end_time: number -
object: "bucket""bucket"
-
results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more-
OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }The aggregated completions usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.completions.result""organization.usage.completions.result"
-
output_tokens: numberThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: optional booleanWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: optional numberThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: optional numberThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: optional numberThe aggregated number of audio output tokens used.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: optional stringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageEmbeddingsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated embeddings usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.embeddings.result""organization.usage.embeddings.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageModerationsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated moderations usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.moderations.result""organization.usage.moderations.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageImagesResult object { images, num_model_requests, object, 6 more }The aggregated images usage details of the specific time bucket.
-
images: numberThe number of images processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.images.result""organization.usage.images.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: optional stringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: optional stringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioSpeechesResult object { characters, num_model_requests, object, 4 more }The aggregated audio speeches usage details of the specific time bucket.
-
characters: numberThe number of characters processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_speeches.result""organization.usage.audio_speeches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioTranscriptionsResult object { num_model_requests, object, seconds, 4 more }The aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_transcriptions.result""organization.usage.audio_transcriptions.result"
-
seconds: numberThe number of seconds processed.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageVectorStoresResult object { object, usage_bytes, project_id }The aggregated vector stores usage details of the specific time bucket.
-
object: "organization.usage.vector_stores.result""organization.usage.vector_stores.result"
-
usage_bytes: numberThe vector stores usage in bytes.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageCodeInterpreterSessionsResult object { num_sessions, object, project_id }The aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: numberThe number of code interpreter sessions.
-
object: "organization.usage.code_interpreter_sessions.result""organization.usage.code_interpreter_sessions.result"
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }The aggregated file search calls usage details of the specific time bucket.
-
num_requests: numberThe count of file search calls.
-
object: "organization.usage.file_searches.result""organization.usage.file_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: optional stringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }The aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: numberThe count of model requests.
-
num_requests: numberThe count of web search calls.
-
object: "organization.usage.web_searches.result""organization.usage.web_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: optional stringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationCostsResult object { object, amount, api_key_id, 3 more }The aggregated costs details of the specific time bucket.
-
object: "organization.costs.result""organization.costs.result"
-
amount: optional object { currency, value }The monetary value in its associated currency.
-
currency: optional stringLowercase ISO-4217 currency e.g. "usd"
-
value: optional numberThe numeric value of the cost.
-
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: optional stringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: optional numberWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: number
-
-
has_more: boolean -
next_page: string -
object: "page""page"
Example
curl https://api.openai.com/v1/organization/costs \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"data": [
{
"end_time": 0,
"object": "bucket",
"results": [
{
"input_tokens": 0,
"num_model_requests": 0,
"object": "organization.usage.completions.result",
"output_tokens": 0,
"api_key_id": "api_key_id",
"batch": true,
"input_audio_tokens": 0,
"input_cached_tokens": 0,
"model": "model",
"output_audio_tokens": 0,
"project_id": "project_id",
"service_tier": "service_tier",
"user_id": "user_id"
}
],
"start_time": 0
}
],
"has_more": true,
"next_page": "next_page",
"object": "page"
}
Example
curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1" \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "page",
"data": [
{
"object": "bucket",
"start_time": 1730419200,
"end_time": 1730505600,
"results": [
{
"object": "organization.costs.result",
"amount": {
"value": 0.06,
"currency": "usd"
},
"line_item": null,
"project_id": null,
"api_key_id": null,
"quantity": null
}
]
}
],
"has_more": false,
"next_page": null
}
Domain Types
Usage Audio Speeches Response
-
UsageAudioSpeechesResponse object { data, has_more, next_page, object }-
data: array of object { end_time, object, results, start_time }-
end_time: number -
object: "bucket""bucket"
-
results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more-
OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }The aggregated completions usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.completions.result""organization.usage.completions.result"
-
output_tokens: numberThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: optional booleanWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: optional numberThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: optional numberThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: optional numberThe aggregated number of audio output tokens used.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: optional stringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageEmbeddingsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated embeddings usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.embeddings.result""organization.usage.embeddings.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageModerationsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated moderations usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.moderations.result""organization.usage.moderations.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageImagesResult object { images, num_model_requests, object, 6 more }The aggregated images usage details of the specific time bucket.
-
images: numberThe number of images processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.images.result""organization.usage.images.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: optional stringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: optional stringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioSpeechesResult object { characters, num_model_requests, object, 4 more }The aggregated audio speeches usage details of the specific time bucket.
-
characters: numberThe number of characters processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_speeches.result""organization.usage.audio_speeches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioTranscriptionsResult object { num_model_requests, object, seconds, 4 more }The aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_transcriptions.result""organization.usage.audio_transcriptions.result"
-
seconds: numberThe number of seconds processed.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageVectorStoresResult object { object, usage_bytes, project_id }The aggregated vector stores usage details of the specific time bucket.
-
object: "organization.usage.vector_stores.result""organization.usage.vector_stores.result"
-
usage_bytes: numberThe vector stores usage in bytes.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageCodeInterpreterSessionsResult object { num_sessions, object, project_id }The aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: numberThe number of code interpreter sessions.
-
object: "organization.usage.code_interpreter_sessions.result""organization.usage.code_interpreter_sessions.result"
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }The aggregated file search calls usage details of the specific time bucket.
-
num_requests: numberThe count of file search calls.
-
object: "organization.usage.file_searches.result""organization.usage.file_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: optional stringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }The aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: numberThe count of model requests.
-
num_requests: numberThe count of web search calls.
-
object: "organization.usage.web_searches.result""organization.usage.web_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: optional stringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationCostsResult object { object, amount, api_key_id, 3 more }The aggregated costs details of the specific time bucket.
-
object: "organization.costs.result""organization.costs.result"
-
amount: optional object { currency, value }The monetary value in its associated currency.
-
currency: optional stringLowercase ISO-4217 currency e.g. "usd"
-
value: optional numberThe numeric value of the cost.
-
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: optional stringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: optional numberWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: number
-
-
has_more: boolean -
next_page: string -
object: "page""page"
-
Usage Audio Transcriptions Response
-
UsageAudioTranscriptionsResponse object { data, has_more, next_page, object }-
data: array of object { end_time, object, results, start_time }-
end_time: number -
object: "bucket""bucket"
-
results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more-
OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }The aggregated completions usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.completions.result""organization.usage.completions.result"
-
output_tokens: numberThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: optional booleanWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: optional numberThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: optional numberThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: optional numberThe aggregated number of audio output tokens used.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: optional stringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageEmbeddingsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated embeddings usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.embeddings.result""organization.usage.embeddings.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageModerationsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated moderations usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.moderations.result""organization.usage.moderations.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageImagesResult object { images, num_model_requests, object, 6 more }The aggregated images usage details of the specific time bucket.
-
images: numberThe number of images processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.images.result""organization.usage.images.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: optional stringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: optional stringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioSpeechesResult object { characters, num_model_requests, object, 4 more }The aggregated audio speeches usage details of the specific time bucket.
-
characters: numberThe number of characters processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_speeches.result""organization.usage.audio_speeches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioTranscriptionsResult object { num_model_requests, object, seconds, 4 more }The aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_transcriptions.result""organization.usage.audio_transcriptions.result"
-
seconds: numberThe number of seconds processed.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageVectorStoresResult object { object, usage_bytes, project_id }The aggregated vector stores usage details of the specific time bucket.
-
object: "organization.usage.vector_stores.result""organization.usage.vector_stores.result"
-
usage_bytes: numberThe vector stores usage in bytes.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageCodeInterpreterSessionsResult object { num_sessions, object, project_id }The aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: numberThe number of code interpreter sessions.
-
object: "organization.usage.code_interpreter_sessions.result""organization.usage.code_interpreter_sessions.result"
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }The aggregated file search calls usage details of the specific time bucket.
-
num_requests: numberThe count of file search calls.
-
object: "organization.usage.file_searches.result""organization.usage.file_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: optional stringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }The aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: numberThe count of model requests.
-
num_requests: numberThe count of web search calls.
-
object: "organization.usage.web_searches.result""organization.usage.web_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: optional stringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationCostsResult object { object, amount, api_key_id, 3 more }The aggregated costs details of the specific time bucket.
-
object: "organization.costs.result""organization.costs.result"
-
amount: optional object { currency, value }The monetary value in its associated currency.
-
currency: optional stringLowercase ISO-4217 currency e.g. "usd"
-
value: optional numberThe numeric value of the cost.
-
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: optional stringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: optional numberWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: number
-
-
has_more: boolean -
next_page: string -
object: "page""page"
-
Usage Code Interpreter Sessions Response
-
UsageCodeInterpreterSessionsResponse object { data, has_more, next_page, object }-
data: array of object { end_time, object, results, start_time }-
end_time: number -
object: "bucket""bucket"
-
results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more-
OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }The aggregated completions usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.completions.result""organization.usage.completions.result"
-
output_tokens: numberThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: optional booleanWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: optional numberThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: optional numberThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: optional numberThe aggregated number of audio output tokens used.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: optional stringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageEmbeddingsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated embeddings usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.embeddings.result""organization.usage.embeddings.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageModerationsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated moderations usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.moderations.result""organization.usage.moderations.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageImagesResult object { images, num_model_requests, object, 6 more }The aggregated images usage details of the specific time bucket.
-
images: numberThe number of images processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.images.result""organization.usage.images.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: optional stringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: optional stringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioSpeechesResult object { characters, num_model_requests, object, 4 more }The aggregated audio speeches usage details of the specific time bucket.
-
characters: numberThe number of characters processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_speeches.result""organization.usage.audio_speeches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioTranscriptionsResult object { num_model_requests, object, seconds, 4 more }The aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_transcriptions.result""organization.usage.audio_transcriptions.result"
-
seconds: numberThe number of seconds processed.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageVectorStoresResult object { object, usage_bytes, project_id }The aggregated vector stores usage details of the specific time bucket.
-
object: "organization.usage.vector_stores.result""organization.usage.vector_stores.result"
-
usage_bytes: numberThe vector stores usage in bytes.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageCodeInterpreterSessionsResult object { num_sessions, object, project_id }The aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: numberThe number of code interpreter sessions.
-
object: "organization.usage.code_interpreter_sessions.result""organization.usage.code_interpreter_sessions.result"
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }The aggregated file search calls usage details of the specific time bucket.
-
num_requests: numberThe count of file search calls.
-
object: "organization.usage.file_searches.result""organization.usage.file_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: optional stringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }The aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: numberThe count of model requests.
-
num_requests: numberThe count of web search calls.
-
object: "organization.usage.web_searches.result""organization.usage.web_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: optional stringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationCostsResult object { object, amount, api_key_id, 3 more }The aggregated costs details of the specific time bucket.
-
object: "organization.costs.result""organization.costs.result"
-
amount: optional object { currency, value }The monetary value in its associated currency.
-
currency: optional stringLowercase ISO-4217 currency e.g. "usd"
-
value: optional numberThe numeric value of the cost.
-
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: optional stringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: optional numberWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: number
-
-
has_more: boolean -
next_page: string -
object: "page""page"
-
Usage Completions Response
-
UsageCompletionsResponse object { data, has_more, next_page, object }-
data: array of object { end_time, object, results, start_time }-
end_time: number -
object: "bucket""bucket"
-
results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more-
OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }The aggregated completions usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.completions.result""organization.usage.completions.result"
-
output_tokens: numberThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: optional booleanWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: optional numberThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: optional numberThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: optional numberThe aggregated number of audio output tokens used.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: optional stringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageEmbeddingsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated embeddings usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.embeddings.result""organization.usage.embeddings.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageModerationsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated moderations usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.moderations.result""organization.usage.moderations.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageImagesResult object { images, num_model_requests, object, 6 more }The aggregated images usage details of the specific time bucket.
-
images: numberThe number of images processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.images.result""organization.usage.images.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: optional stringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: optional stringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioSpeechesResult object { characters, num_model_requests, object, 4 more }The aggregated audio speeches usage details of the specific time bucket.
-
characters: numberThe number of characters processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_speeches.result""organization.usage.audio_speeches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioTranscriptionsResult object { num_model_requests, object, seconds, 4 more }The aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_transcriptions.result""organization.usage.audio_transcriptions.result"
-
seconds: numberThe number of seconds processed.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageVectorStoresResult object { object, usage_bytes, project_id }The aggregated vector stores usage details of the specific time bucket.
-
object: "organization.usage.vector_stores.result""organization.usage.vector_stores.result"
-
usage_bytes: numberThe vector stores usage in bytes.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageCodeInterpreterSessionsResult object { num_sessions, object, project_id }The aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: numberThe number of code interpreter sessions.
-
object: "organization.usage.code_interpreter_sessions.result""organization.usage.code_interpreter_sessions.result"
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }The aggregated file search calls usage details of the specific time bucket.
-
num_requests: numberThe count of file search calls.
-
object: "organization.usage.file_searches.result""organization.usage.file_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: optional stringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }The aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: numberThe count of model requests.
-
num_requests: numberThe count of web search calls.
-
object: "organization.usage.web_searches.result""organization.usage.web_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: optional stringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationCostsResult object { object, amount, api_key_id, 3 more }The aggregated costs details of the specific time bucket.
-
object: "organization.costs.result""organization.costs.result"
-
amount: optional object { currency, value }The monetary value in its associated currency.
-
currency: optional stringLowercase ISO-4217 currency e.g. "usd"
-
value: optional numberThe numeric value of the cost.
-
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: optional stringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: optional numberWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: number
-
-
has_more: boolean -
next_page: string -
object: "page""page"
-
Usage Embeddings Response
-
UsageEmbeddingsResponse object { data, has_more, next_page, object }-
data: array of object { end_time, object, results, start_time }-
end_time: number -
object: "bucket""bucket"
-
results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more-
OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }The aggregated completions usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.completions.result""organization.usage.completions.result"
-
output_tokens: numberThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: optional booleanWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: optional numberThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: optional numberThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: optional numberThe aggregated number of audio output tokens used.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: optional stringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageEmbeddingsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated embeddings usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.embeddings.result""organization.usage.embeddings.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageModerationsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated moderations usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.moderations.result""organization.usage.moderations.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageImagesResult object { images, num_model_requests, object, 6 more }The aggregated images usage details of the specific time bucket.
-
images: numberThe number of images processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.images.result""organization.usage.images.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: optional stringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: optional stringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioSpeechesResult object { characters, num_model_requests, object, 4 more }The aggregated audio speeches usage details of the specific time bucket.
-
characters: numberThe number of characters processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_speeches.result""organization.usage.audio_speeches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioTranscriptionsResult object { num_model_requests, object, seconds, 4 more }The aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_transcriptions.result""organization.usage.audio_transcriptions.result"
-
seconds: numberThe number of seconds processed.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageVectorStoresResult object { object, usage_bytes, project_id }The aggregated vector stores usage details of the specific time bucket.
-
object: "organization.usage.vector_stores.result""organization.usage.vector_stores.result"
-
usage_bytes: numberThe vector stores usage in bytes.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageCodeInterpreterSessionsResult object { num_sessions, object, project_id }The aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: numberThe number of code interpreter sessions.
-
object: "organization.usage.code_interpreter_sessions.result""organization.usage.code_interpreter_sessions.result"
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }The aggregated file search calls usage details of the specific time bucket.
-
num_requests: numberThe count of file search calls.
-
object: "organization.usage.file_searches.result""organization.usage.file_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: optional stringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }The aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: numberThe count of model requests.
-
num_requests: numberThe count of web search calls.
-
object: "organization.usage.web_searches.result""organization.usage.web_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: optional stringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationCostsResult object { object, amount, api_key_id, 3 more }The aggregated costs details of the specific time bucket.
-
object: "organization.costs.result""organization.costs.result"
-
amount: optional object { currency, value }The monetary value in its associated currency.
-
currency: optional stringLowercase ISO-4217 currency e.g. "usd"
-
value: optional numberThe numeric value of the cost.
-
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: optional stringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: optional numberWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: number
-
-
has_more: boolean -
next_page: string -
object: "page""page"
-
Usage Images Response
-
UsageImagesResponse object { data, has_more, next_page, object }-
data: array of object { end_time, object, results, start_time }-
end_time: number -
object: "bucket""bucket"
-
results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more-
OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }The aggregated completions usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.completions.result""organization.usage.completions.result"
-
output_tokens: numberThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: optional booleanWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: optional numberThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: optional numberThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: optional numberThe aggregated number of audio output tokens used.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: optional stringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageEmbeddingsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated embeddings usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.embeddings.result""organization.usage.embeddings.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageModerationsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated moderations usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.moderations.result""organization.usage.moderations.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageImagesResult object { images, num_model_requests, object, 6 more }The aggregated images usage details of the specific time bucket.
-
images: numberThe number of images processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.images.result""organization.usage.images.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: optional stringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: optional stringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioSpeechesResult object { characters, num_model_requests, object, 4 more }The aggregated audio speeches usage details of the specific time bucket.
-
characters: numberThe number of characters processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_speeches.result""organization.usage.audio_speeches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioTranscriptionsResult object { num_model_requests, object, seconds, 4 more }The aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_transcriptions.result""organization.usage.audio_transcriptions.result"
-
seconds: numberThe number of seconds processed.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageVectorStoresResult object { object, usage_bytes, project_id }The aggregated vector stores usage details of the specific time bucket.
-
object: "organization.usage.vector_stores.result""organization.usage.vector_stores.result"
-
usage_bytes: numberThe vector stores usage in bytes.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageCodeInterpreterSessionsResult object { num_sessions, object, project_id }The aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: numberThe number of code interpreter sessions.
-
object: "organization.usage.code_interpreter_sessions.result""organization.usage.code_interpreter_sessions.result"
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }The aggregated file search calls usage details of the specific time bucket.
-
num_requests: numberThe count of file search calls.
-
object: "organization.usage.file_searches.result""organization.usage.file_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: optional stringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }The aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: numberThe count of model requests.
-
num_requests: numberThe count of web search calls.
-
object: "organization.usage.web_searches.result""organization.usage.web_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: optional stringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationCostsResult object { object, amount, api_key_id, 3 more }The aggregated costs details of the specific time bucket.
-
object: "organization.costs.result""organization.costs.result"
-
amount: optional object { currency, value }The monetary value in its associated currency.
-
currency: optional stringLowercase ISO-4217 currency e.g. "usd"
-
value: optional numberThe numeric value of the cost.
-
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: optional stringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: optional numberWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: number
-
-
has_more: boolean -
next_page: string -
object: "page""page"
-
Usage Moderations Response
-
UsageModerationsResponse object { data, has_more, next_page, object }-
data: array of object { end_time, object, results, start_time }-
end_time: number -
object: "bucket""bucket"
-
results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more-
OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }The aggregated completions usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.completions.result""organization.usage.completions.result"
-
output_tokens: numberThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: optional booleanWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: optional numberThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: optional numberThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: optional numberThe aggregated number of audio output tokens used.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: optional stringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageEmbeddingsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated embeddings usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.embeddings.result""organization.usage.embeddings.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageModerationsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated moderations usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.moderations.result""organization.usage.moderations.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageImagesResult object { images, num_model_requests, object, 6 more }The aggregated images usage details of the specific time bucket.
-
images: numberThe number of images processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.images.result""organization.usage.images.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: optional stringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: optional stringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioSpeechesResult object { characters, num_model_requests, object, 4 more }The aggregated audio speeches usage details of the specific time bucket.
-
characters: numberThe number of characters processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_speeches.result""organization.usage.audio_speeches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioTranscriptionsResult object { num_model_requests, object, seconds, 4 more }The aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_transcriptions.result""organization.usage.audio_transcriptions.result"
-
seconds: numberThe number of seconds processed.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageVectorStoresResult object { object, usage_bytes, project_id }The aggregated vector stores usage details of the specific time bucket.
-
object: "organization.usage.vector_stores.result""organization.usage.vector_stores.result"
-
usage_bytes: numberThe vector stores usage in bytes.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageCodeInterpreterSessionsResult object { num_sessions, object, project_id }The aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: numberThe number of code interpreter sessions.
-
object: "organization.usage.code_interpreter_sessions.result""organization.usage.code_interpreter_sessions.result"
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }The aggregated file search calls usage details of the specific time bucket.
-
num_requests: numberThe count of file search calls.
-
object: "organization.usage.file_searches.result""organization.usage.file_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: optional stringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }The aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: numberThe count of model requests.
-
num_requests: numberThe count of web search calls.
-
object: "organization.usage.web_searches.result""organization.usage.web_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: optional stringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationCostsResult object { object, amount, api_key_id, 3 more }The aggregated costs details of the specific time bucket.
-
object: "organization.costs.result""organization.costs.result"
-
amount: optional object { currency, value }The monetary value in its associated currency.
-
currency: optional stringLowercase ISO-4217 currency e.g. "usd"
-
value: optional numberThe numeric value of the cost.
-
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: optional stringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: optional numberWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: number
-
-
has_more: boolean -
next_page: string -
object: "page""page"
-
Usage Vector Stores Response
-
UsageVectorStoresResponse object { data, has_more, next_page, object }-
data: array of object { end_time, object, results, start_time }-
end_time: number -
object: "bucket""bucket"
-
results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more-
OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }The aggregated completions usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.completions.result""organization.usage.completions.result"
-
output_tokens: numberThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: optional booleanWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: optional numberThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: optional numberThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: optional numberThe aggregated number of audio output tokens used.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: optional stringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageEmbeddingsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated embeddings usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.embeddings.result""organization.usage.embeddings.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageModerationsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated moderations usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.moderations.result""organization.usage.moderations.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageImagesResult object { images, num_model_requests, object, 6 more }The aggregated images usage details of the specific time bucket.
-
images: numberThe number of images processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.images.result""organization.usage.images.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: optional stringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: optional stringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioSpeechesResult object { characters, num_model_requests, object, 4 more }The aggregated audio speeches usage details of the specific time bucket.
-
characters: numberThe number of characters processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_speeches.result""organization.usage.audio_speeches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioTranscriptionsResult object { num_model_requests, object, seconds, 4 more }The aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_transcriptions.result""organization.usage.audio_transcriptions.result"
-
seconds: numberThe number of seconds processed.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageVectorStoresResult object { object, usage_bytes, project_id }The aggregated vector stores usage details of the specific time bucket.
-
object: "organization.usage.vector_stores.result""organization.usage.vector_stores.result"
-
usage_bytes: numberThe vector stores usage in bytes.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageCodeInterpreterSessionsResult object { num_sessions, object, project_id }The aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: numberThe number of code interpreter sessions.
-
object: "organization.usage.code_interpreter_sessions.result""organization.usage.code_interpreter_sessions.result"
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }The aggregated file search calls usage details of the specific time bucket.
-
num_requests: numberThe count of file search calls.
-
object: "organization.usage.file_searches.result""organization.usage.file_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: optional stringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }The aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: numberThe count of model requests.
-
num_requests: numberThe count of web search calls.
-
object: "organization.usage.web_searches.result""organization.usage.web_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: optional stringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationCostsResult object { object, amount, api_key_id, 3 more }The aggregated costs details of the specific time bucket.
-
object: "organization.costs.result""organization.costs.result"
-
amount: optional object { currency, value }The monetary value in its associated currency.
-
currency: optional stringLowercase ISO-4217 currency e.g. "usd"
-
value: optional numberThe numeric value of the cost.
-
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: optional stringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: optional numberWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: number
-
-
has_more: boolean -
next_page: string -
object: "page""page"
-
Usage File Search Calls Response
-
UsageFileSearchCallsResponse object { data, has_more, next_page, object }-
data: array of object { end_time, object, results, start_time }-
end_time: number -
object: "bucket""bucket"
-
results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more-
OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }The aggregated completions usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.completions.result""organization.usage.completions.result"
-
output_tokens: numberThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: optional booleanWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: optional numberThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: optional numberThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: optional numberThe aggregated number of audio output tokens used.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: optional stringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageEmbeddingsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated embeddings usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.embeddings.result""organization.usage.embeddings.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageModerationsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated moderations usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.moderations.result""organization.usage.moderations.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageImagesResult object { images, num_model_requests, object, 6 more }The aggregated images usage details of the specific time bucket.
-
images: numberThe number of images processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.images.result""organization.usage.images.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: optional stringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: optional stringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioSpeechesResult object { characters, num_model_requests, object, 4 more }The aggregated audio speeches usage details of the specific time bucket.
-
characters: numberThe number of characters processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_speeches.result""organization.usage.audio_speeches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioTranscriptionsResult object { num_model_requests, object, seconds, 4 more }The aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_transcriptions.result""organization.usage.audio_transcriptions.result"
-
seconds: numberThe number of seconds processed.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageVectorStoresResult object { object, usage_bytes, project_id }The aggregated vector stores usage details of the specific time bucket.
-
object: "organization.usage.vector_stores.result""organization.usage.vector_stores.result"
-
usage_bytes: numberThe vector stores usage in bytes.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageCodeInterpreterSessionsResult object { num_sessions, object, project_id }The aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: numberThe number of code interpreter sessions.
-
object: "organization.usage.code_interpreter_sessions.result""organization.usage.code_interpreter_sessions.result"
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }The aggregated file search calls usage details of the specific time bucket.
-
num_requests: numberThe count of file search calls.
-
object: "organization.usage.file_searches.result""organization.usage.file_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: optional stringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }The aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: numberThe count of model requests.
-
num_requests: numberThe count of web search calls.
-
object: "organization.usage.web_searches.result""organization.usage.web_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: optional stringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationCostsResult object { object, amount, api_key_id, 3 more }The aggregated costs details of the specific time bucket.
-
object: "organization.costs.result""organization.costs.result"
-
amount: optional object { currency, value }The monetary value in its associated currency.
-
currency: optional stringLowercase ISO-4217 currency e.g. "usd"
-
value: optional numberThe numeric value of the cost.
-
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: optional stringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: optional numberWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: number
-
-
has_more: boolean -
next_page: string -
object: "page""page"
-
Usage Web Search Calls Response
-
UsageWebSearchCallsResponse object { data, has_more, next_page, object }-
data: array of object { end_time, object, results, start_time }-
end_time: number -
object: "bucket""bucket"
-
results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more-
OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }The aggregated completions usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.completions.result""organization.usage.completions.result"
-
output_tokens: numberThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: optional booleanWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: optional numberThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: optional numberThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: optional numberThe aggregated number of audio output tokens used.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: optional stringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageEmbeddingsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated embeddings usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.embeddings.result""organization.usage.embeddings.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageModerationsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated moderations usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.moderations.result""organization.usage.moderations.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageImagesResult object { images, num_model_requests, object, 6 more }The aggregated images usage details of the specific time bucket.
-
images: numberThe number of images processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.images.result""organization.usage.images.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: optional stringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: optional stringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioSpeechesResult object { characters, num_model_requests, object, 4 more }The aggregated audio speeches usage details of the specific time bucket.
-
characters: numberThe number of characters processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_speeches.result""organization.usage.audio_speeches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioTranscriptionsResult object { num_model_requests, object, seconds, 4 more }The aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_transcriptions.result""organization.usage.audio_transcriptions.result"
-
seconds: numberThe number of seconds processed.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageVectorStoresResult object { object, usage_bytes, project_id }The aggregated vector stores usage details of the specific time bucket.
-
object: "organization.usage.vector_stores.result""organization.usage.vector_stores.result"
-
usage_bytes: numberThe vector stores usage in bytes.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageCodeInterpreterSessionsResult object { num_sessions, object, project_id }The aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: numberThe number of code interpreter sessions.
-
object: "organization.usage.code_interpreter_sessions.result""organization.usage.code_interpreter_sessions.result"
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }The aggregated file search calls usage details of the specific time bucket.
-
num_requests: numberThe count of file search calls.
-
object: "organization.usage.file_searches.result""organization.usage.file_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: optional stringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }The aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: numberThe count of model requests.
-
num_requests: numberThe count of web search calls.
-
object: "organization.usage.web_searches.result""organization.usage.web_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: optional stringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationCostsResult object { object, amount, api_key_id, 3 more }The aggregated costs details of the specific time bucket.
-
object: "organization.costs.result""organization.costs.result"
-
amount: optional object { currency, value }The monetary value in its associated currency.
-
currency: optional stringLowercase ISO-4217 currency e.g. "usd"
-
value: optional numberThe numeric value of the cost.
-
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: optional stringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: optional numberWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: number
-
-
has_more: boolean -
next_page: string -
object: "page""page"
-
Usage Costs Response
-
UsageCostsResponse object { data, has_more, next_page, object }-
data: array of object { end_time, object, results, start_time }-
end_time: number -
object: "bucket""bucket"
-
results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more-
OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }The aggregated completions usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.completions.result""organization.usage.completions.result"
-
output_tokens: numberThe aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
batch: optional booleanWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
input_audio_tokens: optional numberThe aggregated number of audio input tokens used, including cached tokens.
-
input_cached_tokens: optional numberThe aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
output_audio_tokens: optional numberThe aggregated number of audio output tokens used.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
service_tier: optional stringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageEmbeddingsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated embeddings usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.embeddings.result""organization.usage.embeddings.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageModerationsResult object { input_tokens, num_model_requests, object, 4 more }The aggregated moderations usage details of the specific time bucket.
-
input_tokens: numberThe aggregated number of input tokens used.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.moderations.result""organization.usage.moderations.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageImagesResult object { images, num_model_requests, object, 6 more }The aggregated images usage details of the specific time bucket.
-
images: numberThe number of images processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.images.result""organization.usage.images.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
size: optional stringWhen
group_by=size, this field provides the image size of the grouped usage result. -
source: optional stringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioSpeechesResult object { characters, num_model_requests, object, 4 more }The aggregated audio speeches usage details of the specific time bucket.
-
characters: numberThe number of characters processed.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_speeches.result""organization.usage.audio_speeches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageAudioTranscriptionsResult object { num_model_requests, object, seconds, 4 more }The aggregated audio transcriptions usage details of the specific time bucket.
-
num_model_requests: numberThe count of requests made to the model.
-
object: "organization.usage.audio_transcriptions.result""organization.usage.audio_transcriptions.result"
-
seconds: numberThe number of seconds processed.
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationUsageVectorStoresResult object { object, usage_bytes, project_id }The aggregated vector stores usage details of the specific time bucket.
-
object: "organization.usage.vector_stores.result""organization.usage.vector_stores.result"
-
usage_bytes: numberThe vector stores usage in bytes.
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageCodeInterpreterSessionsResult object { num_sessions, object, project_id }The aggregated code interpreter sessions usage details of the specific time bucket.
-
num_sessions: numberThe number of code interpreter sessions.
-
object: "organization.usage.code_interpreter_sessions.result""organization.usage.code_interpreter_sessions.result"
-
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }The aggregated file search calls usage details of the specific time bucket.
-
num_requests: numberThe count of file search calls.
-
object: "organization.usage.file_searches.result""organization.usage.file_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
vector_store_id: optional stringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }The aggregated web search calls usage details of the specific time bucket.
-
num_model_requests: numberThe count of model requests.
-
num_requests: numberThe count of web search calls.
-
object: "organization.usage.web_searches.result""organization.usage.web_searches.result"
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
context_level: optional stringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
model: optional stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
user_id: optional stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
OrganizationCostsResult object { object, amount, api_key_id, 3 more }The aggregated costs details of the specific time bucket.
-
object: "organization.costs.result""organization.costs.result"
-
amount: optional object { currency, value }The monetary value in its associated currency.
-
currency: optional stringLowercase ISO-4217 currency e.g. "usd"
-
value: optional numberThe numeric value of the cost.
-
-
api_key_id: optional stringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
line_item: optional stringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
project_id: optional stringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
quantity: optional numberWhen
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
start_time: number
-
-
has_more: boolean -
next_page: string -
object: "page""page"
-
Invites
List invites
get /organization/invites
List invites
Query Parameters
-
after: optional stringA cursor for use in pagination.
afteris an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. -
limit: optional numberA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
Returns
-
data: array of Invite-
id: stringThe identifier, which can be referenced in API endpoints
-
created_at: numberThe Unix timestamp (in seconds) of when the invite was sent.
-
email: stringThe email address of the individual to whom the invite was sent
-
object: "organization.invite"The object type, which is always
organization.invite"organization.invite"
-
projects: array of object { id, role }The projects that were granted membership upon acceptance of the invite.
-
id: stringProject's public ID
-
role: "member" or "owner"Project membership role
-
"member" -
"owner"
-
-
-
role: "owner" or "reader"ownerorreader-
"owner" -
"reader"
-
-
status: "accepted" or "expired" or "pending"accepted,expired, orpending-
"accepted" -
"expired" -
"pending"
-
-
accepted_at: optional numberThe Unix timestamp (in seconds) of when the invite was accepted.
-
expires_at: optional numberThe Unix timestamp (in seconds) of when the invite expires.
-
-
has_more: booleanThe
has_moreproperty is used for pagination to indicate there are additional results. -
object: "list"The object type, which is always
list"list"
-
first_id: optional stringThe first
invite_idin the retrievedlist -
last_id: optional stringThe last
invite_idin the retrievedlist
Example
curl https://api.openai.com/v1/organization/invites \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"data": [
{
"id": "id",
"created_at": 0,
"email": "email",
"object": "organization.invite",
"projects": [
{
"id": "id",
"role": "member"
}
],
"role": "owner",
"status": "accepted",
"accepted_at": 0,
"expires_at": 0
}
],
"has_more": true,
"object": "list",
"first_id": "first_id",
"last_id": "last_id"
}
Example
curl https://api.openai.com/v1/organization/invites?after=invite-abc&limit=20 \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "list",
"data": [
{
"object": "organization.invite",
"id": "invite-abc",
"email": "user@example.com",
"role": "owner",
"status": "accepted",
"created_at": 1711471533,
"expires_at": 1711471533,
"accepted_at": 1711471533
}
],
"first_id": "invite-abc",
"last_id": "invite-abc",
"has_more": false
}
Create invite
post /organization/invites
Create invite
Body Parameters
-
email: stringSend an email to this address
-
role: "reader" or "owner"ownerorreader-
"reader" -
"owner"
-
-
projects: optional array of object { id, role }An array of projects to which membership is granted at the same time the org invite is accepted. If omitted, the user will be invited to the default project for compatibility with legacy behavior. If empty list is passed, the user will not be invited to any projects, including the default one.
-
id: stringProject's public ID
-
role: "member" or "owner"Project membership role
-
"member" -
"owner"
-
-
Returns
-
Invite object { id, created_at, email, 6 more }Represents an individual
inviteto the organization.-
id: stringThe identifier, which can be referenced in API endpoints
-
created_at: numberThe Unix timestamp (in seconds) of when the invite was sent.
-
email: stringThe email address of the individual to whom the invite was sent
-
object: "organization.invite"The object type, which is always
organization.invite"organization.invite"
-
projects: array of object { id, role }The projects that were granted membership upon acceptance of the invite.
-
id: stringProject's public ID
-
role: "member" or "owner"Project membership role
-
"member" -
"owner"
-
-
-
role: "owner" or "reader"ownerorreader-
"owner" -
"reader"
-
-
status: "accepted" or "expired" or "pending"accepted,expired, orpending-
"accepted" -
"expired" -
"pending"
-
-
accepted_at: optional numberThe Unix timestamp (in seconds) of when the invite was accepted.
-
expires_at: optional numberThe Unix timestamp (in seconds) of when the invite expires.
-
Example
curl https://api.openai.com/v1/organization/invites \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-d '{
"email": "email",
"role": "reader"
}'
Response
{
"id": "id",
"created_at": 0,
"email": "email",
"object": "organization.invite",
"projects": [
{
"id": "id",
"role": "member"
}
],
"role": "owner",
"status": "accepted",
"accepted_at": 0,
"expires_at": 0
}
Example
curl -X POST https://api.openai.com/v1/organization/invites \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"email": "anotheruser@example.com",
"role": "reader",
"projects": [
{
"id": "project-xyz",
"role": "member"
},
{
"id": "project-abc",
"role": "owner"
}
]
}'
Response
{
"object": "organization.invite",
"id": "invite-def",
"email": "anotheruser@example.com",
"role": "reader",
"status": "pending",
"created_at": 1711471533,
"expires_at": 1711471533,
"accepted_at": null,
"projects": [
{
"id": "project-xyz",
"role": "member"
},
{
"id": "project-abc",
"role": "owner"
}
]
}
Retrieve invite
get /organization/invites/{invite_id}
Retrieve invite
Path Parameters
invite_id: string
Returns
-
Invite object { id, created_at, email, 6 more }Represents an individual
inviteto the organization.-
id: stringThe identifier, which can be referenced in API endpoints
-
created_at: numberThe Unix timestamp (in seconds) of when the invite was sent.
-
email: stringThe email address of the individual to whom the invite was sent
-
object: "organization.invite"The object type, which is always
organization.invite"organization.invite"
-
projects: array of object { id, role }The projects that were granted membership upon acceptance of the invite.
-
id: stringProject's public ID
-
role: "member" or "owner"Project membership role
-
"member" -
"owner"
-
-
-
role: "owner" or "reader"ownerorreader-
"owner" -
"reader"
-
-
status: "accepted" or "expired" or "pending"accepted,expired, orpending-
"accepted" -
"expired" -
"pending"
-
-
accepted_at: optional numberThe Unix timestamp (in seconds) of when the invite was accepted.
-
expires_at: optional numberThe Unix timestamp (in seconds) of when the invite expires.
-
Example
curl https://api.openai.com/v1/organization/invites/$INVITE_ID \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"id": "id",
"created_at": 0,
"email": "email",
"object": "organization.invite",
"projects": [
{
"id": "id",
"role": "member"
}
],
"role": "owner",
"status": "accepted",
"accepted_at": 0,
"expires_at": 0
}
Example
curl https://api.openai.com/v1/organization/invites/invite-abc \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "organization.invite",
"id": "invite-abc",
"email": "user@example.com",
"role": "owner",
"status": "accepted",
"created_at": 1711471533,
"expires_at": 1711471533,
"accepted_at": 1711471533
}
Delete invite
delete /organization/invites/{invite_id}
Delete invite
Path Parameters
invite_id: string
Returns
-
id: string -
deleted: boolean -
object: "organization.invite.deleted"The object type, which is always
organization.invite.deleted"organization.invite.deleted"
Example
curl https://api.openai.com/v1/organization/invites/$INVITE_ID \
-X DELETE \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"id": "id",
"deleted": true,
"object": "organization.invite.deleted"
}
Example
curl -X DELETE https://api.openai.com/v1/organization/invites/invite-abc \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "organization.invite.deleted",
"id": "invite-abc",
"deleted": true
}
Domain Types
Invite
-
Invite object { id, created_at, email, 6 more }Represents an individual
inviteto the organization.-
id: stringThe identifier, which can be referenced in API endpoints
-
created_at: numberThe Unix timestamp (in seconds) of when the invite was sent.
-
email: stringThe email address of the individual to whom the invite was sent
-
object: "organization.invite"The object type, which is always
organization.invite"organization.invite"
-
projects: array of object { id, role }The projects that were granted membership upon acceptance of the invite.
-
id: stringProject's public ID
-
role: "member" or "owner"Project membership role
-
"member" -
"owner"
-
-
-
role: "owner" or "reader"ownerorreader-
"owner" -
"reader"
-
-
status: "accepted" or "expired" or "pending"accepted,expired, orpending-
"accepted" -
"expired" -
"pending"
-
-
accepted_at: optional numberThe Unix timestamp (in seconds) of when the invite was accepted.
-
expires_at: optional numberThe Unix timestamp (in seconds) of when the invite expires.
-
Invite Delete Response
-
InviteDeleteResponse object { id, deleted, object }-
id: string -
deleted: boolean -
object: "organization.invite.deleted"The object type, which is always
organization.invite.deleted"organization.invite.deleted"
-
Users
List users
get /organization/users
List users
Query Parameters
-
after: optional stringA cursor for use in pagination.
afteris an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. -
emails: optional array of stringFilter by the email address of users.
-
limit: optional numberA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
Returns
-
data: array of OrganizationUser-
id: stringThe identifier, which can be referenced in API endpoints
-
added_at: numberThe Unix timestamp (in seconds) of when the user was added.
-
object: "organization.user"The object type, which is always
organization.user"organization.user"
-
api_key_last_used_at: optional numberThe Unix timestamp (in seconds) of the user's last API key usage.
-
created: optional numberThe Unix timestamp (in seconds) of when the user was created.
-
developer_persona: optional stringThe developer persona metadata for the user.
-
email: optional stringThe email address of the user
-
is_default: optional booleanWhether this is the organization's default user.
-
is_scale_tier_authorized_purchaser: optional booleanWhether the user is an authorized purchaser for Scale Tier.
-
is_scim_managed: optional booleanWhether the user is managed through SCIM.
-
is_service_account: optional booleanWhether the user is a service account.
-
name: optional stringThe name of the user
-
projects: optional object { data, object }Projects associated with the user, if included.
-
data: array of object { id, name, role }-
id: optional string -
name: optional string -
role: optional string
-
-
object: "list""list"
-
-
role: optional stringownerorreader -
technical_level: optional stringThe technical level metadata for the user.
-
user: optional object { id, object, banned, 5 more }Nested user details.
-
id: string -
object: "user""user"
-
banned: optional boolean -
banned_at: optional number -
email: optional string -
enabled: optional boolean -
name: optional string -
picture: optional string
-
-
-
has_more: boolean -
object: "list""list"
-
first_id: optional string -
last_id: optional string
Example
curl https://api.openai.com/v1/organization/users \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"data": [
{
"id": "id",
"added_at": 0,
"object": "organization.user",
"api_key_last_used_at": 0,
"created": 0,
"developer_persona": "developer_persona",
"email": "email",
"is_default": true,
"is_scale_tier_authorized_purchaser": true,
"is_scim_managed": true,
"is_service_account": true,
"name": "name",
"projects": {
"data": [
{
"id": "id",
"name": "name",
"role": "role"
}
],
"object": "list"
},
"role": "role",
"technical_level": "technical_level",
"user": {
"id": "id",
"object": "user",
"banned": true,
"banned_at": 0,
"email": "email",
"enabled": true,
"name": "name",
"picture": "picture"
}
}
],
"has_more": true,
"object": "list",
"first_id": "first_id",
"last_id": "last_id"
}
Example
curl https://api.openai.com/v1/organization/users?after=user_abc&limit=20 \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "list",
"data": [
{
"object": "organization.user",
"id": "user_abc",
"name": "First Last",
"email": "user@example.com",
"role": "owner",
"added_at": 1711471533
}
],
"first_id": "user-abc",
"last_id": "user-xyz",
"has_more": false
}
Retrieve user
get /organization/users/{user_id}
Retrieve user
Path Parameters
user_id: string
Returns
-
OrganizationUser object { id, added_at, object, 13 more }Represents an individual
userwithin an organization.-
id: stringThe identifier, which can be referenced in API endpoints
-
added_at: numberThe Unix timestamp (in seconds) of when the user was added.
-
object: "organization.user"The object type, which is always
organization.user"organization.user"
-
api_key_last_used_at: optional numberThe Unix timestamp (in seconds) of the user's last API key usage.
-
created: optional numberThe Unix timestamp (in seconds) of when the user was created.
-
developer_persona: optional stringThe developer persona metadata for the user.
-
email: optional stringThe email address of the user
-
is_default: optional booleanWhether this is the organization's default user.
-
is_scale_tier_authorized_purchaser: optional booleanWhether the user is an authorized purchaser for Scale Tier.
-
is_scim_managed: optional booleanWhether the user is managed through SCIM.
-
is_service_account: optional booleanWhether the user is a service account.
-
name: optional stringThe name of the user
-
projects: optional object { data, object }Projects associated with the user, if included.
-
data: array of object { id, name, role }-
id: optional string -
name: optional string -
role: optional string
-
-
object: "list""list"
-
-
role: optional stringownerorreader -
technical_level: optional stringThe technical level metadata for the user.
-
user: optional object { id, object, banned, 5 more }Nested user details.
-
id: string -
object: "user""user"
-
banned: optional boolean -
banned_at: optional number -
email: optional string -
enabled: optional boolean -
name: optional string -
picture: optional string
-
-
Example
curl https://api.openai.com/v1/organization/users/$USER_ID \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"id": "id",
"added_at": 0,
"object": "organization.user",
"api_key_last_used_at": 0,
"created": 0,
"developer_persona": "developer_persona",
"email": "email",
"is_default": true,
"is_scale_tier_authorized_purchaser": true,
"is_scim_managed": true,
"is_service_account": true,
"name": "name",
"projects": {
"data": [
{
"id": "id",
"name": "name",
"role": "role"
}
],
"object": "list"
},
"role": "role",
"technical_level": "technical_level",
"user": {
"id": "id",
"object": "user",
"banned": true,
"banned_at": 0,
"email": "email",
"enabled": true,
"name": "name",
"picture": "picture"
}
}
Example
curl https://api.openai.com/v1/organization/users/user_abc \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "organization.user",
"id": "user_abc",
"name": "First Last",
"email": "user@example.com",
"role": "owner",
"added_at": 1711471533
}
Modify user
post /organization/users/{user_id}
Modify user
Path Parameters
user_id: string
Body Parameters
-
developer_persona: optional stringDeveloper persona metadata.
-
role: optional stringownerorreader -
role_id: optional stringRole ID to assign to the user.
-
technical_level: optional stringTechnical level metadata.
Returns
-
OrganizationUser object { id, added_at, object, 13 more }Represents an individual
userwithin an organization.-
id: stringThe identifier, which can be referenced in API endpoints
-
added_at: numberThe Unix timestamp (in seconds) of when the user was added.
-
object: "organization.user"The object type, which is always
organization.user"organization.user"
-
api_key_last_used_at: optional numberThe Unix timestamp (in seconds) of the user's last API key usage.
-
created: optional numberThe Unix timestamp (in seconds) of when the user was created.
-
developer_persona: optional stringThe developer persona metadata for the user.
-
email: optional stringThe email address of the user
-
is_default: optional booleanWhether this is the organization's default user.
-
is_scale_tier_authorized_purchaser: optional booleanWhether the user is an authorized purchaser for Scale Tier.
-
is_scim_managed: optional booleanWhether the user is managed through SCIM.
-
is_service_account: optional booleanWhether the user is a service account.
-
name: optional stringThe name of the user
-
projects: optional object { data, object }Projects associated with the user, if included.
-
data: array of object { id, name, role }-
id: optional string -
name: optional string -
role: optional string
-
-
object: "list""list"
-
-
role: optional stringownerorreader -
technical_level: optional stringThe technical level metadata for the user.
-
user: optional object { id, object, banned, 5 more }Nested user details.
-
id: string -
object: "user""user"
-
banned: optional boolean -
banned_at: optional number -
email: optional string -
enabled: optional boolean -
name: optional string -
picture: optional string
-
-
Example
curl https://api.openai.com/v1/organization/users/$USER_ID \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-d '{}'
Response
{
"id": "id",
"added_at": 0,
"object": "organization.user",
"api_key_last_used_at": 0,
"created": 0,
"developer_persona": "developer_persona",
"email": "email",
"is_default": true,
"is_scale_tier_authorized_purchaser": true,
"is_scim_managed": true,
"is_service_account": true,
"name": "name",
"projects": {
"data": [
{
"id": "id",
"name": "name",
"role": "role"
}
],
"object": "list"
},
"role": "role",
"technical_level": "technical_level",
"user": {
"id": "id",
"object": "user",
"banned": true,
"banned_at": 0,
"email": "email",
"enabled": true,
"name": "name",
"picture": "picture"
}
}
Example
curl -X POST https://api.openai.com/v1/organization/users/user_abc \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"role": "owner"
}'
Response
{
"object": "organization.user",
"id": "user_abc",
"name": "First Last",
"email": "user@example.com",
"role": "owner",
"added_at": 1711471533
}
Delete user
delete /organization/users/{user_id}
Delete user
Path Parameters
user_id: string
Returns
-
id: string -
deleted: boolean -
object: "organization.user.deleted""organization.user.deleted"
Example
curl https://api.openai.com/v1/organization/users/$USER_ID \
-X DELETE \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"id": "id",
"deleted": true,
"object": "organization.user.deleted"
}
Example
curl -X DELETE https://api.openai.com/v1/organization/users/user_abc \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "organization.user.deleted",
"id": "user_abc",
"deleted": true
}
Domain Types
Organization User
-
OrganizationUser object { id, added_at, object, 13 more }Represents an individual
userwithin an organization.-
id: stringThe identifier, which can be referenced in API endpoints
-
added_at: numberThe Unix timestamp (in seconds) of when the user was added.
-
object: "organization.user"The object type, which is always
organization.user"organization.user"
-
api_key_last_used_at: optional numberThe Unix timestamp (in seconds) of the user's last API key usage.
-
created: optional numberThe Unix timestamp (in seconds) of when the user was created.
-
developer_persona: optional stringThe developer persona metadata for the user.
-
email: optional stringThe email address of the user
-
is_default: optional booleanWhether this is the organization's default user.
-
is_scale_tier_authorized_purchaser: optional booleanWhether the user is an authorized purchaser for Scale Tier.
-
is_scim_managed: optional booleanWhether the user is managed through SCIM.
-
is_service_account: optional booleanWhether the user is a service account.
-
name: optional stringThe name of the user
-
projects: optional object { data, object }Projects associated with the user, if included.
-
data: array of object { id, name, role }-
id: optional string -
name: optional string -
role: optional string
-
-
object: "list""list"
-
-
role: optional stringownerorreader -
technical_level: optional stringThe technical level metadata for the user.
-
user: optional object { id, object, banned, 5 more }Nested user details.
-
id: string -
object: "user""user"
-
banned: optional boolean -
banned_at: optional number -
email: optional string -
enabled: optional boolean -
name: optional string -
picture: optional string
-
-
User Delete Response
-
UserDeleteResponse object { id, deleted, object }-
id: string -
deleted: boolean -
object: "organization.user.deleted""organization.user.deleted"
-
Roles
List user organization role assignments
get /organization/users/{user_id}/roles
List user organization role assignments
Path Parameters
user_id: string
Query Parameters
-
after: optional stringCursor for pagination. Provide the value from the previous response's
nextfield to continue listing organization roles. -
limit: optional numberA limit on the number of organization role assignments to return.
-
order: optional "asc" or "desc"Sort order for the returned organization roles.
-
"asc" -
"desc"
-
Returns
-
data: array of object { id, assignment_sources, created_at, 9 more }Role assignments returned in the current page.
-
id: stringIdentifier for the role.
-
assignment_sources: array of object { principal_id, principal_type }Principals from which the role assignment is inherited, when available.
-
principal_id: string -
principal_type: string
-
-
created_at: numberWhen the role was created.
-
created_by: stringIdentifier of the actor who created the role.
-
created_by_user_obj: map[unknown]User details for the actor that created the role, when available.
-
description: stringDescription of the role.
-
metadata: map[unknown]Arbitrary metadata stored on the role.
-
name: stringName of the role.
-
permissions: array of stringPermissions associated with the role.
-
predefined_role: booleanWhether the role is predefined by OpenAI.
-
resource_type: stringResource type the role applies to.
-
updated_at: numberWhen the role was last updated.
-
-
has_more: booleanWhether additional assignments are available when paginating.
-
next: stringCursor to fetch the next page of results, or
nullwhen there are no more assignments. -
object: "list"Always
list."list"
Example
curl https://api.openai.com/v1/organization/users/$USER_ID/roles \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"data": [
{
"id": "id",
"assignment_sources": [
{
"principal_id": "principal_id",
"principal_type": "principal_type"
}
],
"created_at": 0,
"created_by": "created_by",
"created_by_user_obj": {
"foo": "bar"
},
"description": "description",
"metadata": {
"foo": "bar"
},
"name": "name",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type",
"updated_at": 0
}
],
"has_more": true,
"next": "next",
"object": "list"
}
Example
curl https://api.openai.com/v1/organization/users/user_abc123/roles \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "list",
"data": [
{
"id": "role_01J1F8ROLE01",
"name": "API Group Manager",
"permissions": [
"api.groups.read",
"api.groups.write"
],
"resource_type": "api.organization",
"predefined_role": false,
"description": "Allows managing organization groups",
"created_at": 1711471533,
"updated_at": 1711472599,
"created_by": "user_abc123",
"created_by_user_obj": {
"id": "user_abc123",
"name": "Ada Lovelace",
"email": "ada@example.com"
},
"metadata": {}
}
],
"has_more": false,
"next": null
}
Assign organization role to user
post /organization/users/{user_id}/roles
Assign organization role to user
Path Parameters
user_id: string
Body Parameters
-
role_id: stringIdentifier of the role to assign.
Returns
-
object: "user.role"Always
user.role."user.role"
-
role: RoleDetails about a role that can be assigned through the public Roles API.
-
id: stringIdentifier for the role.
-
description: stringOptional description of the role.
-
name: stringUnique name for the role.
-
object: "role"Always
role."role"
-
permissions: array of stringPermissions granted by the role.
-
predefined_role: booleanWhether the role is predefined and managed by OpenAI.
-
resource_type: stringResource type the role is bound to (for example
api.organizationorapi.project).
-
-
user: OrganizationUserRepresents an individual
userwithin an organization.-
id: stringThe identifier, which can be referenced in API endpoints
-
added_at: numberThe Unix timestamp (in seconds) of when the user was added.
-
object: "organization.user"The object type, which is always
organization.user"organization.user"
-
api_key_last_used_at: optional numberThe Unix timestamp (in seconds) of the user's last API key usage.
-
created: optional numberThe Unix timestamp (in seconds) of when the user was created.
-
developer_persona: optional stringThe developer persona metadata for the user.
-
email: optional stringThe email address of the user
-
is_default: optional booleanWhether this is the organization's default user.
-
is_scale_tier_authorized_purchaser: optional booleanWhether the user is an authorized purchaser for Scale Tier.
-
is_scim_managed: optional booleanWhether the user is managed through SCIM.
-
is_service_account: optional booleanWhether the user is a service account.
-
name: optional stringThe name of the user
-
projects: optional object { data, object }Projects associated with the user, if included.
-
data: array of object { id, name, role }-
id: optional string -
name: optional string -
role: optional string
-
-
object: "list""list"
-
-
role: optional stringownerorreader -
technical_level: optional stringThe technical level metadata for the user.
-
user: optional object { id, object, banned, 5 more }Nested user details.
-
id: string -
object: "user""user"
-
banned: optional boolean -
banned_at: optional number -
email: optional string -
enabled: optional boolean -
name: optional string -
picture: optional string
-
-
Example
curl https://api.openai.com/v1/organization/users/$USER_ID/roles \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-d '{
"role_id": "role_id"
}'
Response
{
"object": "user.role",
"role": {
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
},
"user": {
"id": "id",
"added_at": 0,
"object": "organization.user",
"api_key_last_used_at": 0,
"created": 0,
"developer_persona": "developer_persona",
"email": "email",
"is_default": true,
"is_scale_tier_authorized_purchaser": true,
"is_scim_managed": true,
"is_service_account": true,
"name": "name",
"projects": {
"data": [
{
"id": "id",
"name": "name",
"role": "role"
}
],
"object": "list"
},
"role": "role",
"technical_level": "technical_level",
"user": {
"id": "id",
"object": "user",
"banned": true,
"banned_at": 0,
"email": "email",
"enabled": true,
"name": "name",
"picture": "picture"
}
}
}
Example
curl -X POST https://api.openai.com/v1/organization/users/user_abc123/roles \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"role_id": "role_01J1F8ROLE01"
}'
Response
{
"object": "user.role",
"user": {
"object": "organization.user",
"id": "user_abc123",
"name": "Ada Lovelace",
"email": "ada@example.com",
"role": "owner",
"added_at": 1711470000
},
"role": {
"object": "role",
"id": "role_01J1F8ROLE01",
"name": "API Group Manager",
"description": "Allows managing organization groups",
"permissions": [
"api.groups.read",
"api.groups.write"
],
"resource_type": "api.organization",
"predefined_role": false
}
}
Retrieve user organization role
get /organization/users/{user_id}/roles/{role_id}
Retrieve user organization role
Path Parameters
-
user_id: string -
role_id: string
Returns
-
id: stringIdentifier for the role.
-
assignment_sources: array of object { principal_id, principal_type }Principals from which the role assignment is inherited, when available.
-
principal_id: string -
principal_type: string
-
-
created_at: numberWhen the role was created.
-
created_by: stringIdentifier of the actor who created the role.
-
created_by_user_obj: map[unknown]User details for the actor that created the role, when available.
-
description: stringDescription of the role.
-
metadata: map[unknown]Arbitrary metadata stored on the role.
-
name: stringName of the role.
-
permissions: array of stringPermissions associated with the role.
-
predefined_role: booleanWhether the role is predefined by OpenAI.
-
resource_type: stringResource type the role applies to.
-
updated_at: numberWhen the role was last updated.
Example
curl https://api.openai.com/v1/organization/users/$USER_ID/roles/$ROLE_ID \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"id": "id",
"assignment_sources": [
{
"principal_id": "principal_id",
"principal_type": "principal_type"
}
],
"created_at": 0,
"created_by": "created_by",
"created_by_user_obj": {
"foo": "bar"
},
"description": "description",
"metadata": {
"foo": "bar"
},
"name": "name",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type",
"updated_at": 0
}
Example
curl https://api.openai.com/v1/organization/users/user_abc123/roles/role_01J1F8ROLE01 \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"id": "role_01J1F8ROLE01",
"name": "API Group Manager",
"permissions": [
"api.groups.read",
"api.groups.write"
],
"resource_type": "api.organization",
"predefined_role": false,
"description": "Allows managing organization groups",
"created_at": 1711471533,
"updated_at": 1711472599,
"created_by": "user_abc123",
"created_by_user_obj": null,
"metadata": {},
"assignment_sources": null
}
Unassign organization role from user
delete /organization/users/{user_id}/roles/{role_id}
Unassign organization role from user
Path Parameters
-
user_id: string -
role_id: string
Returns
-
deleted: booleanWhether the assignment was removed.
-
object: stringIdentifier for the deleted assignment, such as
group.role.deletedoruser.role.deleted.
Example
curl https://api.openai.com/v1/organization/users/$USER_ID/roles/$ROLE_ID \
-X DELETE \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"deleted": true,
"object": "object"
}
Example
curl -X DELETE https://api.openai.com/v1/organization/users/user_abc123/roles/role_01J1F8ROLE01 \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "user.role.deleted",
"deleted": true
}
Domain Types
Role List Response
-
RoleListResponse object { id, assignment_sources, created_at, 9 more }Detailed information about a role assignment entry returned when listing assignments.
-
id: stringIdentifier for the role.
-
assignment_sources: array of object { principal_id, principal_type }Principals from which the role assignment is inherited, when available.
-
principal_id: string -
principal_type: string
-
-
created_at: numberWhen the role was created.
-
created_by: stringIdentifier of the actor who created the role.
-
created_by_user_obj: map[unknown]User details for the actor that created the role, when available.
-
description: stringDescription of the role.
-
metadata: map[unknown]Arbitrary metadata stored on the role.
-
name: stringName of the role.
-
permissions: array of stringPermissions associated with the role.
-
predefined_role: booleanWhether the role is predefined by OpenAI.
-
resource_type: stringResource type the role applies to.
-
updated_at: numberWhen the role was last updated.
-
Role Create Response
-
RoleCreateResponse object { object, role, user }Role assignment linking a user to a role.
-
object: "user.role"Always
user.role."user.role"
-
role: RoleDetails about a role that can be assigned through the public Roles API.
-
id: stringIdentifier for the role.
-
description: stringOptional description of the role.
-
name: stringUnique name for the role.
-
object: "role"Always
role."role"
-
permissions: array of stringPermissions granted by the role.
-
predefined_role: booleanWhether the role is predefined and managed by OpenAI.
-
resource_type: stringResource type the role is bound to (for example
api.organizationorapi.project).
-
-
user: OrganizationUserRepresents an individual
userwithin an organization.-
id: stringThe identifier, which can be referenced in API endpoints
-
added_at: numberThe Unix timestamp (in seconds) of when the user was added.
-
object: "organization.user"The object type, which is always
organization.user"organization.user"
-
api_key_last_used_at: optional numberThe Unix timestamp (in seconds) of the user's last API key usage.
-
created: optional numberThe Unix timestamp (in seconds) of when the user was created.
-
developer_persona: optional stringThe developer persona metadata for the user.
-
email: optional stringThe email address of the user
-
is_default: optional booleanWhether this is the organization's default user.
-
is_scale_tier_authorized_purchaser: optional booleanWhether the user is an authorized purchaser for Scale Tier.
-
is_scim_managed: optional booleanWhether the user is managed through SCIM.
-
is_service_account: optional booleanWhether the user is a service account.
-
name: optional stringThe name of the user
-
projects: optional object { data, object }Projects associated with the user, if included.
-
data: array of object { id, name, role }-
id: optional string -
name: optional string -
role: optional string
-
-
object: "list""list"
-
-
role: optional stringownerorreader -
technical_level: optional stringThe technical level metadata for the user.
-
user: optional object { id, object, banned, 5 more }Nested user details.
-
id: string -
object: "user""user"
-
banned: optional boolean -
banned_at: optional number -
email: optional string -
enabled: optional boolean -
name: optional string -
picture: optional string
-
-
-
Role Retrieve Response
-
RoleRetrieveResponse object { id, assignment_sources, created_at, 9 more }Detailed information about a role assignment entry returned when listing assignments.
-
id: stringIdentifier for the role.
-
assignment_sources: array of object { principal_id, principal_type }Principals from which the role assignment is inherited, when available.
-
principal_id: string -
principal_type: string
-
-
created_at: numberWhen the role was created.
-
created_by: stringIdentifier of the actor who created the role.
-
created_by_user_obj: map[unknown]User details for the actor that created the role, when available.
-
description: stringDescription of the role.
-
metadata: map[unknown]Arbitrary metadata stored on the role.
-
name: stringName of the role.
-
permissions: array of stringPermissions associated with the role.
-
predefined_role: booleanWhether the role is predefined by OpenAI.
-
resource_type: stringResource type the role applies to.
-
updated_at: numberWhen the role was last updated.
-
Role Delete Response
-
RoleDeleteResponse object { deleted, object }Confirmation payload returned after unassigning a role.
-
deleted: booleanWhether the assignment was removed.
-
object: stringIdentifier for the deleted assignment, such as
group.role.deletedoruser.role.deleted.
-
Groups
List groups
get /organization/groups
List groups
Query Parameters
-
after: optional stringA cursor for use in pagination.
afteris a group ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with group_abc, your subsequent call can includeafter=group_abcin order to fetch the next page of the list. -
limit: optional numberA limit on the number of groups to be returned. Limit can range between 0 and 1000, and the default is 100.
-
order: optional "asc" or "desc"Specifies the sort order of the returned groups.
-
"asc" -
"desc"
-
Returns
-
data: array of GroupGroups returned in the current page.
-
id: stringIdentifier for the group.
-
created_at: numberUnix timestamp (in seconds) when the group was created.
-
group_type: "group" or "tenant_group"The type of the group.
-
"group" -
"tenant_group"
-
-
is_scim_managed: booleanWhether the group is managed through SCIM and controlled by your identity provider.
-
name: stringDisplay name of the group.
-
-
has_more: booleanWhether additional groups are available when paginating.
-
next: stringCursor to fetch the next page of results, or
nullif there are no more results. -
object: "list"Always
list."list"
Example
curl https://api.openai.com/v1/organization/groups \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"data": [
{
"id": "id",
"created_at": 0,
"group_type": "group",
"is_scim_managed": true,
"name": "name"
}
],
"has_more": true,
"next": "next",
"object": "list"
}
Example
curl https://api.openai.com/v1/organization/groups?limit=20&order=asc \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "list",
"data": [
{
"object": "group",
"id": "group_01J1F8ABCDXYZ",
"name": "Support Team",
"created_at": 1711471533,
"is_scim_managed": false
}
],
"has_more": false,
"next": null
}
Create group
post /organization/groups
Create group
Body Parameters
-
name: stringHuman readable name for the group.
Returns
-
Group object { id, created_at, group_type, 2 more }Details about an organization group.
-
id: stringIdentifier for the group.
-
created_at: numberUnix timestamp (in seconds) when the group was created.
-
group_type: "group" or "tenant_group"The type of the group.
-
"group" -
"tenant_group"
-
-
is_scim_managed: booleanWhether the group is managed through SCIM and controlled by your identity provider.
-
name: stringDisplay name of the group.
-
Example
curl https://api.openai.com/v1/organization/groups \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-d '{
"name": "x"
}'
Response
{
"id": "id",
"created_at": 0,
"group_type": "group",
"is_scim_managed": true,
"name": "name"
}
Example
curl -X POST https://api.openai.com/v1/organization/groups \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Support Team"
}'
Response
{
"object": "group",
"id": "group_01J1F8ABCDXYZ",
"name": "Support Team",
"created_at": 1711471533,
"is_scim_managed": false
}
Retrieve group
get /organization/groups/{group_id}
Retrieve group
Path Parameters
group_id: string
Returns
-
Group object { id, created_at, group_type, 2 more }Details about an organization group.
-
id: stringIdentifier for the group.
-
created_at: numberUnix timestamp (in seconds) when the group was created.
-
group_type: "group" or "tenant_group"The type of the group.
-
"group" -
"tenant_group"
-
-
is_scim_managed: booleanWhether the group is managed through SCIM and controlled by your identity provider.
-
name: stringDisplay name of the group.
-
Example
curl https://api.openai.com/v1/organization/groups/$GROUP_ID \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"id": "id",
"created_at": 0,
"group_type": "group",
"is_scim_managed": true,
"name": "name"
}
Example
curl https://api.openai.com/v1/organization/groups/group_01J1F8ABCDXYZ \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"id": "group_01J1F8ABCDXYZ",
"name": "Support Team",
"created_at": 1711471533,
"is_scim_managed": false,
"group_type": "group"
}
Update group
post /organization/groups/{group_id}
Update group
Path Parameters
group_id: string
Body Parameters
-
name: stringNew display name for the group.
Returns
-
id: stringIdentifier for the group.
-
created_at: numberUnix timestamp (in seconds) when the group was created.
-
is_scim_managed: booleanWhether the group is managed through SCIM and controlled by your identity provider.
-
name: stringUpdated display name for the group.
Example
curl https://api.openai.com/v1/organization/groups/$GROUP_ID \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-d '{
"name": "x"
}'
Response
{
"id": "id",
"created_at": 0,
"is_scim_managed": true,
"name": "name"
}
Example
curl -X POST https://api.openai.com/v1/organization/groups/group_01J1F8ABCDXYZ \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Escalations"
}'
Response
{
"id": "group_01J1F8ABCDXYZ",
"name": "Escalations",
"created_at": 1711471533,
"is_scim_managed": false
}
Delete group
delete /organization/groups/{group_id}
Delete group
Path Parameters
group_id: string
Returns
-
id: stringIdentifier of the deleted group.
-
deleted: booleanWhether the group was deleted.
-
object: "group.deleted"Always
group.deleted."group.deleted"
Example
curl https://api.openai.com/v1/organization/groups/$GROUP_ID \
-X DELETE \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"id": "id",
"deleted": true,
"object": "group.deleted"
}
Example
curl -X DELETE https://api.openai.com/v1/organization/groups/group_01J1F8ABCDXYZ \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "group.deleted",
"id": "group_01J1F8ABCDXYZ",
"deleted": true
}
Domain Types
Group
-
Group object { id, created_at, group_type, 2 more }Details about an organization group.
-
id: stringIdentifier for the group.
-
created_at: numberUnix timestamp (in seconds) when the group was created.
-
group_type: "group" or "tenant_group"The type of the group.
-
"group" -
"tenant_group"
-
-
is_scim_managed: booleanWhether the group is managed through SCIM and controlled by your identity provider.
-
name: stringDisplay name of the group.
-
Group Update Response
-
GroupUpdateResponse object { id, created_at, is_scim_managed, name }Response returned after updating a group.
-
id: stringIdentifier for the group.
-
created_at: numberUnix timestamp (in seconds) when the group was created.
-
is_scim_managed: booleanWhether the group is managed through SCIM and controlled by your identity provider.
-
name: stringUpdated display name for the group.
-
Group Delete Response
-
GroupDeleteResponse object { id, deleted, object }Confirmation payload returned after deleting a group.
-
id: stringIdentifier of the deleted group.
-
deleted: booleanWhether the group was deleted.
-
object: "group.deleted"Always
group.deleted."group.deleted"
-
Users
List group users
get /organization/groups/{group_id}/users
List group users
Path Parameters
group_id: string
Query Parameters
-
after: optional stringA cursor for use in pagination. Provide the ID of the last user from the previous list response to retrieve the next page.
-
limit: optional numberA limit on the number of users to be returned. Limit can range between 0 and 1000, and the default is 100.
-
order: optional "asc" or "desc"Specifies the sort order of users in the list.
-
"asc" -
"desc"
-
Returns
-
data: array of OrganizationGroupUserUsers in the current page.
-
id: stringThe identifier, which can be referenced in API endpoints
-
email: stringThe email address of the user.
-
name: stringThe name of the user.
-
-
has_more: booleanWhether more users are available when paginating.
-
next: stringCursor to fetch the next page of results, or
nullwhen no further users are available. -
object: "list"Always
list."list"
Example
curl https://api.openai.com/v1/organization/groups/$GROUP_ID/users \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"data": [
{
"id": "id",
"email": "email",
"name": "name"
}
],
"has_more": true,
"next": "next",
"object": "list"
}
Example
curl https://api.openai.com/v1/organization/groups/group_01J1F8ABCDXYZ/users?limit=20 \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "list",
"data": [
{
"id": "user_abc123",
"name": "Ada Lovelace",
"email": "ada@example.com"
}
],
"has_more": false,
"next": null
}
Add group user
post /organization/groups/{group_id}/users
Add group user
Path Parameters
group_id: string
Body Parameters
-
user_id: stringIdentifier of the user to add to the group.
Returns
-
group_id: stringIdentifier of the group the user was added to.
-
object: "group.user"Always
group.user."group.user"
-
user_id: stringIdentifier of the user that was added.
Example
curl https://api.openai.com/v1/organization/groups/$GROUP_ID/users \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-d '{
"user_id": "user_id"
}'
Response
{
"group_id": "group_id",
"object": "group.user",
"user_id": "user_id"
}
Example
curl -X POST https://api.openai.com/v1/organization/groups/group_01J1F8ABCDXYZ/users \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"user_id": "user_abc123"
}'
Response
{
"object": "group.user",
"user_id": "user_abc123",
"group_id": "group_01J1F8ABCDXYZ"
}
Retrieve group user
get /organization/groups/{group_id}/users/{user_id}
Retrieve group user
Path Parameters
-
group_id: string -
user_id: string
Returns
-
id: stringIdentifier for the user.
-
email: stringEmail address of the user, or
nullfor users without an email. -
is_service_account: booleanWhether the user is a service account.
-
name: stringDisplay name of the user.
-
picture: stringURL of the user's profile picture, if available.
-
user_type: "user" or "tenant_user"The type of user.
-
"user" -
"tenant_user"
-
Example
curl https://api.openai.com/v1/organization/groups/$GROUP_ID/users/$USER_ID \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"id": "id",
"email": "email",
"is_service_account": true,
"name": "name",
"picture": "picture",
"user_type": "user"
}
Example
curl https://api.openai.com/v1/organization/groups/group_01J1F8ABCDXYZ/users/user_abc123 \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"id": "user_abc123",
"name": "Ada Lovelace",
"email": "ada@example.com",
"picture": null,
"is_service_account": false,
"user_type": "user"
}
Remove group user
delete /organization/groups/{group_id}/users/{user_id}
Remove group user
Path Parameters
-
group_id: string -
user_id: string
Returns
-
deleted: booleanWhether the group membership was removed.
-
object: "group.user.deleted"Always
group.user.deleted."group.user.deleted"
Example
curl https://api.openai.com/v1/organization/groups/$GROUP_ID/users/$USER_ID \
-X DELETE \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"deleted": true,
"object": "group.user.deleted"
}
Example
curl -X DELETE https://api.openai.com/v1/organization/groups/group_01J1F8ABCDXYZ/users/user_abc123 \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "group.user.deleted",
"deleted": true
}
Domain Types
Organization Group User
-
OrganizationGroupUser object { id, email, name }Represents an individual user returned when inspecting group membership.
-
id: stringThe identifier, which can be referenced in API endpoints
-
email: stringThe email address of the user.
-
name: stringThe name of the user.
-
User Create Response
-
UserCreateResponse object { group_id, object, user_id }Confirmation payload returned after adding a user to a group.
-
group_id: stringIdentifier of the group the user was added to.
-
object: "group.user"Always
group.user."group.user"
-
user_id: stringIdentifier of the user that was added.
-
User Retrieve Response
-
UserRetrieveResponse object { id, email, is_service_account, 3 more }Details about a user returned from an organization group membership lookup.
-
id: stringIdentifier for the user.
-
email: stringEmail address of the user, or
nullfor users without an email. -
is_service_account: booleanWhether the user is a service account.
-
name: stringDisplay name of the user.
-
picture: stringURL of the user's profile picture, if available.
-
user_type: "user" or "tenant_user"The type of user.
-
"user" -
"tenant_user"
-
-
User Delete Response
-
UserDeleteResponse object { deleted, object }Confirmation payload returned after removing a user from a group.
-
deleted: booleanWhether the group membership was removed.
-
object: "group.user.deleted"Always
group.user.deleted."group.user.deleted"
-
Roles
List group organization role assignments
get /organization/groups/{group_id}/roles
List group organization role assignments
Path Parameters
group_id: string
Query Parameters
-
after: optional stringCursor for pagination. Provide the value from the previous response's
nextfield to continue listing organization roles. -
limit: optional numberA limit on the number of organization role assignments to return.
-
order: optional "asc" or "desc"Sort order for the returned organization roles.
-
"asc" -
"desc"
-
Returns
-
data: array of object { id, assignment_sources, created_at, 9 more }Role assignments returned in the current page.
-
id: stringIdentifier for the role.
-
assignment_sources: array of object { principal_id, principal_type }Principals from which the role assignment is inherited, when available.
-
principal_id: string -
principal_type: string
-
-
created_at: numberWhen the role was created.
-
created_by: stringIdentifier of the actor who created the role.
-
created_by_user_obj: map[unknown]User details for the actor that created the role, when available.
-
description: stringDescription of the role.
-
metadata: map[unknown]Arbitrary metadata stored on the role.
-
name: stringName of the role.
-
permissions: array of stringPermissions associated with the role.
-
predefined_role: booleanWhether the role is predefined by OpenAI.
-
resource_type: stringResource type the role applies to.
-
updated_at: numberWhen the role was last updated.
-
-
has_more: booleanWhether additional assignments are available when paginating.
-
next: stringCursor to fetch the next page of results, or
nullwhen there are no more assignments. -
object: "list"Always
list."list"
Example
curl https://api.openai.com/v1/organization/groups/$GROUP_ID/roles \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"data": [
{
"id": "id",
"assignment_sources": [
{
"principal_id": "principal_id",
"principal_type": "principal_type"
}
],
"created_at": 0,
"created_by": "created_by",
"created_by_user_obj": {
"foo": "bar"
},
"description": "description",
"metadata": {
"foo": "bar"
},
"name": "name",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type",
"updated_at": 0
}
],
"has_more": true,
"next": "next",
"object": "list"
}
Example
curl https://api.openai.com/v1/organization/groups/group_01J1F8ABCDXYZ/roles \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "list",
"data": [
{
"id": "role_01J1F8ROLE01",
"name": "API Group Manager",
"permissions": [
"api.groups.read",
"api.groups.write"
],
"resource_type": "api.organization",
"predefined_role": false,
"description": "Allows managing organization groups",
"created_at": 1711471533,
"updated_at": 1711472599,
"created_by": "user_abc123",
"created_by_user_obj": {
"id": "user_abc123",
"name": "Ada Lovelace",
"email": "ada@example.com"
},
"metadata": {}
}
],
"has_more": false,
"next": null
}
Assign organization role to group
post /organization/groups/{group_id}/roles
Assign organization role to group
Path Parameters
group_id: string
Body Parameters
-
role_id: stringIdentifier of the role to assign.
Returns
-
group: object { id, created_at, name, 2 more }Summary information about a group returned in role assignment responses.
-
id: stringIdentifier for the group.
-
created_at: numberUnix timestamp (in seconds) when the group was created.
-
name: stringDisplay name of the group.
-
object: "group"Always
group."group"
-
scim_managed: booleanWhether the group is managed through SCIM.
-
-
object: "group.role"Always
group.role."group.role"
-
role: RoleDetails about a role that can be assigned through the public Roles API.
-
id: stringIdentifier for the role.
-
description: stringOptional description of the role.
-
name: stringUnique name for the role.
-
object: "role"Always
role."role"
-
permissions: array of stringPermissions granted by the role.
-
predefined_role: booleanWhether the role is predefined and managed by OpenAI.
-
resource_type: stringResource type the role is bound to (for example
api.organizationorapi.project).
-
Example
curl https://api.openai.com/v1/organization/groups/$GROUP_ID/roles \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-d '{
"role_id": "role_id"
}'
Response
{
"group": {
"id": "id",
"created_at": 0,
"name": "name",
"object": "group",
"scim_managed": true
},
"object": "group.role",
"role": {
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
}
}
Example
curl -X POST https://api.openai.com/v1/organization/groups/group_01J1F8ABCDXYZ/roles \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"role_id": "role_01J1F8ROLE01"
}'
Response
{
"object": "group.role",
"group": {
"object": "group",
"id": "group_01J1F8ABCDXYZ",
"name": "Support Team",
"created_at": 1711471533,
"scim_managed": false
},
"role": {
"object": "role",
"id": "role_01J1F8ROLE01",
"name": "API Group Manager",
"description": "Allows managing organization groups",
"permissions": [
"api.groups.read",
"api.groups.write"
],
"resource_type": "api.organization",
"predefined_role": false
}
}
Retrieve group organization role
get /organization/groups/{group_id}/roles/{role_id}
Retrieve group organization role
Path Parameters
-
group_id: string -
role_id: string
Returns
-
id: stringIdentifier for the role.
-
assignment_sources: array of object { principal_id, principal_type }Principals from which the role assignment is inherited, when available.
-
principal_id: string -
principal_type: string
-
-
created_at: numberWhen the role was created.
-
created_by: stringIdentifier of the actor who created the role.
-
created_by_user_obj: map[unknown]User details for the actor that created the role, when available.
-
description: stringDescription of the role.
-
metadata: map[unknown]Arbitrary metadata stored on the role.
-
name: stringName of the role.
-
permissions: array of stringPermissions associated with the role.
-
predefined_role: booleanWhether the role is predefined by OpenAI.
-
resource_type: stringResource type the role applies to.
-
updated_at: numberWhen the role was last updated.
Example
curl https://api.openai.com/v1/organization/groups/$GROUP_ID/roles/$ROLE_ID \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"id": "id",
"assignment_sources": [
{
"principal_id": "principal_id",
"principal_type": "principal_type"
}
],
"created_at": 0,
"created_by": "created_by",
"created_by_user_obj": {
"foo": "bar"
},
"description": "description",
"metadata": {
"foo": "bar"
},
"name": "name",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type",
"updated_at": 0
}
Example
curl https://api.openai.com/v1/organization/groups/group_01J1F8ABCDXYZ/roles/role_01J1F8ROLE01 \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"id": "role_01J1F8ROLE01",
"name": "API Group Manager",
"permissions": [
"api.groups.read",
"api.groups.write"
],
"resource_type": "api.organization",
"predefined_role": false,
"description": "Allows managing organization groups",
"created_at": 1711471533,
"updated_at": 1711472599,
"created_by": "user_abc123",
"created_by_user_obj": null,
"metadata": {},
"assignment_sources": null
}
Unassign organization role from group
delete /organization/groups/{group_id}/roles/{role_id}
Unassign organization role from group
Path Parameters
-
group_id: string -
role_id: string
Returns
-
deleted: booleanWhether the assignment was removed.
-
object: stringIdentifier for the deleted assignment, such as
group.role.deletedoruser.role.deleted.
Example
curl https://api.openai.com/v1/organization/groups/$GROUP_ID/roles/$ROLE_ID \
-X DELETE \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"deleted": true,
"object": "object"
}
Example
curl -X DELETE https://api.openai.com/v1/organization/groups/group_01J1F8ABCDXYZ/roles/role_01J1F8ROLE01 \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "group.role.deleted",
"deleted": true
}
Domain Types
Role List Response
-
RoleListResponse object { id, assignment_sources, created_at, 9 more }Detailed information about a role assignment entry returned when listing assignments.
-
id: stringIdentifier for the role.
-
assignment_sources: array of object { principal_id, principal_type }Principals from which the role assignment is inherited, when available.
-
principal_id: string -
principal_type: string
-
-
created_at: numberWhen the role was created.
-
created_by: stringIdentifier of the actor who created the role.
-
created_by_user_obj: map[unknown]User details for the actor that created the role, when available.
-
description: stringDescription of the role.
-
metadata: map[unknown]Arbitrary metadata stored on the role.
-
name: stringName of the role.
-
permissions: array of stringPermissions associated with the role.
-
predefined_role: booleanWhether the role is predefined by OpenAI.
-
resource_type: stringResource type the role applies to.
-
updated_at: numberWhen the role was last updated.
-
Role Create Response
-
RoleCreateResponse object { group, object, role }Role assignment linking a group to a role.
-
group: object { id, created_at, name, 2 more }Summary information about a group returned in role assignment responses.
-
id: stringIdentifier for the group.
-
created_at: numberUnix timestamp (in seconds) when the group was created.
-
name: stringDisplay name of the group.
-
object: "group"Always
group."group"
-
scim_managed: booleanWhether the group is managed through SCIM.
-
-
object: "group.role"Always
group.role."group.role"
-
role: RoleDetails about a role that can be assigned through the public Roles API.
-
id: stringIdentifier for the role.
-
description: stringOptional description of the role.
-
name: stringUnique name for the role.
-
object: "role"Always
role."role"
-
permissions: array of stringPermissions granted by the role.
-
predefined_role: booleanWhether the role is predefined and managed by OpenAI.
-
resource_type: stringResource type the role is bound to (for example
api.organizationorapi.project).
-
-
Role Retrieve Response
-
RoleRetrieveResponse object { id, assignment_sources, created_at, 9 more }Detailed information about a role assignment entry returned when listing assignments.
-
id: stringIdentifier for the role.
-
assignment_sources: array of object { principal_id, principal_type }Principals from which the role assignment is inherited, when available.
-
principal_id: string -
principal_type: string
-
-
created_at: numberWhen the role was created.
-
created_by: stringIdentifier of the actor who created the role.
-
created_by_user_obj: map[unknown]User details for the actor that created the role, when available.
-
description: stringDescription of the role.
-
metadata: map[unknown]Arbitrary metadata stored on the role.
-
name: stringName of the role.
-
permissions: array of stringPermissions associated with the role.
-
predefined_role: booleanWhether the role is predefined by OpenAI.
-
resource_type: stringResource type the role applies to.
-
updated_at: numberWhen the role was last updated.
-
Role Delete Response
-
RoleDeleteResponse object { deleted, object }Confirmation payload returned after unassigning a role.
-
deleted: booleanWhether the assignment was removed.
-
object: stringIdentifier for the deleted assignment, such as
group.role.deletedoruser.role.deleted.
-
Roles
List organization roles
get /organization/roles
List organization roles
Query Parameters
-
after: optional stringCursor for pagination. Provide the value from the previous response's
nextfield to continue listing roles. -
limit: optional numberA limit on the number of roles to return. Defaults to 1000.
-
order: optional "asc" or "desc"Sort order for the returned roles.
-
"asc" -
"desc"
-
Returns
-
data: array of RoleRoles returned in the current page.
-
id: stringIdentifier for the role.
-
description: stringOptional description of the role.
-
name: stringUnique name for the role.
-
object: "role"Always
role."role"
-
permissions: array of stringPermissions granted by the role.
-
predefined_role: booleanWhether the role is predefined and managed by OpenAI.
-
resource_type: stringResource type the role is bound to (for example
api.organizationorapi.project).
-
-
has_more: booleanWhether more roles are available when paginating.
-
next: stringCursor to fetch the next page of results, or
nullwhen there are no additional roles. -
object: "list"Always
list."list"
Example
curl https://api.openai.com/v1/organization/roles \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"data": [
{
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
}
],
"has_more": true,
"next": "next",
"object": "list"
}
Example
curl https://api.openai.com/v1/organization/roles?limit=20 \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "list",
"data": [
{
"object": "role",
"id": "role_01J1F8ROLE01",
"name": "API Group Manager",
"description": "Allows managing organization groups",
"permissions": [
"api.groups.read",
"api.groups.write"
],
"resource_type": "api.organization",
"predefined_role": false
}
],
"has_more": false,
"next": null
}
Create organization role
post /organization/roles
Create organization role
Body Parameters
-
permissions: array of stringPermissions to grant to the role.
-
role_name: stringUnique name for the role.
-
description: optional stringOptional description of the role.
Returns
-
Role object { id, description, name, 4 more }Details about a role that can be assigned through the public Roles API.
-
id: stringIdentifier for the role.
-
description: stringOptional description of the role.
-
name: stringUnique name for the role.
-
object: "role"Always
role."role"
-
permissions: array of stringPermissions granted by the role.
-
predefined_role: booleanWhether the role is predefined and managed by OpenAI.
-
resource_type: stringResource type the role is bound to (for example
api.organizationorapi.project).
-
Example
curl https://api.openai.com/v1/organization/roles \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-d '{
"permissions": [
"string"
],
"role_name": "role_name"
}'
Response
{
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
}
Example
curl -X POST https://api.openai.com/v1/organization/roles \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"role_name": "API Group Manager",
"permissions": [
"api.groups.read",
"api.groups.write"
],
"description": "Allows managing organization groups"
}'
Response
{
"object": "role",
"id": "role_01J1F8ROLE01",
"name": "API Group Manager",
"description": "Allows managing organization groups",
"permissions": [
"api.groups.read",
"api.groups.write"
],
"resource_type": "api.organization",
"predefined_role": false
}
Retrieve organization role
get /organization/roles/{role_id}
Retrieve organization role
Path Parameters
role_id: string
Returns
-
Role object { id, description, name, 4 more }Details about a role that can be assigned through the public Roles API.
-
id: stringIdentifier for the role.
-
description: stringOptional description of the role.
-
name: stringUnique name for the role.
-
object: "role"Always
role."role"
-
permissions: array of stringPermissions granted by the role.
-
predefined_role: booleanWhether the role is predefined and managed by OpenAI.
-
resource_type: stringResource type the role is bound to (for example
api.organizationorapi.project).
-
Example
curl https://api.openai.com/v1/organization/roles/$ROLE_ID \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
}
Example
curl https://api.openai.com/v1/organization/roles/role_01J1F8ROLE01 \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "role",
"id": "role_01J1F8ROLE01",
"name": "API Group Manager",
"description": "Allows managing organization groups",
"permissions": [
"api.groups.read",
"api.groups.write"
],
"resource_type": "api.organization",
"predefined_role": false
}
Update organization role
post /organization/roles/{role_id}
Update organization role
Path Parameters
role_id: string
Body Parameters
-
description: optional stringNew description for the role.
-
permissions: optional array of stringUpdated set of permissions for the role.
-
role_name: optional stringNew name for the role.
Returns
-
Role object { id, description, name, 4 more }Details about a role that can be assigned through the public Roles API.
-
id: stringIdentifier for the role.
-
description: stringOptional description of the role.
-
name: stringUnique name for the role.
-
object: "role"Always
role."role"
-
permissions: array of stringPermissions granted by the role.
-
predefined_role: booleanWhether the role is predefined and managed by OpenAI.
-
resource_type: stringResource type the role is bound to (for example
api.organizationorapi.project).
-
Example
curl https://api.openai.com/v1/organization/roles/$ROLE_ID \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-d '{}'
Response
{
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
}
Example
curl -X POST https://api.openai.com/v1/organization/roles/role_01J1F8ROLE01 \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"role_name": "API Group Manager",
"permissions": [
"api.groups.read",
"api.groups.write"
],
"description": "Allows managing organization groups"
}'
Response
{
"object": "role",
"id": "role_01J1F8ROLE01",
"name": "API Group Manager",
"description": "Allows managing organization groups",
"permissions": [
"api.groups.read",
"api.groups.write"
],
"resource_type": "api.organization",
"predefined_role": false
}
Delete organization role
delete /organization/roles/{role_id}
Delete organization role
Path Parameters
role_id: string
Returns
-
id: stringIdentifier of the deleted role.
-
deleted: booleanWhether the role was deleted.
-
object: "role.deleted"Always
role.deleted."role.deleted"
Example
curl https://api.openai.com/v1/organization/roles/$ROLE_ID \
-X DELETE \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"id": "id",
"deleted": true,
"object": "role.deleted"
}
Example
curl -X DELETE https://api.openai.com/v1/organization/roles/role_01J1F8ROLE01 \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "role.deleted",
"id": "role_01J1F8ROLE01",
"deleted": true
}
Domain Types
Role
-
Role object { id, description, name, 4 more }Details about a role that can be assigned through the public Roles API.
-
id: stringIdentifier for the role.
-
description: stringOptional description of the role.
-
name: stringUnique name for the role.
-
object: "role"Always
role."role"
-
permissions: array of stringPermissions granted by the role.
-
predefined_role: booleanWhether the role is predefined and managed by OpenAI.
-
resource_type: stringResource type the role is bound to (for example
api.organizationorapi.project).
-
Role Delete Response
-
RoleDeleteResponse object { id, deleted, object }Confirmation payload returned after deleting a role.
-
id: stringIdentifier of the deleted role.
-
deleted: booleanWhether the role was deleted.
-
object: "role.deleted"Always
role.deleted."role.deleted"
-
Data Retention
Retrieve organization data retention
get /organization/data_retention
Retrieve organization data retention
Returns
-
OrganizationDataRetention object { object, type }Represents the organization's data retention control setting.
-
object: "organization.data_retention"The object type, which is always
organization.data_retention."organization.data_retention"
-
type: "zero_data_retention" or "modified_abuse_monitoring" or "enhanced_zero_data_retention" or "enhanced_modified_abuse_monitoring"The configured organization data retention type.
-
"zero_data_retention" -
"modified_abuse_monitoring" -
"enhanced_zero_data_retention" -
"enhanced_modified_abuse_monitoring"
-
-
Example
curl https://api.openai.com/v1/organization/data_retention \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"object": "organization.data_retention",
"type": "zero_data_retention"
}
Example
curl https://api.openai.com/v1/organization/data_retention \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "organization.data_retention",
"type": "modified_abuse_monitoring"
}
Update organization data retention
post /organization/data_retention
Update organization data retention
Body Parameters
-
retention_type: "zero_data_retention" or "modified_abuse_monitoring" or "enhanced_zero_data_retention" or "enhanced_modified_abuse_monitoring"The desired organization data retention type.
-
"zero_data_retention" -
"modified_abuse_monitoring" -
"enhanced_zero_data_retention" -
"enhanced_modified_abuse_monitoring"
-
Returns
-
OrganizationDataRetention object { object, type }Represents the organization's data retention control setting.
-
object: "organization.data_retention"The object type, which is always
organization.data_retention."organization.data_retention"
-
type: "zero_data_retention" or "modified_abuse_monitoring" or "enhanced_zero_data_retention" or "enhanced_modified_abuse_monitoring"The configured organization data retention type.
-
"zero_data_retention" -
"modified_abuse_monitoring" -
"enhanced_zero_data_retention" -
"enhanced_modified_abuse_monitoring"
-
-
Example
curl https://api.openai.com/v1/organization/data_retention \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-d '{
"retention_type": "zero_data_retention"
}'
Response
{
"object": "organization.data_retention",
"type": "zero_data_retention"
}
Example
curl -X POST https://api.openai.com/v1/organization/data_retention \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"retention_type": "modified_abuse_monitoring"
}'
Response
{
"object": "organization.data_retention",
"type": "modified_abuse_monitoring"
}
Domain Types
Organization Data Retention
-
OrganizationDataRetention object { object, type }Represents the organization's data retention control setting.
-
object: "organization.data_retention"The object type, which is always
organization.data_retention."organization.data_retention"
-
type: "zero_data_retention" or "modified_abuse_monitoring" or "enhanced_zero_data_retention" or "enhanced_modified_abuse_monitoring"The configured organization data retention type.
-
"zero_data_retention" -
"modified_abuse_monitoring" -
"enhanced_zero_data_retention" -
"enhanced_modified_abuse_monitoring"
-
-
Spend Alerts
List organization spend alerts
get /organization/spend_alerts
List organization spend alerts
Query Parameters
-
after: optional stringCursor for pagination. Provide the ID of the last spend alert from the previous response to fetch the next page.
-
before: optional stringCursor for pagination. Provide the ID of the first spend alert from the previous response to fetch the previous page.
-
limit: optional numberA limit on the number of spend alerts to return. Defaults to 20.
-
order: optional "asc" or "desc"Sort order for the returned spend alerts.
-
"asc" -
"desc"
-
Returns
-
data: array of OrganizationSpendAlertSpend alerts returned in the current page.
-
id: stringThe identifier, which can be referenced in API endpoints.
-
currency: "USD"The currency for the threshold amount.
"USD"
-
interval: "month"The time interval for evaluating spend against the threshold.
"month"
-
notification_channel: object { recipients, type, subject_prefix }Email notification settings for a spend alert.
-
recipients: array of stringEmail addresses that receive the spend alert notification.
-
type: "email"The notification channel type. Currently only
emailis supported."email"
-
subject_prefix: optional stringOptional subject prefix for alert emails.
-
-
object: "organization.spend_alert"The object type, which is always
organization.spend_alert."organization.spend_alert"
-
threshold_amount: numberThe alert threshold amount, in cents.
-
-
first_id: stringThe ID of the first spend alert in this page.
-
has_more: booleanWhether more spend alerts are available when paginating.
-
last_id: stringThe ID of the last spend alert in this page.
-
object: "list"Always
list."list"
Example
curl https://api.openai.com/v1/organization/spend_alerts \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"data": [
{
"id": "id",
"currency": "USD",
"interval": "month",
"notification_channel": {
"recipients": [
"string"
],
"type": "email",
"subject_prefix": "subject_prefix"
},
"object": "organization.spend_alert",
"threshold_amount": 0
}
],
"first_id": "first_id",
"has_more": true,
"last_id": "last_id",
"object": "list"
}
Example
curl https://api.openai.com/v1/organization/spend_alerts?limit=20&order=asc \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"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
}
Create organization spend alert
post /organization/spend_alerts
Create organization spend alert
Body Parameters
-
currency: "USD"The currency for the threshold amount.
"USD"
-
interval: "month"The time interval for evaluating spend against the threshold.
"month"
-
notification_channel: object { recipients, type, subject_prefix }Email notification settings for a spend alert.
-
recipients: array of stringEmail addresses that receive the spend alert notification.
-
type: "email"The notification channel type. Currently only
emailis supported."email"
-
subject_prefix: optional stringOptional subject prefix for alert emails.
-
-
threshold_amount: numberThe alert threshold amount, in cents.
Returns
-
OrganizationSpendAlert object { id, currency, interval, 3 more }Represents a spend alert configured at the organization level.
-
id: stringThe identifier, which can be referenced in API endpoints.
-
currency: "USD"The currency for the threshold amount.
"USD"
-
interval: "month"The time interval for evaluating spend against the threshold.
"month"
-
notification_channel: object { recipients, type, subject_prefix }Email notification settings for a spend alert.
-
recipients: array of stringEmail addresses that receive the spend alert notification.
-
type: "email"The notification channel type. Currently only
emailis supported."email"
-
subject_prefix: optional stringOptional subject prefix for alert emails.
-
-
object: "organization.spend_alert"The object type, which is always
organization.spend_alert."organization.spend_alert"
-
threshold_amount: numberThe alert threshold amount, in cents.
-
Example
curl https://api.openai.com/v1/organization/spend_alerts \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-d '{
"currency": "USD",
"interval": "month",
"notification_channel": {
"recipients": [
"string"
],
"type": "email"
},
"threshold_amount": 0
}'
Response
{
"id": "id",
"currency": "USD",
"interval": "month",
"notification_channel": {
"recipients": [
"string"
],
"type": "email",
"subject_prefix": "subject_prefix"
},
"object": "organization.spend_alert",
"threshold_amount": 0
}
Example
curl -X POST https://api.openai.com/v1/organization/spend_alerts \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"threshold_amount": 100000,
"currency": "USD",
"interval": "month",
"notification_channel": {
"type": "email",
"recipients": ["finance@example.com"],
"subject_prefix": "OpenAI spend alert"
}
}'
Response
{
"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"
}
}
Retrieve organization spend alert
get /organization/spend_alerts/{alert_id}
Retrieve organization spend alert
Path Parameters
alert_id: string
Returns
-
OrganizationSpendAlert object { id, currency, interval, 3 more }Represents a spend alert configured at the organization level.
-
id: stringThe identifier, which can be referenced in API endpoints.
-
currency: "USD"The currency for the threshold amount.
"USD"
-
interval: "month"The time interval for evaluating spend against the threshold.
"month"
-
notification_channel: object { recipients, type, subject_prefix }Email notification settings for a spend alert.
-
recipients: array of stringEmail addresses that receive the spend alert notification.
-
type: "email"The notification channel type. Currently only
emailis supported."email"
-
subject_prefix: optional stringOptional subject prefix for alert emails.
-
-
object: "organization.spend_alert"The object type, which is always
organization.spend_alert."organization.spend_alert"
-
threshold_amount: numberThe alert threshold amount, in cents.
-
Example
curl https://api.openai.com/v1/organization/spend_alerts/$ALERT_ID \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"id": "id",
"currency": "USD",
"interval": "month",
"notification_channel": {
"recipients": [
"string"
],
"type": "email",
"subject_prefix": "subject_prefix"
},
"object": "organization.spend_alert",
"threshold_amount": 0
}
Example
curl https://api.openai.com/v1/organization/spend_alerts/alert_abc123 \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"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"
}
}
Update organization spend alert
post /organization/spend_alerts/{alert_id}
Update organization spend alert
Path Parameters
alert_id: string
Body Parameters
-
currency: "USD"The currency for the threshold amount.
"USD"
-
interval: "month"The time interval for evaluating spend against the threshold.
"month"
-
notification_channel: object { recipients, type, subject_prefix }Email notification settings for a spend alert.
-
recipients: array of stringEmail addresses that receive the spend alert notification.
-
type: "email"The notification channel type. Currently only
emailis supported."email"
-
subject_prefix: optional stringOptional subject prefix for alert emails.
-
-
threshold_amount: numberThe alert threshold amount, in cents.
Returns
-
OrganizationSpendAlert object { id, currency, interval, 3 more }Represents a spend alert configured at the organization level.
-
id: stringThe identifier, which can be referenced in API endpoints.
-
currency: "USD"The currency for the threshold amount.
"USD"
-
interval: "month"The time interval for evaluating spend against the threshold.
"month"
-
notification_channel: object { recipients, type, subject_prefix }Email notification settings for a spend alert.
-
recipients: array of stringEmail addresses that receive the spend alert notification.
-
type: "email"The notification channel type. Currently only
emailis supported."email"
-
subject_prefix: optional stringOptional subject prefix for alert emails.
-
-
object: "organization.spend_alert"The object type, which is always
organization.spend_alert."organization.spend_alert"
-
threshold_amount: numberThe alert threshold amount, in cents.
-
Example
curl https://api.openai.com/v1/organization/spend_alerts/$ALERT_ID \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-d '{
"currency": "USD",
"interval": "month",
"notification_channel": {
"recipients": [
"string"
],
"type": "email"
},
"threshold_amount": 0
}'
Response
{
"id": "id",
"currency": "USD",
"interval": "month",
"notification_channel": {
"recipients": [
"string"
],
"type": "email",
"subject_prefix": "subject_prefix"
},
"object": "organization.spend_alert",
"threshold_amount": 0
}
Example
curl -X POST https://api.openai.com/v1/organization/spend_alerts/alert_abc123 \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"threshold_amount": 150000,
"currency": "USD",
"interval": "month",
"notification_channel": {
"type": "email",
"recipients": ["finance@example.com"],
"subject_prefix": "OpenAI spend alert"
}
}'
Response
{
"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"
}
}
Delete organization spend alert
delete /organization/spend_alerts/{alert_id}
Delete organization spend alert
Path Parameters
alert_id: string
Returns
-
OrganizationSpendAlertDeleted object { id, deleted, object }Confirmation payload returned after deleting an organization spend alert.
-
id: stringThe deleted spend alert ID.
-
deleted: booleanWhether the spend alert was deleted.
-
object: "organization.spend_alert.deleted"Always
organization.spend_alert.deleted."organization.spend_alert.deleted"
-
Example
curl https://api.openai.com/v1/organization/spend_alerts/$ALERT_ID \
-X DELETE \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"id": "id",
"deleted": true,
"object": "organization.spend_alert.deleted"
}
Example
curl -X DELETE https://api.openai.com/v1/organization/spend_alerts/alert_abc123 \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"id": "alert_abc123",
"object": "organization.spend_alert.deleted",
"deleted": true
}
Domain Types
Organization Spend Alert
-
OrganizationSpendAlert object { id, currency, interval, 3 more }Represents a spend alert configured at the organization level.
-
id: stringThe identifier, which can be referenced in API endpoints.
-
currency: "USD"The currency for the threshold amount.
"USD"
-
interval: "month"The time interval for evaluating spend against the threshold.
"month"
-
notification_channel: object { recipients, type, subject_prefix }Email notification settings for a spend alert.
-
recipients: array of stringEmail addresses that receive the spend alert notification.
-
type: "email"The notification channel type. Currently only
emailis supported."email"
-
subject_prefix: optional stringOptional subject prefix for alert emails.
-
-
object: "organization.spend_alert"The object type, which is always
organization.spend_alert."organization.spend_alert"
-
threshold_amount: numberThe alert threshold amount, in cents.
-
Organization Spend Alert Deleted
-
OrganizationSpendAlertDeleted object { id, deleted, object }Confirmation payload returned after deleting an organization spend alert.
-
id: stringThe deleted spend alert ID.
-
deleted: booleanWhether the spend alert was deleted.
-
object: "organization.spend_alert.deleted"Always
organization.spend_alert.deleted."organization.spend_alert.deleted"
-
Certificates
List organization certificates
get /organization/certificates
List organization certificates
Query Parameters
-
after: optional stringA cursor for use in pagination.
afteris an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. -
limit: optional numberA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
-
order: optional "asc" or "desc"Sort order by the
created_attimestamp of the objects.ascfor ascending order anddescfor descending order.-
"asc" -
"desc"
-
Returns
-
data: array of object { id, active, certificate_details, 3 more }-
id: stringThe identifier, which can be referenced in API endpoints
-
active: booleanWhether the certificate is currently active at the organization level.
-
certificate_details: object { expires_at, valid_at }-
expires_at: optional numberThe Unix timestamp (in seconds) of when the certificate expires.
-
valid_at: optional numberThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
created_at: numberThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
name: stringThe name of the certificate.
-
object: "organization.certificate"The object type, which is always
organization.certificate."organization.certificate"
-
-
first_id: string -
has_more: boolean -
last_id: string -
object: "list""list"
Example
curl https://api.openai.com/v1/organization/certificates \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"data": [
{
"id": "id",
"active": true,
"certificate_details": {
"expires_at": 0,
"valid_at": 0
},
"created_at": 0,
"name": "name",
"object": "organization.certificate"
}
],
"first_id": "cert_abc",
"has_more": true,
"last_id": "cert_abc",
"object": "list"
}
Example
curl https://api.openai.com/v1/organization/certificates \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"object": "list",
"data": [
{
"object": "organization.certificate",
"id": "cert_abc",
"name": "My Example Certificate",
"active": true,
"created_at": 1234567,
"certificate_details": {
"valid_at": 12345667,
"expires_at": 12345678
}
},
],
"first_id": "cert_abc",
"last_id": "cert_abc",
"has_more": false
}
Upload certificate
post /organization/certificates
Upload certificate
Body Parameters
-
certificate: stringThe certificate content in PEM format
-
name: optional stringAn optional name for the certificate
Returns
-
Certificate object { id, certificate_details, created_at, 3 more }Represents an individual
certificateuploaded to the organization.-
id: stringThe identifier, which can be referenced in API endpoints
-
certificate_details: object { content, expires_at, valid_at }-
content: optional stringThe content of the certificate in PEM format.
-
expires_at: optional numberThe Unix timestamp (in seconds) of when the certificate expires.
-
valid_at: optional numberThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
created_at: numberThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
name: stringThe name of the certificate.
-
object: "certificate" or "organization.certificate" or "organization.project.certificate"The object type.
-
If creating, updating, or getting a specific certificate, the object type is
certificate. -
If listing, activating, or deactivating certificates for the organization, the object type is
organization.certificate. -
If listing, activating, or deactivating certificates for a project, the object type is
organization.project.certificate. -
"certificate" -
"organization.certificate" -
"organization.project.certificate"
-
-
active: optional booleanWhether the certificate is currently active at the specified scope. Not returned when getting details for a specific certificate.
-
Example
curl https://api.openai.com/v1/organization/certificates \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-d '{
"certificate": "certificate"
}'
Response
{
"id": "id",
"certificate_details": {
"content": "content",
"expires_at": 0,
"valid_at": 0
},
"created_at": 0,
"name": "name",
"object": "certificate",
"active": true
}
Example
curl -X POST https://api.openai.com/v1/organization/certificates \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "My Example Certificate",
"certificate": "-----BEGIN CERTIFICATE-----\\nMIIDeT...\\n-----END CERTIFICATE-----"
}'
Response
{
"object": "certificate",
"id": "cert_abc",
"name": "My Example Certificate",
"created_at": 1234567,
"certificate_details": {
"valid_at": 12345667,
"expires_at": 12345678
}
}
Get certificate
get /organization/certificates/{certificate_id}
Get certificate
Path Parameters
certificate_id: string
Query Parameters
-
include: optional array of "content"A list of additional fields to include in the response. Currently the only supported value is
contentto fetch the PEM content of the certificate."content"
Returns
-
Certificate object { id, certificate_details, created_at, 3 more }Represents an individual
certificateuploaded to the organization.-
id: stringThe identifier, which can be referenced in API endpoints
-
certificate_details: object { content, expires_at, valid_at }-
content: optional stringThe content of the certificate in PEM format.
-
expires_at: optional numberThe Unix timestamp (in seconds) of when the certificate expires.
-
valid_at: optional numberThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
created_at: numberThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
name: stringThe name of the certificate.
-
object: "certificate" or "organization.certificate" or "organization.project.certificate"The object type.
-
If creating, updating, or getting a specific certificate, the object type is
certificate. -
If listing, activating, or deactivating certificates for the organization, the object type is
organization.certificate. -
If listing, activating, or deactivating certificates for a project, the object type is
organization.project.certificate. -
"certificate" -
"organization.certificate" -
"organization.project.certificate"
-
-
active: optional booleanWhether the certificate is currently active at the specified scope. Not returned when getting details for a specific certificate.
-
Example
curl https://api.openai.com/v1/organization/certificates/$CERTIFICATE_ID \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"id": "id",
"certificate_details": {
"content": "content",
"expires_at": 0,
"valid_at": 0
},
"created_at": 0,
"name": "name",
"object": "certificate",
"active": true
}
Example
curl "https://api.openai.com/v1/organization/certificates/cert_abc?include[]=content" \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"object": "certificate",
"id": "cert_abc",
"name": "My Example Certificate",
"created_at": 1234567,
"certificate_details": {
"valid_at": 1234567,
"expires_at": 12345678,
"content": "-----BEGIN CERTIFICATE-----MIIDeT...-----END CERTIFICATE-----"
}
}
Modify certificate
post /organization/certificates/{certificate_id}
Modify certificate
Path Parameters
certificate_id: string
Body Parameters
-
name: optional stringThe updated name for the certificate
Returns
-
Certificate object { id, certificate_details, created_at, 3 more }Represents an individual
certificateuploaded to the organization.-
id: stringThe identifier, which can be referenced in API endpoints
-
certificate_details: object { content, expires_at, valid_at }-
content: optional stringThe content of the certificate in PEM format.
-
expires_at: optional numberThe Unix timestamp (in seconds) of when the certificate expires.
-
valid_at: optional numberThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
created_at: numberThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
name: stringThe name of the certificate.
-
object: "certificate" or "organization.certificate" or "organization.project.certificate"The object type.
-
If creating, updating, or getting a specific certificate, the object type is
certificate. -
If listing, activating, or deactivating certificates for the organization, the object type is
organization.certificate. -
If listing, activating, or deactivating certificates for a project, the object type is
organization.project.certificate. -
"certificate" -
"organization.certificate" -
"organization.project.certificate"
-
-
active: optional booleanWhether the certificate is currently active at the specified scope. Not returned when getting details for a specific certificate.
-
Example
curl https://api.openai.com/v1/organization/certificates/$CERTIFICATE_ID \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-d '{}'
Response
{
"id": "id",
"certificate_details": {
"content": "content",
"expires_at": 0,
"valid_at": 0
},
"created_at": 0,
"name": "name",
"object": "certificate",
"active": true
}
Example
curl -X POST https://api.openai.com/v1/organization/certificates/cert_abc \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Renamed Certificate"
}'
Response
{
"object": "certificate",
"id": "cert_abc",
"name": "Renamed Certificate",
"created_at": 1234567,
"certificate_details": {
"valid_at": 12345667,
"expires_at": 12345678
}
}
Delete certificate
delete /organization/certificates/{certificate_id}
Delete certificate
Path Parameters
certificate_id: string
Returns
-
id: stringThe ID of the certificate that was deleted.
-
object: "certificate.deleted"The object type, must be
certificate.deleted."certificate.deleted"
Example
curl https://api.openai.com/v1/organization/certificates/$CERTIFICATE_ID \
-X DELETE \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"id": "id",
"object": "certificate.deleted"
}
Example
curl -X DELETE https://api.openai.com/v1/organization/certificates/cert_abc \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"object": "certificate.deleted",
"id": "cert_abc"
}
Activate certificates for organization
post /organization/certificates/activate
Activate certificates for organization
Body Parameters
certificate_ids: array of string
Returns
-
data: array of object { id, active, certificate_details, 3 more }-
id: stringThe identifier, which can be referenced in API endpoints
-
active: booleanWhether the certificate is currently active at the organization level.
-
certificate_details: object { expires_at, valid_at }-
expires_at: optional numberThe Unix timestamp (in seconds) of when the certificate expires.
-
valid_at: optional numberThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
created_at: numberThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
name: stringThe name of the certificate.
-
object: "organization.certificate"The object type, which is always
organization.certificate."organization.certificate"
-
-
object: "organization.certificate.activation"The organization certificate activation result type.
"organization.certificate.activation"
Example
curl https://api.openai.com/v1/organization/certificates/activate \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-d '{
"certificate_ids": [
"cert_abc"
]
}'
Response
{
"data": [
{
"id": "id",
"active": true,
"certificate_details": {
"expires_at": 0,
"valid_at": 0
},
"created_at": 0,
"name": "name",
"object": "organization.certificate"
}
],
"object": "organization.certificate.activation"
}
Example
curl https://api.openai.com/v1/organization/certificates/activate \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"certificate_ids": ["cert_abc", "cert_def"]
}'
Response
{
"object": "organization.certificate.activation",
"data": [
{
"object": "organization.certificate",
"id": "cert_abc",
"name": "My Example Certificate",
"active": true,
"created_at": 1234567,
"certificate_details": {
"valid_at": 12345667,
"expires_at": 12345678
}
},
{
"object": "organization.certificate",
"id": "cert_def",
"name": "My Example Certificate 2",
"active": true,
"created_at": 1234567,
"certificate_details": {
"valid_at": 12345667,
"expires_at": 12345678
}
},
],
}
Deactivate certificates for organization
post /organization/certificates/deactivate
Deactivate certificates for organization
Body Parameters
certificate_ids: array of string
Returns
-
data: array of object { id, active, certificate_details, 3 more }-
id: stringThe identifier, which can be referenced in API endpoints
-
active: booleanWhether the certificate is currently active at the organization level.
-
certificate_details: object { expires_at, valid_at }-
expires_at: optional numberThe Unix timestamp (in seconds) of when the certificate expires.
-
valid_at: optional numberThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
created_at: numberThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
name: stringThe name of the certificate.
-
object: "organization.certificate"The object type, which is always
organization.certificate."organization.certificate"
-
-
object: "organization.certificate.deactivation"The organization certificate deactivation result type.
"organization.certificate.deactivation"
Example
curl https://api.openai.com/v1/organization/certificates/deactivate \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-d '{
"certificate_ids": [
"cert_abc"
]
}'
Response
{
"data": [
{
"id": "id",
"active": true,
"certificate_details": {
"expires_at": 0,
"valid_at": 0
},
"created_at": 0,
"name": "name",
"object": "organization.certificate"
}
],
"object": "organization.certificate.deactivation"
}
Example
curl https://api.openai.com/v1/organization/certificates/deactivate \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"certificate_ids": ["cert_abc", "cert_def"]
}'
Response
{
"object": "organization.certificate.deactivation",
"data": [
{
"object": "organization.certificate",
"id": "cert_abc",
"name": "My Example Certificate",
"active": false,
"created_at": 1234567,
"certificate_details": {
"valid_at": 12345667,
"expires_at": 12345678
}
},
{
"object": "organization.certificate",
"id": "cert_def",
"name": "My Example Certificate 2",
"active": false,
"created_at": 1234567,
"certificate_details": {
"valid_at": 12345667,
"expires_at": 12345678
}
},
],
}
Domain Types
Certificate
-
Certificate object { id, certificate_details, created_at, 3 more }Represents an individual
certificateuploaded to the organization.-
id: stringThe identifier, which can be referenced in API endpoints
-
certificate_details: object { content, expires_at, valid_at }-
content: optional stringThe content of the certificate in PEM format.
-
expires_at: optional numberThe Unix timestamp (in seconds) of when the certificate expires.
-
valid_at: optional numberThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
created_at: numberThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
name: stringThe name of the certificate.
-
object: "certificate" or "organization.certificate" or "organization.project.certificate"The object type.
-
If creating, updating, or getting a specific certificate, the object type is
certificate. -
If listing, activating, or deactivating certificates for the organization, the object type is
organization.certificate. -
If listing, activating, or deactivating certificates for a project, the object type is
organization.project.certificate. -
"certificate" -
"organization.certificate" -
"organization.project.certificate"
-
-
active: optional booleanWhether the certificate is currently active at the specified scope. Not returned when getting details for a specific certificate.
-
Certificate List Response
-
CertificateListResponse object { id, active, certificate_details, 3 more }Represents an individual certificate configured at the organization level.
-
id: stringThe identifier, which can be referenced in API endpoints
-
active: booleanWhether the certificate is currently active at the organization level.
-
certificate_details: object { expires_at, valid_at }-
expires_at: optional numberThe Unix timestamp (in seconds) of when the certificate expires.
-
valid_at: optional numberThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
created_at: numberThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
name: stringThe name of the certificate.
-
object: "organization.certificate"The object type, which is always
organization.certificate."organization.certificate"
-
Certificate Delete Response
-
CertificateDeleteResponse object { id, object }-
id: stringThe ID of the certificate that was deleted.
-
object: "certificate.deleted"The object type, must be
certificate.deleted."certificate.deleted"
-
Certificate Activate Response
-
CertificateActivateResponse object { id, active, certificate_details, 3 more }Represents an individual certificate configured at the organization level.
-
id: stringThe identifier, which can be referenced in API endpoints
-
active: booleanWhether the certificate is currently active at the organization level.
-
certificate_details: object { expires_at, valid_at }-
expires_at: optional numberThe Unix timestamp (in seconds) of when the certificate expires.
-
valid_at: optional numberThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
created_at: numberThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
name: stringThe name of the certificate.
-
object: "organization.certificate"The object type, which is always
organization.certificate."organization.certificate"
-
Certificate Deactivate Response
-
CertificateDeactivateResponse object { id, active, certificate_details, 3 more }Represents an individual certificate configured at the organization level.
-
id: stringThe identifier, which can be referenced in API endpoints
-
active: booleanWhether the certificate is currently active at the organization level.
-
certificate_details: object { expires_at, valid_at }-
expires_at: optional numberThe Unix timestamp (in seconds) of when the certificate expires.
-
valid_at: optional numberThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
created_at: numberThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
name: stringThe name of the certificate.
-
object: "organization.certificate"The object type, which is always
organization.certificate."organization.certificate"
-
Projects
List projects
get /organization/projects
List projects
Query Parameters
-
after: optional stringA cursor for use in pagination.
afteris an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. -
include_archived: optional booleanIf
truereturns all projects including those that have beenarchived. Archived projects are not included by default. -
limit: optional numberA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
Returns
-
data: array of Project-
id: stringThe identifier, which can be referenced in API endpoints
-
created_at: numberThe Unix timestamp (in seconds) of when the project was created.
-
object: "organization.project"The object type, which is always
organization.project"organization.project"
-
archived_at: optional numberThe Unix timestamp (in seconds) of when the project was archived or
null. -
external_key_id: optional stringThe external key associated with the project.
-
name: optional stringThe name of the project. This appears in reporting.
-
status: optional stringactiveorarchived
-
-
has_more: boolean -
object: "list""list"
-
first_id: optional string -
last_id: optional string
Example
curl https://api.openai.com/v1/organization/projects \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"data": [
{
"id": "id",
"created_at": 0,
"object": "organization.project",
"archived_at": 0,
"external_key_id": "external_key_id",
"name": "name",
"status": "status"
}
],
"has_more": true,
"object": "list",
"first_id": "first_id",
"last_id": "last_id"
}
Example
curl https://api.openai.com/v1/organization/projects?after=proj_abc&limit=20&include_archived=false \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "list",
"data": [
{
"id": "proj_abc",
"object": "organization.project",
"name": "Project example",
"created_at": 1711471533,
"archived_at": null,
"status": "active"
}
],
"first_id": "proj-abc",
"last_id": "proj-xyz",
"has_more": false
}
Create project
post /organization/projects
Create project
Body Parameters
-
name: stringThe friendly name of the project, this name appears in reports.
-
external_key_id: optional stringExternal key ID to associate with the project.
-
geography: optional stringCreate the project with the specified data residency region. Your organization must have access to Data residency functionality in order to use. See data residency controls to review the functionality and limitations of setting this field.
Returns
-
Project object { id, created_at, object, 4 more }Represents an individual project.
-
id: stringThe identifier, which can be referenced in API endpoints
-
created_at: numberThe Unix timestamp (in seconds) of when the project was created.
-
object: "organization.project"The object type, which is always
organization.project"organization.project"
-
archived_at: optional numberThe Unix timestamp (in seconds) of when the project was archived or
null. -
external_key_id: optional stringThe external key associated with the project.
-
name: optional stringThe name of the project. This appears in reporting.
-
status: optional stringactiveorarchived
-
Example
curl https://api.openai.com/v1/organization/projects \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-d '{
"name": "name"
}'
Response
{
"id": "id",
"created_at": 0,
"object": "organization.project",
"archived_at": 0,
"external_key_id": "external_key_id",
"name": "name",
"status": "status"
}
Example
curl -X POST https://api.openai.com/v1/organization/projects \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Project ABC"
}'
Response
{
"id": "proj_abc",
"object": "organization.project",
"name": "Project ABC",
"created_at": 1711471533,
"archived_at": null,
"status": "active"
}
Retrieve project
get /organization/projects/{project_id}
Retrieve project
Path Parameters
project_id: string
Returns
-
Project object { id, created_at, object, 4 more }Represents an individual project.
-
id: stringThe identifier, which can be referenced in API endpoints
-
created_at: numberThe Unix timestamp (in seconds) of when the project was created.
-
object: "organization.project"The object type, which is always
organization.project"organization.project"
-
archived_at: optional numberThe Unix timestamp (in seconds) of when the project was archived or
null. -
external_key_id: optional stringThe external key associated with the project.
-
name: optional stringThe name of the project. This appears in reporting.
-
status: optional stringactiveorarchived
-
Example
curl https://api.openai.com/v1/organization/projects/$PROJECT_ID \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"id": "id",
"created_at": 0,
"object": "organization.project",
"archived_at": 0,
"external_key_id": "external_key_id",
"name": "name",
"status": "status"
}
Example
curl https://api.openai.com/v1/organization/projects/proj_abc \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"id": "proj_abc",
"object": "organization.project",
"name": "Project example",
"created_at": 1711471533,
"archived_at": null,
"status": "active"
}
Modify project
post /organization/projects/{project_id}
Modify project
Path Parameters
project_id: string
Body Parameters
-
external_key_id: optional stringExternal key ID to associate with the project.
-
geography: optional stringGeography for the project.
-
name: optional stringThe updated name of the project, this name appears in reports.
Returns
-
Project object { id, created_at, object, 4 more }Represents an individual project.
-
id: stringThe identifier, which can be referenced in API endpoints
-
created_at: numberThe Unix timestamp (in seconds) of when the project was created.
-
object: "organization.project"The object type, which is always
organization.project"organization.project"
-
archived_at: optional numberThe Unix timestamp (in seconds) of when the project was archived or
null. -
external_key_id: optional stringThe external key associated with the project.
-
name: optional stringThe name of the project. This appears in reporting.
-
status: optional stringactiveorarchived
-
Example
curl https://api.openai.com/v1/organization/projects/$PROJECT_ID \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-d '{}'
Response
{
"id": "id",
"created_at": 0,
"object": "organization.project",
"archived_at": 0,
"external_key_id": "external_key_id",
"name": "name",
"status": "status"
}
Example
curl -X POST https://api.openai.com/v1/organization/projects/proj_abc \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Project DEF"
}'
Archive project
post /organization/projects/{project_id}/archive
Archive project
Path Parameters
project_id: string
Returns
-
Project object { id, created_at, object, 4 more }Represents an individual project.
-
id: stringThe identifier, which can be referenced in API endpoints
-
created_at: numberThe Unix timestamp (in seconds) of when the project was created.
-
object: "organization.project"The object type, which is always
organization.project"organization.project"
-
archived_at: optional numberThe Unix timestamp (in seconds) of when the project was archived or
null. -
external_key_id: optional stringThe external key associated with the project.
-
name: optional stringThe name of the project. This appears in reporting.
-
status: optional stringactiveorarchived
-
Example
curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/archive \
-X POST \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"id": "id",
"created_at": 0,
"object": "organization.project",
"archived_at": 0,
"external_key_id": "external_key_id",
"name": "name",
"status": "status"
}
Example
curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/archive \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"id": "proj_abc",
"object": "organization.project",
"name": "Project DEF",
"created_at": 1711471533,
"archived_at": 1711471533,
"status": "archived"
}
Domain Types
Project
-
Project object { id, created_at, object, 4 more }Represents an individual project.
-
id: stringThe identifier, which can be referenced in API endpoints
-
created_at: numberThe Unix timestamp (in seconds) of when the project was created.
-
object: "organization.project"The object type, which is always
organization.project"organization.project"
-
archived_at: optional numberThe Unix timestamp (in seconds) of when the project was archived or
null. -
external_key_id: optional stringThe external key associated with the project.
-
name: optional stringThe name of the project. This appears in reporting.
-
status: optional stringactiveorarchived
-
Users
List project users
get /organization/projects/{project_id}/users
List project users
Path Parameters
project_id: string
Query Parameters
-
after: optional stringA cursor for use in pagination.
afteris an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. -
limit: optional numberA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
Returns
-
data: array of ProjectUser-
id: stringThe identifier, which can be referenced in API endpoints
-
added_at: numberThe Unix timestamp (in seconds) of when the project was added.
-
object: "organization.project.user"The object type, which is always
organization.project.user"organization.project.user"
-
role: stringownerormember -
email: optional stringThe email address of the user
-
name: optional stringThe name of the user
-
-
has_more: boolean -
object: string -
first_id: optional string -
last_id: optional string
Example
curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/users \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"data": [
{
"id": "id",
"added_at": 0,
"object": "organization.project.user",
"role": "role",
"email": "email",
"name": "name"
}
],
"has_more": true,
"object": "object",
"first_id": "first_id",
"last_id": "last_id"
}
Example
curl https://api.openai.com/v1/organization/projects/proj_abc/users?after=user_abc&limit=20 \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "list",
"data": [
{
"object": "organization.project.user",
"id": "user_abc",
"name": "First Last",
"email": "user@example.com",
"role": "owner",
"added_at": 1711471533
}
],
"first_id": "user-abc",
"last_id": "user-xyz",
"has_more": false
}
Create project user
post /organization/projects/{project_id}/users
Create project user
Path Parameters
project_id: string
Body Parameters
-
role: stringownerormember -
email: optional stringEmail of the user to add.
-
user_id: optional stringThe ID of the user.
Returns
-
ProjectUser object { id, added_at, object, 3 more }Represents an individual user in a project.
-
id: stringThe identifier, which can be referenced in API endpoints
-
added_at: numberThe Unix timestamp (in seconds) of when the project was added.
-
object: "organization.project.user"The object type, which is always
organization.project.user"organization.project.user"
-
role: stringownerormember -
email: optional stringThe email address of the user
-
name: optional stringThe name of the user
-
Example
curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/users \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-d '{
"role": "role"
}'
Response
{
"id": "id",
"added_at": 0,
"object": "organization.project.user",
"role": "role",
"email": "email",
"name": "name"
}
Example
curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/users \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"user_id": "user_abc",
"role": "member"
}'
Response
{
"object": "organization.project.user",
"id": "user_abc",
"email": "user@example.com",
"role": "owner",
"added_at": 1711471533
}
Retrieve project user
get /organization/projects/{project_id}/users/{user_id}
Retrieve project user
Path Parameters
-
project_id: string -
user_id: string
Returns
-
ProjectUser object { id, added_at, object, 3 more }Represents an individual user in a project.
-
id: stringThe identifier, which can be referenced in API endpoints
-
added_at: numberThe Unix timestamp (in seconds) of when the project was added.
-
object: "organization.project.user"The object type, which is always
organization.project.user"organization.project.user"
-
role: stringownerormember -
email: optional stringThe email address of the user
-
name: optional stringThe name of the user
-
Example
curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/users/$USER_ID \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"id": "id",
"added_at": 0,
"object": "organization.project.user",
"role": "role",
"email": "email",
"name": "name"
}
Example
curl https://api.openai.com/v1/organization/projects/proj_abc/users/user_abc \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "organization.project.user",
"id": "user_abc",
"name": "First Last",
"email": "user@example.com",
"role": "owner",
"added_at": 1711471533
}
Modify project user
post /organization/projects/{project_id}/users/{user_id}
Modify project user
Path Parameters
-
project_id: string -
user_id: string
Body Parameters
-
role: optional stringownerormember
Returns
-
ProjectUser object { id, added_at, object, 3 more }Represents an individual user in a project.
-
id: stringThe identifier, which can be referenced in API endpoints
-
added_at: numberThe Unix timestamp (in seconds) of when the project was added.
-
object: "organization.project.user"The object type, which is always
organization.project.user"organization.project.user"
-
role: stringownerormember -
email: optional stringThe email address of the user
-
name: optional stringThe name of the user
-
Example
curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/users/$USER_ID \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-d '{}'
Response
{
"id": "id",
"added_at": 0,
"object": "organization.project.user",
"role": "role",
"email": "email",
"name": "name"
}
Example
curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/users/user_abc \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"role": "owner"
}'
Response
{
"object": "organization.project.user",
"id": "user_abc",
"name": "First Last",
"email": "user@example.com",
"role": "owner",
"added_at": 1711471533
}
Delete project user
delete /organization/projects/{project_id}/users/{user_id}
Delete project user
Path Parameters
-
project_id: string -
user_id: string
Returns
-
id: string -
deleted: boolean -
object: "organization.project.user.deleted""organization.project.user.deleted"
Example
curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/users/$USER_ID \
-X DELETE \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"id": "id",
"deleted": true,
"object": "organization.project.user.deleted"
}
Example
curl -X DELETE https://api.openai.com/v1/organization/projects/proj_abc/users/user_abc \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "organization.project.user.deleted",
"id": "user_abc",
"deleted": true
}
Domain Types
Project User
-
ProjectUser object { id, added_at, object, 3 more }Represents an individual user in a project.
-
id: stringThe identifier, which can be referenced in API endpoints
-
added_at: numberThe Unix timestamp (in seconds) of when the project was added.
-
object: "organization.project.user"The object type, which is always
organization.project.user"organization.project.user"
-
role: stringownerormember -
email: optional stringThe email address of the user
-
name: optional stringThe name of the user
-
User Delete Response
-
UserDeleteResponse object { id, deleted, object }-
id: string -
deleted: boolean -
object: "organization.project.user.deleted""organization.project.user.deleted"
-
Roles
List project user role assignments
get /projects/{project_id}/users/{user_id}/roles
List project user role assignments
Path Parameters
-
project_id: string -
user_id: string
Query Parameters
-
after: optional stringCursor for pagination. Provide the value from the previous response's
nextfield to continue listing project roles. -
limit: optional numberA limit on the number of project role assignments to return.
-
order: optional "asc" or "desc"Sort order for the returned project roles.
-
"asc" -
"desc"
-
Returns
-
data: array of object { id, assignment_sources, created_at, 9 more }Role assignments returned in the current page.
-
id: stringIdentifier for the role.
-
assignment_sources: array of object { principal_id, principal_type }Principals from which the role assignment is inherited, when available.
-
principal_id: string -
principal_type: string
-
-
created_at: numberWhen the role was created.
-
created_by: stringIdentifier of the actor who created the role.
-
created_by_user_obj: map[unknown]User details for the actor that created the role, when available.
-
description: stringDescription of the role.
-
metadata: map[unknown]Arbitrary metadata stored on the role.
-
name: stringName of the role.
-
permissions: array of stringPermissions associated with the role.
-
predefined_role: booleanWhether the role is predefined by OpenAI.
-
resource_type: stringResource type the role applies to.
-
updated_at: numberWhen the role was last updated.
-
-
has_more: booleanWhether additional assignments are available when paginating.
-
next: stringCursor to fetch the next page of results, or
nullwhen there are no more assignments. -
object: "list"Always
list."list"
Example
curl https://api.openai.com/v1/projects/$PROJECT_ID/users/$USER_ID/roles \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"data": [
{
"id": "id",
"assignment_sources": [
{
"principal_id": "principal_id",
"principal_type": "principal_type"
}
],
"created_at": 0,
"created_by": "created_by",
"created_by_user_obj": {
"foo": "bar"
},
"description": "description",
"metadata": {
"foo": "bar"
},
"name": "name",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type",
"updated_at": 0
}
],
"has_more": true,
"next": "next",
"object": "list"
}
Example
curl https://api.openai.com/v1/projects/proj_abc123/users/user_abc123/roles \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "list",
"data": [
{
"id": "role_01J1F8PROJ",
"name": "API Project Key Manager",
"permissions": [
"api.organization.projects.api_keys.read",
"api.organization.projects.api_keys.write"
],
"resource_type": "api.project",
"predefined_role": false,
"description": "Allows managing API keys for the project",
"created_at": 1711471533,
"updated_at": 1711472599,
"created_by": "user_abc123",
"created_by_user_obj": {
"id": "user_abc123",
"name": "Ada Lovelace",
"email": "ada@example.com"
},
"metadata": {}
}
],
"has_more": false,
"next": null
}
Assign project role to user
post /projects/{project_id}/users/{user_id}/roles
Assign project role to user
Path Parameters
-
project_id: string -
user_id: string
Body Parameters
-
role_id: stringIdentifier of the role to assign.
Returns
-
object: "user.role"Always
user.role."user.role"
-
role: RoleDetails about a role that can be assigned through the public Roles API.
-
id: stringIdentifier for the role.
-
description: stringOptional description of the role.
-
name: stringUnique name for the role.
-
object: "role"Always
role."role"
-
permissions: array of stringPermissions granted by the role.
-
predefined_role: booleanWhether the role is predefined and managed by OpenAI.
-
resource_type: stringResource type the role is bound to (for example
api.organizationorapi.project).
-
-
user: OrganizationUserRepresents an individual
userwithin an organization.-
id: stringThe identifier, which can be referenced in API endpoints
-
added_at: numberThe Unix timestamp (in seconds) of when the user was added.
-
object: "organization.user"The object type, which is always
organization.user"organization.user"
-
api_key_last_used_at: optional numberThe Unix timestamp (in seconds) of the user's last API key usage.
-
created: optional numberThe Unix timestamp (in seconds) of when the user was created.
-
developer_persona: optional stringThe developer persona metadata for the user.
-
email: optional stringThe email address of the user
-
is_default: optional booleanWhether this is the organization's default user.
-
is_scale_tier_authorized_purchaser: optional booleanWhether the user is an authorized purchaser for Scale Tier.
-
is_scim_managed: optional booleanWhether the user is managed through SCIM.
-
is_service_account: optional booleanWhether the user is a service account.
-
name: optional stringThe name of the user
-
projects: optional object { data, object }Projects associated with the user, if included.
-
data: array of object { id, name, role }-
id: optional string -
name: optional string -
role: optional string
-
-
object: "list""list"
-
-
role: optional stringownerorreader -
technical_level: optional stringThe technical level metadata for the user.
-
user: optional object { id, object, banned, 5 more }Nested user details.
-
id: string -
object: "user""user"
-
banned: optional boolean -
banned_at: optional number -
email: optional string -
enabled: optional boolean -
name: optional string -
picture: optional string
-
-
Example
curl https://api.openai.com/v1/projects/$PROJECT_ID/users/$USER_ID/roles \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-d '{
"role_id": "role_id"
}'
Response
{
"object": "user.role",
"role": {
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
},
"user": {
"id": "id",
"added_at": 0,
"object": "organization.user",
"api_key_last_used_at": 0,
"created": 0,
"developer_persona": "developer_persona",
"email": "email",
"is_default": true,
"is_scale_tier_authorized_purchaser": true,
"is_scim_managed": true,
"is_service_account": true,
"name": "name",
"projects": {
"data": [
{
"id": "id",
"name": "name",
"role": "role"
}
],
"object": "list"
},
"role": "role",
"technical_level": "technical_level",
"user": {
"id": "id",
"object": "user",
"banned": true,
"banned_at": 0,
"email": "email",
"enabled": true,
"name": "name",
"picture": "picture"
}
}
}
Example
curl -X POST https://api.openai.com/v1/projects/proj_abc123/users/user_abc123/roles \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"role_id": "role_01J1F8PROJ"
}'
Response
{
"object": "user.role",
"user": {
"object": "organization.user",
"id": "user_abc123",
"name": "Ada Lovelace",
"email": "ada@example.com",
"role": "owner",
"added_at": 1711470000
},
"role": {
"object": "role",
"id": "role_01J1F8PROJ",
"name": "API Project Key Manager",
"description": "Allows managing API keys for the project",
"permissions": [
"api.organization.projects.api_keys.read",
"api.organization.projects.api_keys.write"
],
"resource_type": "api.project",
"predefined_role": false
}
}
Retrieve project user role
get /projects/{project_id}/users/{user_id}/roles/{role_id}
Retrieve project user role
Path Parameters
-
project_id: string -
user_id: string -
role_id: string
Returns
-
id: stringIdentifier for the role.
-
assignment_sources: array of object { principal_id, principal_type }Principals from which the role assignment is inherited, when available.
-
principal_id: string -
principal_type: string
-
-
created_at: numberWhen the role was created.
-
created_by: stringIdentifier of the actor who created the role.
-
created_by_user_obj: map[unknown]User details for the actor that created the role, when available.
-
description: stringDescription of the role.
-
metadata: map[unknown]Arbitrary metadata stored on the role.
-
name: stringName of the role.
-
permissions: array of stringPermissions associated with the role.
-
predefined_role: booleanWhether the role is predefined by OpenAI.
-
resource_type: stringResource type the role applies to.
-
updated_at: numberWhen the role was last updated.
Example
curl https://api.openai.com/v1/projects/$PROJECT_ID/users/$USER_ID/roles/$ROLE_ID \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"id": "id",
"assignment_sources": [
{
"principal_id": "principal_id",
"principal_type": "principal_type"
}
],
"created_at": 0,
"created_by": "created_by",
"created_by_user_obj": {
"foo": "bar"
},
"description": "description",
"metadata": {
"foo": "bar"
},
"name": "name",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type",
"updated_at": 0
}
Example
curl https://api.openai.com/v1/projects/proj_abc123/users/user_abc123/roles/role_01J1F8PROJ \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"id": "role_01J1F8PROJ",
"name": "API Project Key Manager",
"permissions": [
"api.organization.projects.api_keys.read",
"api.organization.projects.api_keys.write"
],
"resource_type": "api.project",
"predefined_role": false,
"description": "Allows managing API keys for the project",
"created_at": 1711471533,
"updated_at": 1711472599,
"created_by": "user_abc123",
"created_by_user_obj": null,
"metadata": {},
"assignment_sources": null
}
Unassign project role from user
delete /projects/{project_id}/users/{user_id}/roles/{role_id}
Unassign project role from user
Path Parameters
-
project_id: string -
user_id: string -
role_id: string
Returns
-
deleted: booleanWhether the assignment was removed.
-
object: stringIdentifier for the deleted assignment, such as
group.role.deletedoruser.role.deleted.
Example
curl https://api.openai.com/v1/projects/$PROJECT_ID/users/$USER_ID/roles/$ROLE_ID \
-X DELETE \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"deleted": true,
"object": "object"
}
Example
curl -X DELETE https://api.openai.com/v1/projects/proj_abc123/users/user_abc123/roles/role_01J1F8PROJ \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "user.role.deleted",
"deleted": true
}
Domain Types
Role List Response
-
RoleListResponse object { id, assignment_sources, created_at, 9 more }Detailed information about a role assignment entry returned when listing assignments.
-
id: stringIdentifier for the role.
-
assignment_sources: array of object { principal_id, principal_type }Principals from which the role assignment is inherited, when available.
-
principal_id: string -
principal_type: string
-
-
created_at: numberWhen the role was created.
-
created_by: stringIdentifier of the actor who created the role.
-
created_by_user_obj: map[unknown]User details for the actor that created the role, when available.
-
description: stringDescription of the role.
-
metadata: map[unknown]Arbitrary metadata stored on the role.
-
name: stringName of the role.
-
permissions: array of stringPermissions associated with the role.
-
predefined_role: booleanWhether the role is predefined by OpenAI.
-
resource_type: stringResource type the role applies to.
-
updated_at: numberWhen the role was last updated.
-
Role Create Response
-
RoleCreateResponse object { object, role, user }Role assignment linking a user to a role.
-
object: "user.role"Always
user.role."user.role"
-
role: RoleDetails about a role that can be assigned through the public Roles API.
-
id: stringIdentifier for the role.
-
description: stringOptional description of the role.
-
name: stringUnique name for the role.
-
object: "role"Always
role."role"
-
permissions: array of stringPermissions granted by the role.
-
predefined_role: booleanWhether the role is predefined and managed by OpenAI.
-
resource_type: stringResource type the role is bound to (for example
api.organizationorapi.project).
-
-
user: OrganizationUserRepresents an individual
userwithin an organization.-
id: stringThe identifier, which can be referenced in API endpoints
-
added_at: numberThe Unix timestamp (in seconds) of when the user was added.
-
object: "organization.user"The object type, which is always
organization.user"organization.user"
-
api_key_last_used_at: optional numberThe Unix timestamp (in seconds) of the user's last API key usage.
-
created: optional numberThe Unix timestamp (in seconds) of when the user was created.
-
developer_persona: optional stringThe developer persona metadata for the user.
-
email: optional stringThe email address of the user
-
is_default: optional booleanWhether this is the organization's default user.
-
is_scale_tier_authorized_purchaser: optional booleanWhether the user is an authorized purchaser for Scale Tier.
-
is_scim_managed: optional booleanWhether the user is managed through SCIM.
-
is_service_account: optional booleanWhether the user is a service account.
-
name: optional stringThe name of the user
-
projects: optional object { data, object }Projects associated with the user, if included.
-
data: array of object { id, name, role }-
id: optional string -
name: optional string -
role: optional string
-
-
object: "list""list"
-
-
role: optional stringownerorreader -
technical_level: optional stringThe technical level metadata for the user.
-
user: optional object { id, object, banned, 5 more }Nested user details.
-
id: string -
object: "user""user"
-
banned: optional boolean -
banned_at: optional number -
email: optional string -
enabled: optional boolean -
name: optional string -
picture: optional string
-
-
-
Role Retrieve Response
-
RoleRetrieveResponse object { id, assignment_sources, created_at, 9 more }Detailed information about a role assignment entry returned when listing assignments.
-
id: stringIdentifier for the role.
-
assignment_sources: array of object { principal_id, principal_type }Principals from which the role assignment is inherited, when available.
-
principal_id: string -
principal_type: string
-
-
created_at: numberWhen the role was created.
-
created_by: stringIdentifier of the actor who created the role.
-
created_by_user_obj: map[unknown]User details for the actor that created the role, when available.
-
description: stringDescription of the role.
-
metadata: map[unknown]Arbitrary metadata stored on the role.
-
name: stringName of the role.
-
permissions: array of stringPermissions associated with the role.
-
predefined_role: booleanWhether the role is predefined by OpenAI.
-
resource_type: stringResource type the role applies to.
-
updated_at: numberWhen the role was last updated.
-
Role Delete Response
-
RoleDeleteResponse object { deleted, object }Confirmation payload returned after unassigning a role.
-
deleted: booleanWhether the assignment was removed.
-
object: stringIdentifier for the deleted assignment, such as
group.role.deletedoruser.role.deleted.
-
Service Accounts
List project service accounts
get /organization/projects/{project_id}/service_accounts
List project service accounts
Path Parameters
project_id: string
Query Parameters
-
after: optional stringA cursor for use in pagination.
afteris an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. -
limit: optional numberA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
Returns
-
data: array of ProjectServiceAccount-
id: stringThe identifier, which can be referenced in API endpoints
-
created_at: numberThe Unix timestamp (in seconds) of when the service account was created
-
name: stringThe name of the service account
-
object: "organization.project.service_account"The object type, which is always
organization.project.service_account"organization.project.service_account"
-
role: "owner" or "member"ownerormember-
"owner" -
"member"
-
-
-
has_more: boolean -
object: "list""list"
-
first_id: optional string -
last_id: optional string
Example
curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/service_accounts \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"data": [
{
"id": "id",
"created_at": 0,
"name": "name",
"object": "organization.project.service_account",
"role": "owner"
}
],
"has_more": true,
"object": "list",
"first_id": "first_id",
"last_id": "last_id"
}
Example
curl https://api.openai.com/v1/organization/projects/proj_abc/service_accounts?after=custom_id&limit=20 \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "list",
"data": [
{
"object": "organization.project.service_account",
"id": "svc_acct_abc",
"name": "Service Account",
"role": "owner",
"created_at": 1711471533
}
],
"first_id": "svc_acct_abc",
"last_id": "svc_acct_xyz",
"has_more": false
}
Create project service account
post /organization/projects/{project_id}/service_accounts
Create project service account
Path Parameters
project_id: string
Body Parameters
-
name: stringThe name of the service account being created.
Returns
-
id: string -
api_key: object { id, created_at, name, 2 more }-
id: string -
created_at: number -
name: string -
object: "organization.project.service_account.api_key"The object type, which is always
organization.project.service_account.api_key"organization.project.service_account.api_key"
-
value: string
-
-
created_at: number -
name: string -
object: "organization.project.service_account""organization.project.service_account"
-
role: "member"Service accounts can only have one role of type
member"member"
Example
curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/service_accounts \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-d '{
"name": "name"
}'
Response
{
"id": "id",
"api_key": {
"id": "id",
"created_at": 0,
"name": "name",
"object": "organization.project.service_account.api_key",
"value": "value"
},
"created_at": 0,
"name": "name",
"object": "organization.project.service_account",
"role": "member"
}
Example
curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/service_accounts \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Production App"
}'
Response
{
"object": "organization.project.service_account",
"id": "svc_acct_abc",
"name": "Production App",
"role": "member",
"created_at": 1711471533,
"api_key": {
"object": "organization.project.service_account.api_key",
"value": "sk-abcdefghijklmnop123",
"name": "Secret Key",
"created_at": 1711471533,
"id": "key_abc"
}
}
Retrieve project service account
get /organization/projects/{project_id}/service_accounts/{service_account_id}
Retrieve project service account
Path Parameters
-
project_id: string -
service_account_id: string
Returns
-
ProjectServiceAccount object { id, created_at, name, 2 more }Represents an individual service account in a project.
-
id: stringThe identifier, which can be referenced in API endpoints
-
created_at: numberThe Unix timestamp (in seconds) of when the service account was created
-
name: stringThe name of the service account
-
object: "organization.project.service_account"The object type, which is always
organization.project.service_account"organization.project.service_account"
-
role: "owner" or "member"ownerormember-
"owner" -
"member"
-
-
Example
curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/service_accounts/$SERVICE_ACCOUNT_ID \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"id": "id",
"created_at": 0,
"name": "name",
"object": "organization.project.service_account",
"role": "owner"
}
Example
curl https://api.openai.com/v1/organization/projects/proj_abc/service_accounts/svc_acct_abc \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "organization.project.service_account",
"id": "svc_acct_abc",
"name": "Service Account",
"role": "owner",
"created_at": 1711471533
}
Update project service account
post /organization/projects/{project_id}/service_accounts/{service_account_id}
Update project service account
Path Parameters
-
project_id: string -
service_account_id: string
Body Parameters
-
name: optional stringThe updated service account name.
-
role: optional "member" or "owner"The updated service account role.
-
"member" -
"owner"
-
Returns
-
ProjectServiceAccount object { id, created_at, name, 2 more }Represents an individual service account in a project.
-
id: stringThe identifier, which can be referenced in API endpoints
-
created_at: numberThe Unix timestamp (in seconds) of when the service account was created
-
name: stringThe name of the service account
-
object: "organization.project.service_account"The object type, which is always
organization.project.service_account"organization.project.service_account"
-
role: "owner" or "member"ownerormember-
"owner" -
"member"
-
-
Example
curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/service_accounts/$SERVICE_ACCOUNT_ID \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-d '{}'
Response
{
"id": "id",
"created_at": 0,
"name": "name",
"object": "organization.project.service_account",
"role": "owner"
}
Example
curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/service_accounts/svc_acct_abc \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Updated service account",
"role": "member"
}'
Response
{
"object": "organization.project.service_account",
"id": "svc_acct_abc",
"name": "Updated service account",
"role": "member",
"created_at": 1711471533
}
Delete project service account
delete /organization/projects/{project_id}/service_accounts/{service_account_id}
Delete project service account
Path Parameters
-
project_id: string -
service_account_id: string
Returns
-
id: string -
deleted: boolean -
object: "organization.project.service_account.deleted""organization.project.service_account.deleted"
Example
curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/service_accounts/$SERVICE_ACCOUNT_ID \
-X DELETE \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"id": "id",
"deleted": true,
"object": "organization.project.service_account.deleted"
}
Example
curl -X DELETE https://api.openai.com/v1/organization/projects/proj_abc/service_accounts/svc_acct_abc \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "organization.project.service_account.deleted",
"id": "svc_acct_abc",
"deleted": true
}
Domain Types
Project Service Account
-
ProjectServiceAccount object { id, created_at, name, 2 more }Represents an individual service account in a project.
-
id: stringThe identifier, which can be referenced in API endpoints
-
created_at: numberThe Unix timestamp (in seconds) of when the service account was created
-
name: stringThe name of the service account
-
object: "organization.project.service_account"The object type, which is always
organization.project.service_account"organization.project.service_account"
-
role: "owner" or "member"ownerormember-
"owner" -
"member"
-
-
Service Account Create Response
-
ServiceAccountCreateResponse object { id, api_key, created_at, 3 more }-
id: string -
api_key: object { id, created_at, name, 2 more }-
id: string -
created_at: number -
name: string -
object: "organization.project.service_account.api_key"The object type, which is always
organization.project.service_account.api_key"organization.project.service_account.api_key"
-
value: string
-
-
created_at: number -
name: string -
object: "organization.project.service_account""organization.project.service_account"
-
role: "member"Service accounts can only have one role of type
member"member"
-
Service Account Delete Response
-
ServiceAccountDeleteResponse object { id, deleted, object }-
id: string -
deleted: boolean -
object: "organization.project.service_account.deleted""organization.project.service_account.deleted"
-
API Keys
List project API keys
get /organization/projects/{project_id}/api_keys
List project API keys
Path Parameters
project_id: string
Query Parameters
-
after: optional stringA cursor for use in pagination.
afteris an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. -
limit: optional numberA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
Returns
-
data: array of ProjectAPIKey-
id: stringThe identifier, which can be referenced in API endpoints
-
created_at: numberThe Unix timestamp (in seconds) of when the API key was created
-
last_used_at: numberThe Unix timestamp (in seconds) of when the API key was last used.
-
name: stringThe name of the API key
-
object: "organization.project.api_key"The object type, which is always
organization.project.api_key"organization.project.api_key"
-
owner: object { service_account, type, user }-
service_account: optional object { id, created_at, name, role }The service account that owns a project API key.
-
id: stringThe identifier, which can be referenced in API endpoints
-
created_at: numberThe Unix timestamp (in seconds) of when the service account was created.
-
name: stringThe name of the service account.
-
role: stringThe service account's project role.
-
-
type: optional "user" or "service_account"userorservice_account-
"user" -
"service_account"
-
-
user: optional object { id, created_at, email, 2 more }The user that owns a project API key.
-
id: stringThe identifier, which can be referenced in API endpoints
-
created_at: numberThe Unix timestamp (in seconds) of when the user was created.
-
email: stringThe email address of the user.
-
name: stringThe name of the user.
-
role: stringThe user's project role.
-
-
-
redacted_value: stringThe redacted value of the API key
-
-
has_more: boolean -
object: "list""list"
-
first_id: optional string -
last_id: optional string
Example
curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/api_keys \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"data": [
{
"id": "id",
"created_at": 0,
"last_used_at": 0,
"name": "name",
"object": "organization.project.api_key",
"owner": {
"service_account": {
"id": "id",
"created_at": 0,
"name": "name",
"role": "role"
},
"type": "user",
"user": {
"id": "id",
"created_at": 0,
"email": "email",
"name": "name",
"role": "role"
}
},
"redacted_value": "redacted_value"
}
],
"has_more": true,
"object": "list",
"first_id": "first_id",
"last_id": "last_id"
}
Example
curl https://api.openai.com/v1/organization/projects/proj_abc/api_keys?after=key_abc&limit=20 \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "list",
"data": [
{
"object": "organization.project.api_key",
"redacted_value": "sk-abc...def",
"name": "My API Key",
"created_at": 1711471533,
"last_used_at": 1711471534,
"id": "key_abc",
"owner": {
"type": "user",
"user": {
"id": "user_abc",
"name": "First Last",
"email": "user@example.com",
"role": "owner",
"created_at": 1711471533
}
}
}
],
"first_id": "key_abc",
"last_id": "key_xyz",
"has_more": false
}
Retrieve project API key
get /organization/projects/{project_id}/api_keys/{api_key_id}
Retrieve project API key
Path Parameters
-
project_id: string -
api_key_id: string
Returns
-
ProjectAPIKey object { id, created_at, last_used_at, 4 more }Represents an individual API key in a project.
-
id: stringThe identifier, which can be referenced in API endpoints
-
created_at: numberThe Unix timestamp (in seconds) of when the API key was created
-
last_used_at: numberThe Unix timestamp (in seconds) of when the API key was last used.
-
name: stringThe name of the API key
-
object: "organization.project.api_key"The object type, which is always
organization.project.api_key"organization.project.api_key"
-
owner: object { service_account, type, user }-
service_account: optional object { id, created_at, name, role }The service account that owns a project API key.
-
id: stringThe identifier, which can be referenced in API endpoints
-
created_at: numberThe Unix timestamp (in seconds) of when the service account was created.
-
name: stringThe name of the service account.
-
role: stringThe service account's project role.
-
-
type: optional "user" or "service_account"userorservice_account-
"user" -
"service_account"
-
-
user: optional object { id, created_at, email, 2 more }The user that owns a project API key.
-
id: stringThe identifier, which can be referenced in API endpoints
-
created_at: numberThe Unix timestamp (in seconds) of when the user was created.
-
email: stringThe email address of the user.
-
name: stringThe name of the user.
-
role: stringThe user's project role.
-
-
-
redacted_value: stringThe redacted value of the API key
-
Example
curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/api_keys/$API_KEY_ID \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"id": "id",
"created_at": 0,
"last_used_at": 0,
"name": "name",
"object": "organization.project.api_key",
"owner": {
"service_account": {
"id": "id",
"created_at": 0,
"name": "name",
"role": "role"
},
"type": "user",
"user": {
"id": "id",
"created_at": 0,
"email": "email",
"name": "name",
"role": "role"
}
},
"redacted_value": "redacted_value"
}
Example
curl https://api.openai.com/v1/organization/projects/proj_abc/api_keys/key_abc \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "organization.project.api_key",
"redacted_value": "sk-abc...def",
"name": "My API Key",
"created_at": 1711471533,
"last_used_at": 1711471534,
"id": "key_abc",
"owner": {
"type": "user",
"user": {
"id": "user_abc",
"name": "First Last",
"email": "user@example.com",
"role": "owner",
"created_at": 1711471533
}
}
}
Delete project API key
delete /organization/projects/{project_id}/api_keys/{api_key_id}
Delete project API key
Path Parameters
-
project_id: string -
api_key_id: string
Returns
-
id: string -
deleted: boolean -
object: "organization.project.api_key.deleted""organization.project.api_key.deleted"
Example
curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/api_keys/$API_KEY_ID \
-X DELETE \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"id": "id",
"deleted": true,
"object": "organization.project.api_key.deleted"
}
Example
curl -X DELETE https://api.openai.com/v1/organization/projects/proj_abc/api_keys/key_abc \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "organization.project.api_key.deleted",
"id": "key_abc",
"deleted": true
}
Domain Types
Project API Key
-
ProjectAPIKey object { id, created_at, last_used_at, 4 more }Represents an individual API key in a project.
-
id: stringThe identifier, which can be referenced in API endpoints
-
created_at: numberThe Unix timestamp (in seconds) of when the API key was created
-
last_used_at: numberThe Unix timestamp (in seconds) of when the API key was last used.
-
name: stringThe name of the API key
-
object: "organization.project.api_key"The object type, which is always
organization.project.api_key"organization.project.api_key"
-
owner: object { service_account, type, user }-
service_account: optional object { id, created_at, name, role }The service account that owns a project API key.
-
id: stringThe identifier, which can be referenced in API endpoints
-
created_at: numberThe Unix timestamp (in seconds) of when the service account was created.
-
name: stringThe name of the service account.
-
role: stringThe service account's project role.
-
-
type: optional "user" or "service_account"userorservice_account-
"user" -
"service_account"
-
-
user: optional object { id, created_at, email, 2 more }The user that owns a project API key.
-
id: stringThe identifier, which can be referenced in API endpoints
-
created_at: numberThe Unix timestamp (in seconds) of when the user was created.
-
email: stringThe email address of the user.
-
name: stringThe name of the user.
-
role: stringThe user's project role.
-
-
-
redacted_value: stringThe redacted value of the API key
-
API Key Delete Response
-
APIKeyDeleteResponse object { id, deleted, object }-
id: string -
deleted: boolean -
object: "organization.project.api_key.deleted""organization.project.api_key.deleted"
-
Rate Limits
List project rate limits
get /organization/projects/{project_id}/rate_limits
List project rate limits
Path Parameters
project_id: string
Query Parameters
-
after: optional stringA cursor for use in pagination.
afteris an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. -
before: optional stringA cursor for use in pagination.
beforeis an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, beginning with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. -
limit: optional numberA limit on the number of objects to be returned. The default is 100.
Returns
-
data: array of ProjectRateLimit-
id: stringThe identifier, which can be referenced in API endpoints.
-
max_requests_per_1_minute: numberThe maximum requests per minute.
-
max_tokens_per_1_minute: numberThe maximum tokens per minute.
-
model: stringThe model this rate limit applies to.
-
object: "project.rate_limit"The object type, which is always
project.rate_limit"project.rate_limit"
-
batch_1_day_max_input_tokens: optional numberThe maximum batch input tokens per day. Only present for relevant models.
-
max_audio_megabytes_per_1_minute: optional numberThe maximum audio megabytes per minute. Only present for relevant models.
-
max_images_per_1_minute: optional numberThe maximum images per minute. Only present for relevant models.
-
max_requests_per_1_day: optional numberThe maximum requests per day. Only present for relevant models.
-
-
has_more: boolean -
object: "list""list"
-
first_id: optional string -
last_id: optional string
Example
curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/rate_limits \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"data": [
{
"id": "id",
"max_requests_per_1_minute": 0,
"max_tokens_per_1_minute": 0,
"model": "model",
"object": "project.rate_limit",
"batch_1_day_max_input_tokens": 0,
"max_audio_megabytes_per_1_minute": 0,
"max_images_per_1_minute": 0,
"max_requests_per_1_day": 0
}
],
"has_more": true,
"object": "list",
"first_id": "first_id",
"last_id": "last_id"
}
Example
curl https://api.openai.com/v1/organization/projects/proj_abc/rate_limits?after=rl_xxx&limit=20 \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "list",
"data": [
{
"object": "project.rate_limit",
"id": "rl-ada",
"model": "ada",
"max_requests_per_1_minute": 600,
"max_tokens_per_1_minute": 150000,
"max_images_per_1_minute": 10
}
],
"first_id": "rl-ada",
"last_id": "rl-ada",
"has_more": false
}
Modify project rate limit
post /organization/projects/{project_id}/rate_limits/{rate_limit_id}
Modify project rate limit
Path Parameters
-
project_id: string -
rate_limit_id: string
Body Parameters
-
batch_1_day_max_input_tokens: optional numberThe maximum batch input tokens per day. Only relevant for certain models.
-
max_audio_megabytes_per_1_minute: optional numberThe maximum audio megabytes per minute. Only relevant for certain models.
-
max_images_per_1_minute: optional numberThe maximum images per minute. Only relevant for certain models.
-
max_requests_per_1_day: optional numberThe maximum requests per day. Only relevant for certain models.
-
max_requests_per_1_minute: optional numberThe maximum requests per minute.
-
max_tokens_per_1_minute: optional numberThe maximum tokens per minute.
Returns
-
ProjectRateLimit object { id, max_requests_per_1_minute, max_tokens_per_1_minute, 6 more }Represents a project rate limit config.
-
id: stringThe identifier, which can be referenced in API endpoints.
-
max_requests_per_1_minute: numberThe maximum requests per minute.
-
max_tokens_per_1_minute: numberThe maximum tokens per minute.
-
model: stringThe model this rate limit applies to.
-
object: "project.rate_limit"The object type, which is always
project.rate_limit"project.rate_limit"
-
batch_1_day_max_input_tokens: optional numberThe maximum batch input tokens per day. Only present for relevant models.
-
max_audio_megabytes_per_1_minute: optional numberThe maximum audio megabytes per minute. Only present for relevant models.
-
max_images_per_1_minute: optional numberThe maximum images per minute. Only present for relevant models.
-
max_requests_per_1_day: optional numberThe maximum requests per day. Only present for relevant models.
-
Example
curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/rate_limits/$RATE_LIMIT_ID \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-d '{}'
Response
{
"id": "id",
"max_requests_per_1_minute": 0,
"max_tokens_per_1_minute": 0,
"model": "model",
"object": "project.rate_limit",
"batch_1_day_max_input_tokens": 0,
"max_audio_megabytes_per_1_minute": 0,
"max_images_per_1_minute": 0,
"max_requests_per_1_day": 0
}
Example
curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/rate_limits/rl_xxx \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"max_requests_per_1_minute": 500
}'
Response
{
"object": "project.rate_limit",
"id": "rl-ada",
"model": "ada",
"max_requests_per_1_minute": 600,
"max_tokens_per_1_minute": 150000,
"max_images_per_1_minute": 10
}
Domain Types
Project Rate Limit
-
ProjectRateLimit object { id, max_requests_per_1_minute, max_tokens_per_1_minute, 6 more }Represents a project rate limit config.
-
id: stringThe identifier, which can be referenced in API endpoints.
-
max_requests_per_1_minute: numberThe maximum requests per minute.
-
max_tokens_per_1_minute: numberThe maximum tokens per minute.
-
model: stringThe model this rate limit applies to.
-
object: "project.rate_limit"The object type, which is always
project.rate_limit"project.rate_limit"
-
batch_1_day_max_input_tokens: optional numberThe maximum batch input tokens per day. Only present for relevant models.
-
max_audio_megabytes_per_1_minute: optional numberThe maximum audio megabytes per minute. Only present for relevant models.
-
max_images_per_1_minute: optional numberThe maximum images per minute. Only present for relevant models.
-
max_requests_per_1_day: optional numberThe maximum requests per day. Only present for relevant models.
-
Model Permissions
Retrieve project model permissions
get /organization/projects/{project_id}/model_permissions
Retrieve project model permissions
Path Parameters
project_id: string
Returns
-
ProjectModelPermissions object { mode, model_ids, object }Represents the model allowlist or denylist policy for a project.
-
mode: "allow_list" or "deny_list"Whether the project uses an allowlist or a denylist.
-
"allow_list" -
"deny_list"
-
-
model_ids: array of stringThe model IDs included in the model permissions policy.
-
object: "project.model_permissions"The object type, which is always
project.model_permissions."project.model_permissions"
-
Example
curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/model_permissions \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"mode": "allow_list",
"model_ids": [
"string"
],
"object": "project.model_permissions"
}
Example
curl https://api.openai.com/v1/organization/projects/proj_abc/model_permissions \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "project.model_permissions",
"mode": "allow_list",
"model_ids": [
"gpt-4.1",
"o3"
]
}
Modify project model permissions
post /organization/projects/{project_id}/model_permissions
Modify project model permissions
Path Parameters
project_id: string
Body Parameters
-
mode: "allow_list" or "deny_list"The model permissions mode to apply.
-
"allow_list" -
"deny_list"
-
-
model_ids: array of stringThe model IDs included in this permissions policy.
Returns
-
ProjectModelPermissions object { mode, model_ids, object }Represents the model allowlist or denylist policy for a project.
-
mode: "allow_list" or "deny_list"Whether the project uses an allowlist or a denylist.
-
"allow_list" -
"deny_list"
-
-
model_ids: array of stringThe model IDs included in the model permissions policy.
-
object: "project.model_permissions"The object type, which is always
project.model_permissions."project.model_permissions"
-
Example
curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/model_permissions \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-d '{
"mode": "allow_list",
"model_ids": [
"string"
]
}'
Response
{
"mode": "allow_list",
"model_ids": [
"string"
],
"object": "project.model_permissions"
}
Example
curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/model_permissions \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"mode": "deny_list",
"model_ids": [
"o3"
]
}'
Response
{
"object": "project.model_permissions",
"mode": "deny_list",
"model_ids": [
"o3"
]
}
Delete project model permissions
delete /organization/projects/{project_id}/model_permissions
Delete project model permissions
Path Parameters
project_id: string
Returns
-
ProjectModelPermissionsDeleted object { deleted, object }Confirmation payload returned after deleting project model permissions.
-
deleted: booleanWhether the project model permissions were deleted.
-
object: "project.model_permissions.deleted"The object type, which is always
project.model_permissions.deleted."project.model_permissions.deleted"
-
Example
curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/model_permissions \
-X DELETE \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"deleted": true,
"object": "project.model_permissions.deleted"
}
Example
curl -X DELETE https://api.openai.com/v1/organization/projects/proj_abc/model_permissions \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "project.model_permissions.deleted",
"deleted": true
}
Domain Types
Project Model Permissions
-
ProjectModelPermissions object { mode, model_ids, object }Represents the model allowlist or denylist policy for a project.
-
mode: "allow_list" or "deny_list"Whether the project uses an allowlist or a denylist.
-
"allow_list" -
"deny_list"
-
-
model_ids: array of stringThe model IDs included in the model permissions policy.
-
object: "project.model_permissions"The object type, which is always
project.model_permissions."project.model_permissions"
-
Project Model Permissions Deleted
-
ProjectModelPermissionsDeleted object { deleted, object }Confirmation payload returned after deleting project model permissions.
-
deleted: booleanWhether the project model permissions were deleted.
-
object: "project.model_permissions.deleted"The object type, which is always
project.model_permissions.deleted."project.model_permissions.deleted"
-
Hosted Tool Permissions
Retrieve project hosted tool permissions
get /organization/projects/{project_id}/hosted_tool_permissions
Retrieve project hosted tool permissions
Path Parameters
project_id: string
Returns
-
ProjectHostedToolPermissions object { code_interpreter, file_search, image_generation, 2 more }Represents hosted tool permissions for a project.
-
code_interpreter: object { enabled }Permission state for a single hosted tool on a project.
-
enabled: booleanWhether the hosted tool is enabled for the project.
-
-
file_search: object { enabled }Permission state for a single hosted tool on a project.
-
enabled: booleanWhether the hosted tool is enabled for the project.
-
-
image_generation: object { enabled }Permission state for a single hosted tool on a project.
-
enabled: booleanWhether the hosted tool is enabled for the project.
-
-
mcp: object { enabled }Permission state for a single hosted tool on a project.
-
enabled: booleanWhether the hosted tool is enabled for the project.
-
-
web_search: object { enabled }Permission state for a single hosted tool on a project.
-
enabled: booleanWhether the hosted tool is enabled for the project.
-
-
Example
curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/hosted_tool_permissions \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"code_interpreter": {
"enabled": true
},
"file_search": {
"enabled": true
},
"image_generation": {
"enabled": true
},
"mcp": {
"enabled": true
},
"web_search": {
"enabled": true
}
}
Example
curl https://api.openai.com/v1/organization/projects/proj_abc/hosted_tool_permissions \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"file_search": {
"enabled": true
},
"web_search": {
"enabled": true
},
"image_generation": {
"enabled": true
},
"mcp": {
"enabled": true
},
"code_interpreter": {
"enabled": true
}
}
Modify project hosted tool permissions
post /organization/projects/{project_id}/hosted_tool_permissions
Modify project hosted tool permissions
Path Parameters
project_id: string
Body Parameters
-
code_interpreter: optional object { enabled }The code interpreter permission update.
-
enabled: booleanWhether to enable the hosted tool for the project.
-
-
file_search: optional object { enabled }The file search permission update.
-
enabled: booleanWhether to enable the hosted tool for the project.
-
-
image_generation: optional object { enabled }The image generation permission update.
-
enabled: booleanWhether to enable the hosted tool for the project.
-
-
mcp: optional object { enabled }The MCP permission update.
-
enabled: booleanWhether to enable the hosted tool for the project.
-
-
web_search: optional object { enabled }The web search permission update.
-
enabled: booleanWhether to enable the hosted tool for the project.
-
Returns
-
ProjectHostedToolPermissions object { code_interpreter, file_search, image_generation, 2 more }Represents hosted tool permissions for a project.
-
code_interpreter: object { enabled }Permission state for a single hosted tool on a project.
-
enabled: booleanWhether the hosted tool is enabled for the project.
-
-
file_search: object { enabled }Permission state for a single hosted tool on a project.
-
enabled: booleanWhether the hosted tool is enabled for the project.
-
-
image_generation: object { enabled }Permission state for a single hosted tool on a project.
-
enabled: booleanWhether the hosted tool is enabled for the project.
-
-
mcp: object { enabled }Permission state for a single hosted tool on a project.
-
enabled: booleanWhether the hosted tool is enabled for the project.
-
-
web_search: object { enabled }Permission state for a single hosted tool on a project.
-
enabled: booleanWhether the hosted tool is enabled for the project.
-
-
Example
curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/hosted_tool_permissions \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-d '{}'
Response
{
"code_interpreter": {
"enabled": true
},
"file_search": {
"enabled": true
},
"image_generation": {
"enabled": true
},
"mcp": {
"enabled": true
},
"web_search": {
"enabled": true
}
}
Example
curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/hosted_tool_permissions \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"file_search": {
"enabled": true
},
"image_generation": {
"enabled": false
}
}'
Response
{
"file_search": {
"enabled": true
},
"web_search": {
"enabled": true
},
"image_generation": {
"enabled": false
},
"mcp": {
"enabled": true
},
"code_interpreter": {
"enabled": true
}
}
Domain Types
Project Hosted Tool Permissions
-
ProjectHostedToolPermissions object { code_interpreter, file_search, image_generation, 2 more }Represents hosted tool permissions for a project.
-
code_interpreter: object { enabled }Permission state for a single hosted tool on a project.
-
enabled: booleanWhether the hosted tool is enabled for the project.
-
-
file_search: object { enabled }Permission state for a single hosted tool on a project.
-
enabled: booleanWhether the hosted tool is enabled for the project.
-
-
image_generation: object { enabled }Permission state for a single hosted tool on a project.
-
enabled: booleanWhether the hosted tool is enabled for the project.
-
-
mcp: object { enabled }Permission state for a single hosted tool on a project.
-
enabled: booleanWhether the hosted tool is enabled for the project.
-
-
web_search: object { enabled }Permission state for a single hosted tool on a project.
-
enabled: booleanWhether the hosted tool is enabled for the project.
-
-
Groups
List project groups
get /organization/projects/{project_id}/groups
List project groups
Path Parameters
project_id: string
Query Parameters
-
after: optional stringCursor for pagination. Provide the ID of the last group from the previous response to fetch the next page.
-
limit: optional numberA limit on the number of project groups to return. Defaults to 20.
-
order: optional "asc" or "desc"Sort order for the returned groups.
-
"asc" -
"desc"
-
Returns
-
data: array of ProjectGroupProject group memberships returned in the current page.
-
created_at: numberUnix timestamp (in seconds) when the group was granted project access.
-
group_id: stringIdentifier of the group that has access to the project.
-
group_name: stringDisplay name of the group.
-
group_type: "group" or "tenant_group"The type of the group.
-
"group" -
"tenant_group"
-
-
object: "project.group"Always
project.group."project.group"
-
project_id: stringIdentifier of the project.
-
-
has_more: booleanWhether additional project group memberships are available.
-
next: stringCursor to fetch the next page of results, or
nullwhen there are no more results. -
object: "list"Always
list."list"
Example
curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/groups \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"data": [
{
"created_at": 0,
"group_id": "group_id",
"group_name": "group_name",
"group_type": "group",
"object": "project.group",
"project_id": "project_id"
}
],
"has_more": true,
"next": "next",
"object": "list"
}
Example
curl https://api.openai.com/v1/organization/projects/proj_abc123/groups?limit=20 \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "list",
"data": [
{
"object": "project.group",
"project_id": "proj_abc123",
"group_id": "group_01J1F8ABCDXYZ",
"group_name": "Support Team",
"created_at": 1711471533
}
],
"has_more": false,
"next": null
}
Add project group
post /organization/projects/{project_id}/groups
Add project group
Path Parameters
project_id: string
Body Parameters
-
group_id: stringIdentifier of the group to add to the project.
-
role: stringIdentifier of the project role to grant to the group.
Returns
-
ProjectGroup object { created_at, group_id, group_name, 3 more }Details about a group's membership in a project.
-
created_at: numberUnix timestamp (in seconds) when the group was granted project access.
-
group_id: stringIdentifier of the group that has access to the project.
-
group_name: stringDisplay name of the group.
-
group_type: "group" or "tenant_group"The type of the group.
-
"group" -
"tenant_group"
-
-
object: "project.group"Always
project.group."project.group"
-
project_id: stringIdentifier of the project.
-
Example
curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/groups \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-d '{
"group_id": "group_id",
"role": "role"
}'
Response
{
"created_at": 0,
"group_id": "group_id",
"group_name": "group_name",
"group_type": "group",
"object": "project.group",
"project_id": "project_id"
}
Example
curl -X POST https://api.openai.com/v1/organization/projects/proj_abc123/groups \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"group_id": "group_01J1F8ABCDXYZ",
"role": "role_01J1F8PROJ"
}'
Response
{
"object": "project.group",
"project_id": "proj_abc123",
"group_id": "group_01J1F8ABCDXYZ",
"group_name": "Support Team",
"created_at": 1711471533
}
Retrieve project group
get /organization/projects/{project_id}/groups/{group_id}
Retrieve project group
Path Parameters
-
project_id: string -
group_id: string
Query Parameters
-
group_type: optional "group" or "tenant_group"The type of group to retrieve.
-
"group" -
"tenant_group"
-
Returns
-
ProjectGroup object { created_at, group_id, group_name, 3 more }Details about a group's membership in a project.
-
created_at: numberUnix timestamp (in seconds) when the group was granted project access.
-
group_id: stringIdentifier of the group that has access to the project.
-
group_name: stringDisplay name of the group.
-
group_type: "group" or "tenant_group"The type of the group.
-
"group" -
"tenant_group"
-
-
object: "project.group"Always
project.group."project.group"
-
project_id: stringIdentifier of the project.
-
Example
curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/groups/$GROUP_ID \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"created_at": 0,
"group_id": "group_id",
"group_name": "group_name",
"group_type": "group",
"object": "project.group",
"project_id": "project_id"
}
Example
curl https://api.openai.com/v1/organization/projects/proj_abc123/groups/group_01J1F8ABCDXYZ \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "project.group",
"project_id": "proj_abc123",
"group_id": "group_01J1F8ABCDXYZ",
"group_name": "Support Team",
"group_type": "group",
"created_at": 1711471533
}
Remove project group
delete /organization/projects/{project_id}/groups/{group_id}
Remove project group
Path Parameters
-
project_id: string -
group_id: string
Returns
-
deleted: booleanWhether the group membership in the project was removed.
-
object: "project.group.deleted"Always
project.group.deleted."project.group.deleted"
Example
curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/groups/$GROUP_ID \
-X DELETE \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"deleted": true,
"object": "project.group.deleted"
}
Example
curl -X DELETE https://api.openai.com/v1/organization/projects/proj_abc123/groups/group_01J1F8ABCDXYZ \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "project.group.deleted",
"deleted": true
}
Domain Types
Project Group
-
ProjectGroup object { created_at, group_id, group_name, 3 more }Details about a group's membership in a project.
-
created_at: numberUnix timestamp (in seconds) when the group was granted project access.
-
group_id: stringIdentifier of the group that has access to the project.
-
group_name: stringDisplay name of the group.
-
group_type: "group" or "tenant_group"The type of the group.
-
"group" -
"tenant_group"
-
-
object: "project.group"Always
project.group."project.group"
-
project_id: stringIdentifier of the project.
-
Group Delete Response
-
GroupDeleteResponse object { deleted, object }Confirmation payload returned after removing a group from a project.
-
deleted: booleanWhether the group membership in the project was removed.
-
object: "project.group.deleted"Always
project.group.deleted."project.group.deleted"
-
Roles
List project group role assignments
get /projects/{project_id}/groups/{group_id}/roles
List project group role assignments
Path Parameters
-
project_id: string -
group_id: string
Query Parameters
-
after: optional stringCursor for pagination. Provide the value from the previous response's
nextfield to continue listing project roles. -
limit: optional numberA limit on the number of project role assignments to return.
-
order: optional "asc" or "desc"Sort order for the returned project roles.
-
"asc" -
"desc"
-
Returns
-
data: array of object { id, assignment_sources, created_at, 9 more }Role assignments returned in the current page.
-
id: stringIdentifier for the role.
-
assignment_sources: array of object { principal_id, principal_type }Principals from which the role assignment is inherited, when available.
-
principal_id: string -
principal_type: string
-
-
created_at: numberWhen the role was created.
-
created_by: stringIdentifier of the actor who created the role.
-
created_by_user_obj: map[unknown]User details for the actor that created the role, when available.
-
description: stringDescription of the role.
-
metadata: map[unknown]Arbitrary metadata stored on the role.
-
name: stringName of the role.
-
permissions: array of stringPermissions associated with the role.
-
predefined_role: booleanWhether the role is predefined by OpenAI.
-
resource_type: stringResource type the role applies to.
-
updated_at: numberWhen the role was last updated.
-
-
has_more: booleanWhether additional assignments are available when paginating.
-
next: stringCursor to fetch the next page of results, or
nullwhen there are no more assignments. -
object: "list"Always
list."list"
Example
curl https://api.openai.com/v1/projects/$PROJECT_ID/groups/$GROUP_ID/roles \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"data": [
{
"id": "id",
"assignment_sources": [
{
"principal_id": "principal_id",
"principal_type": "principal_type"
}
],
"created_at": 0,
"created_by": "created_by",
"created_by_user_obj": {
"foo": "bar"
},
"description": "description",
"metadata": {
"foo": "bar"
},
"name": "name",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type",
"updated_at": 0
}
],
"has_more": true,
"next": "next",
"object": "list"
}
Example
curl https://api.openai.com/v1/projects/proj_abc123/groups/group_01J1F8ABCDXYZ/roles \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "list",
"data": [
{
"id": "role_01J1F8PROJ",
"name": "API Project Key Manager",
"permissions": [
"api.organization.projects.api_keys.read",
"api.organization.projects.api_keys.write"
],
"resource_type": "api.project",
"predefined_role": false,
"description": "Allows managing API keys for the project",
"created_at": 1711471533,
"updated_at": 1711472599,
"created_by": "user_abc123",
"created_by_user_obj": {
"id": "user_abc123",
"name": "Ada Lovelace",
"email": "ada@example.com"
},
"metadata": {}
}
],
"has_more": false,
"next": null
}
Assign project role to group
post /projects/{project_id}/groups/{group_id}/roles
Assign project role to group
Path Parameters
-
project_id: string -
group_id: string
Body Parameters
-
role_id: stringIdentifier of the role to assign.
Returns
-
group: object { id, created_at, name, 2 more }Summary information about a group returned in role assignment responses.
-
id: stringIdentifier for the group.
-
created_at: numberUnix timestamp (in seconds) when the group was created.
-
name: stringDisplay name of the group.
-
object: "group"Always
group."group"
-
scim_managed: booleanWhether the group is managed through SCIM.
-
-
object: "group.role"Always
group.role."group.role"
-
role: RoleDetails about a role that can be assigned through the public Roles API.
-
id: stringIdentifier for the role.
-
description: stringOptional description of the role.
-
name: stringUnique name for the role.
-
object: "role"Always
role."role"
-
permissions: array of stringPermissions granted by the role.
-
predefined_role: booleanWhether the role is predefined and managed by OpenAI.
-
resource_type: stringResource type the role is bound to (for example
api.organizationorapi.project).
-
Example
curl https://api.openai.com/v1/projects/$PROJECT_ID/groups/$GROUP_ID/roles \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-d '{
"role_id": "role_id"
}'
Response
{
"group": {
"id": "id",
"created_at": 0,
"name": "name",
"object": "group",
"scim_managed": true
},
"object": "group.role",
"role": {
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
}
}
Example
curl -X POST https://api.openai.com/v1/projects/proj_abc123/groups/group_01J1F8ABCDXYZ/roles \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"role_id": "role_01J1F8PROJ"
}'
Response
{
"object": "group.role",
"group": {
"object": "group",
"id": "group_01J1F8ABCDXYZ",
"name": "Support Team",
"created_at": 1711471533,
"scim_managed": false
},
"role": {
"object": "role",
"id": "role_01J1F8PROJ",
"name": "API Project Key Manager",
"description": "Allows managing API keys for the project",
"permissions": [
"api.organization.projects.api_keys.read",
"api.organization.projects.api_keys.write"
],
"resource_type": "api.project",
"predefined_role": false
}
}
Retrieve project group role
get /projects/{project_id}/groups/{group_id}/roles/{role_id}
Retrieve project group role
Path Parameters
-
project_id: string -
group_id: string -
role_id: string
Returns
-
id: stringIdentifier for the role.
-
assignment_sources: array of object { principal_id, principal_type }Principals from which the role assignment is inherited, when available.
-
principal_id: string -
principal_type: string
-
-
created_at: numberWhen the role was created.
-
created_by: stringIdentifier of the actor who created the role.
-
created_by_user_obj: map[unknown]User details for the actor that created the role, when available.
-
description: stringDescription of the role.
-
metadata: map[unknown]Arbitrary metadata stored on the role.
-
name: stringName of the role.
-
permissions: array of stringPermissions associated with the role.
-
predefined_role: booleanWhether the role is predefined by OpenAI.
-
resource_type: stringResource type the role applies to.
-
updated_at: numberWhen the role was last updated.
Example
curl https://api.openai.com/v1/projects/$PROJECT_ID/groups/$GROUP_ID/roles/$ROLE_ID \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"id": "id",
"assignment_sources": [
{
"principal_id": "principal_id",
"principal_type": "principal_type"
}
],
"created_at": 0,
"created_by": "created_by",
"created_by_user_obj": {
"foo": "bar"
},
"description": "description",
"metadata": {
"foo": "bar"
},
"name": "name",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type",
"updated_at": 0
}
Example
curl https://api.openai.com/v1/projects/proj_abc123/groups/group_01J1F8ABCDXYZ/roles/role_01J1F8PROJ \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"id": "role_01J1F8PROJ",
"name": "API Project Key Manager",
"permissions": [
"api.organization.projects.api_keys.read",
"api.organization.projects.api_keys.write"
],
"resource_type": "api.project",
"predefined_role": false,
"description": "Allows managing API keys for the project",
"created_at": 1711471533,
"updated_at": 1711472599,
"created_by": "user_abc123",
"created_by_user_obj": null,
"metadata": {},
"assignment_sources": null
}
Unassign project role from group
delete /projects/{project_id}/groups/{group_id}/roles/{role_id}
Unassign project role from group
Path Parameters
-
project_id: string -
group_id: string -
role_id: string
Returns
-
deleted: booleanWhether the assignment was removed.
-
object: stringIdentifier for the deleted assignment, such as
group.role.deletedoruser.role.deleted.
Example
curl https://api.openai.com/v1/projects/$PROJECT_ID/groups/$GROUP_ID/roles/$ROLE_ID \
-X DELETE \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"deleted": true,
"object": "object"
}
Example
curl -X DELETE https://api.openai.com/v1/projects/proj_abc123/groups/group_01J1F8ABCDXYZ/roles/role_01J1F8PROJ \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "group.role.deleted",
"deleted": true
}
Domain Types
Role List Response
-
RoleListResponse object { id, assignment_sources, created_at, 9 more }Detailed information about a role assignment entry returned when listing assignments.
-
id: stringIdentifier for the role.
-
assignment_sources: array of object { principal_id, principal_type }Principals from which the role assignment is inherited, when available.
-
principal_id: string -
principal_type: string
-
-
created_at: numberWhen the role was created.
-
created_by: stringIdentifier of the actor who created the role.
-
created_by_user_obj: map[unknown]User details for the actor that created the role, when available.
-
description: stringDescription of the role.
-
metadata: map[unknown]Arbitrary metadata stored on the role.
-
name: stringName of the role.
-
permissions: array of stringPermissions associated with the role.
-
predefined_role: booleanWhether the role is predefined by OpenAI.
-
resource_type: stringResource type the role applies to.
-
updated_at: numberWhen the role was last updated.
-
Role Create Response
-
RoleCreateResponse object { group, object, role }Role assignment linking a group to a role.
-
group: object { id, created_at, name, 2 more }Summary information about a group returned in role assignment responses.
-
id: stringIdentifier for the group.
-
created_at: numberUnix timestamp (in seconds) when the group was created.
-
name: stringDisplay name of the group.
-
object: "group"Always
group."group"
-
scim_managed: booleanWhether the group is managed through SCIM.
-
-
object: "group.role"Always
group.role."group.role"
-
role: RoleDetails about a role that can be assigned through the public Roles API.
-
id: stringIdentifier for the role.
-
description: stringOptional description of the role.
-
name: stringUnique name for the role.
-
object: "role"Always
role."role"
-
permissions: array of stringPermissions granted by the role.
-
predefined_role: booleanWhether the role is predefined and managed by OpenAI.
-
resource_type: stringResource type the role is bound to (for example
api.organizationorapi.project).
-
-
Role Retrieve Response
-
RoleRetrieveResponse object { id, assignment_sources, created_at, 9 more }Detailed information about a role assignment entry returned when listing assignments.
-
id: stringIdentifier for the role.
-
assignment_sources: array of object { principal_id, principal_type }Principals from which the role assignment is inherited, when available.
-
principal_id: string -
principal_type: string
-
-
created_at: numberWhen the role was created.
-
created_by: stringIdentifier of the actor who created the role.
-
created_by_user_obj: map[unknown]User details for the actor that created the role, when available.
-
description: stringDescription of the role.
-
metadata: map[unknown]Arbitrary metadata stored on the role.
-
name: stringName of the role.
-
permissions: array of stringPermissions associated with the role.
-
predefined_role: booleanWhether the role is predefined by OpenAI.
-
resource_type: stringResource type the role applies to.
-
updated_at: numberWhen the role was last updated.
-
Role Delete Response
-
RoleDeleteResponse object { deleted, object }Confirmation payload returned after unassigning a role.
-
deleted: booleanWhether the assignment was removed.
-
object: stringIdentifier for the deleted assignment, such as
group.role.deletedoruser.role.deleted.
-
Roles
List project roles
get /projects/{project_id}/roles
List project roles
Path Parameters
project_id: string
Query Parameters
-
after: optional stringCursor for pagination. Provide the value from the previous response's
nextfield to continue listing roles. -
limit: optional numberA limit on the number of roles to return. Defaults to 1000.
-
order: optional "asc" or "desc"Sort order for the returned roles.
-
"asc" -
"desc"
-
Returns
-
data: array of RoleRoles returned in the current page.
-
id: stringIdentifier for the role.
-
description: stringOptional description of the role.
-
name: stringUnique name for the role.
-
object: "role"Always
role."role"
-
permissions: array of stringPermissions granted by the role.
-
predefined_role: booleanWhether the role is predefined and managed by OpenAI.
-
resource_type: stringResource type the role is bound to (for example
api.organizationorapi.project).
-
-
has_more: booleanWhether more roles are available when paginating.
-
next: stringCursor to fetch the next page of results, or
nullwhen there are no additional roles. -
object: "list"Always
list."list"
Example
curl https://api.openai.com/v1/projects/$PROJECT_ID/roles \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"data": [
{
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
}
],
"has_more": true,
"next": "next",
"object": "list"
}
Example
curl https://api.openai.com/v1/projects/proj_abc123/roles?limit=20 \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "list",
"data": [
{
"object": "role",
"id": "role_01J1F8PROJ",
"name": "API Project Key Manager",
"description": "Allows managing API keys for the project",
"permissions": [
"api.organization.projects.api_keys.read",
"api.organization.projects.api_keys.write"
],
"resource_type": "api.project",
"predefined_role": false
}
],
"has_more": false,
"next": null
}
Create project role
post /projects/{project_id}/roles
Create project role
Path Parameters
project_id: string
Body Parameters
-
permissions: array of stringPermissions to grant to the role.
-
role_name: stringUnique name for the role.
-
description: optional stringOptional description of the role.
Returns
-
Role object { id, description, name, 4 more }Details about a role that can be assigned through the public Roles API.
-
id: stringIdentifier for the role.
-
description: stringOptional description of the role.
-
name: stringUnique name for the role.
-
object: "role"Always
role."role"
-
permissions: array of stringPermissions granted by the role.
-
predefined_role: booleanWhether the role is predefined and managed by OpenAI.
-
resource_type: stringResource type the role is bound to (for example
api.organizationorapi.project).
-
Example
curl https://api.openai.com/v1/projects/$PROJECT_ID/roles \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-d '{
"permissions": [
"string"
],
"role_name": "role_name"
}'
Response
{
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
}
Example
curl -X POST https://api.openai.com/v1/projects/proj_abc123/roles \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"role_name": "API Project Key Manager",
"permissions": [
"api.organization.projects.api_keys.read",
"api.organization.projects.api_keys.write"
],
"description": "Allows managing API keys for the project"
}'
Response
{
"object": "role",
"id": "role_01J1F8PROJ",
"name": "API Project Key Manager",
"description": "Allows managing API keys for the project",
"permissions": [
"api.organization.projects.api_keys.read",
"api.organization.projects.api_keys.write"
],
"resource_type": "api.project",
"predefined_role": false
}
Retrieve project role
get /projects/{project_id}/roles/{role_id}
Retrieve project role
Path Parameters
-
project_id: string -
role_id: string
Returns
-
Role object { id, description, name, 4 more }Details about a role that can be assigned through the public Roles API.
-
id: stringIdentifier for the role.
-
description: stringOptional description of the role.
-
name: stringUnique name for the role.
-
object: "role"Always
role."role"
-
permissions: array of stringPermissions granted by the role.
-
predefined_role: booleanWhether the role is predefined and managed by OpenAI.
-
resource_type: stringResource type the role is bound to (for example
api.organizationorapi.project).
-
Example
curl https://api.openai.com/v1/projects/$PROJECT_ID/roles/$ROLE_ID \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
}
Example
curl https://api.openai.com/v1/projects/proj_abc123/roles/role_01J1F8PROJ \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "role",
"id": "role_01J1F8PROJ",
"name": "API Project Key Manager",
"description": "Allows managing API keys for the project",
"permissions": [
"api.organization.projects.api_keys.read",
"api.organization.projects.api_keys.write"
],
"resource_type": "api.project",
"predefined_role": false
}
Update project role
post /projects/{project_id}/roles/{role_id}
Update project role
Path Parameters
-
project_id: string -
role_id: string
Body Parameters
-
description: optional stringNew description for the role.
-
permissions: optional array of stringUpdated set of permissions for the role.
-
role_name: optional stringNew name for the role.
Returns
-
Role object { id, description, name, 4 more }Details about a role that can be assigned through the public Roles API.
-
id: stringIdentifier for the role.
-
description: stringOptional description of the role.
-
name: stringUnique name for the role.
-
object: "role"Always
role."role"
-
permissions: array of stringPermissions granted by the role.
-
predefined_role: booleanWhether the role is predefined and managed by OpenAI.
-
resource_type: stringResource type the role is bound to (for example
api.organizationorapi.project).
-
Example
curl https://api.openai.com/v1/projects/$PROJECT_ID/roles/$ROLE_ID \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-d '{}'
Response
{
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
}
Example
curl -X POST https://api.openai.com/v1/projects/proj_abc123/roles/role_01J1F8PROJ \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"role_name": "API Project Key Manager",
"permissions": [
"api.organization.projects.api_keys.read",
"api.organization.projects.api_keys.write"
],
"description": "Allows managing API keys for the project"
}'
Response
{
"object": "role",
"id": "role_01J1F8PROJ",
"name": "API Project Key Manager",
"description": "Allows managing API keys for the project",
"permissions": [
"api.organization.projects.api_keys.read",
"api.organization.projects.api_keys.write"
],
"resource_type": "api.project",
"predefined_role": false
}
Delete project role
delete /projects/{project_id}/roles/{role_id}
Delete project role
Path Parameters
-
project_id: string -
role_id: string
Returns
-
id: stringIdentifier of the deleted role.
-
deleted: booleanWhether the role was deleted.
-
object: "role.deleted"Always
role.deleted."role.deleted"
Example
curl https://api.openai.com/v1/projects/$PROJECT_ID/roles/$ROLE_ID \
-X DELETE \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"id": "id",
"deleted": true,
"object": "role.deleted"
}
Example
curl -X DELETE https://api.openai.com/v1/projects/proj_abc123/roles/role_01J1F8PROJ \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "role.deleted",
"id": "role_01J1F8PROJ",
"deleted": true
}
Domain Types
Role Delete Response
-
RoleDeleteResponse object { id, deleted, object }Confirmation payload returned after deleting a role.
-
id: stringIdentifier of the deleted role.
-
deleted: booleanWhether the role was deleted.
-
object: "role.deleted"Always
role.deleted."role.deleted"
-
Data Retention
Retrieve project data retention
get /organization/projects/{project_id}/data_retention
Retrieve project data retention
Path Parameters
project_id: string
Returns
-
ProjectDataRetention object { object, type }Represents a project's data retention control setting.
-
object: "project.data_retention"The object type, which is always
project.data_retention."project.data_retention"
-
type: "organization_default" or "none" or "zero_data_retention" or 3 moreThe configured project data retention type.
-
"organization_default" -
"none" -
"zero_data_retention" -
"modified_abuse_monitoring" -
"enhanced_zero_data_retention" -
"enhanced_modified_abuse_monitoring"
-
-
Example
curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/data_retention \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"object": "project.data_retention",
"type": "organization_default"
}
Example
curl https://api.openai.com/v1/organization/projects/proj_abc/data_retention \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "project.data_retention",
"type": "organization_default"
}
Update project data retention
post /organization/projects/{project_id}/data_retention
Update project data retention
Path Parameters
project_id: string
Body Parameters
-
retention_type: "organization_default" or "none" or "zero_data_retention" or 3 moreThe desired project data retention type.
-
"organization_default" -
"none" -
"zero_data_retention" -
"modified_abuse_monitoring" -
"enhanced_zero_data_retention" -
"enhanced_modified_abuse_monitoring"
-
Returns
-
ProjectDataRetention object { object, type }Represents a project's data retention control setting.
-
object: "project.data_retention"The object type, which is always
project.data_retention."project.data_retention"
-
type: "organization_default" or "none" or "zero_data_retention" or 3 moreThe configured project data retention type.
-
"organization_default" -
"none" -
"zero_data_retention" -
"modified_abuse_monitoring" -
"enhanced_zero_data_retention" -
"enhanced_modified_abuse_monitoring"
-
-
Example
curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/data_retention \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-d '{
"retention_type": "organization_default"
}'
Response
{
"object": "project.data_retention",
"type": "organization_default"
}
Example
curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/data_retention \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"retention_type": "modified_abuse_monitoring"
}'
Response
{
"object": "project.data_retention",
"type": "modified_abuse_monitoring"
}
Domain Types
Project Data Retention
-
ProjectDataRetention object { object, type }Represents a project's data retention control setting.
-
object: "project.data_retention"The object type, which is always
project.data_retention."project.data_retention"
-
type: "organization_default" or "none" or "zero_data_retention" or 3 moreThe configured project data retention type.
-
"organization_default" -
"none" -
"zero_data_retention" -
"modified_abuse_monitoring" -
"enhanced_zero_data_retention" -
"enhanced_modified_abuse_monitoring"
-
-
Spend Alerts
List project spend alerts
get /organization/projects/{project_id}/spend_alerts
List project spend alerts
Path Parameters
project_id: string
Query Parameters
-
after: optional stringCursor for pagination. Provide the ID of the last spend alert from the previous response to fetch the next page.
-
before: optional stringCursor for pagination. Provide the ID of the first spend alert from the previous response to fetch the previous page.
-
limit: optional numberA limit on the number of spend alerts to return. Defaults to 20.
-
order: optional "asc" or "desc"Sort order for the returned spend alerts.
-
"asc" -
"desc"
-
Returns
-
data: array of ProjectSpendAlertSpend alerts returned in the current page.
-
id: stringThe identifier, which can be referenced in API endpoints.
-
currency: "USD"The currency for the threshold amount.
"USD"
-
interval: "month"The time interval for evaluating spend against the threshold.
"month"
-
notification_channel: object { recipients, type, subject_prefix }Email notification settings for a spend alert.
-
recipients: array of stringEmail addresses that receive the spend alert notification.
-
type: "email"The notification channel type. Currently only
emailis supported."email"
-
subject_prefix: optional stringOptional subject prefix for alert emails.
-
-
object: "project.spend_alert"The object type, which is always
project.spend_alert."project.spend_alert"
-
threshold_amount: numberThe alert threshold amount, in cents.
-
-
first_id: stringThe ID of the first spend alert in this page.
-
has_more: booleanWhether more spend alerts are available when paginating.
-
last_id: stringThe ID of the last spend alert in this page.
-
object: "list"Always
list."list"
Example
curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/spend_alerts \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"data": [
{
"id": "id",
"currency": "USD",
"interval": "month",
"notification_channel": {
"recipients": [
"string"
],
"type": "email",
"subject_prefix": "subject_prefix"
},
"object": "project.spend_alert",
"threshold_amount": 0
}
],
"first_id": "first_id",
"has_more": true,
"last_id": "last_id",
"object": "list"
}
Example
curl https://api.openai.com/v1/organization/projects/proj_abc/spend_alerts?limit=20&order=asc \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"object": "list",
"data": [
{
"id": "alert_abc123",
"object": "project.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
}
Create project spend alert
post /organization/projects/{project_id}/spend_alerts
Create project spend alert
Path Parameters
project_id: string
Body Parameters
-
currency: "USD"The currency for the threshold amount.
"USD"
-
interval: "month"The time interval for evaluating spend against the threshold.
"month"
-
notification_channel: object { recipients, type, subject_prefix }Email notification settings for a spend alert.
-
recipients: array of stringEmail addresses that receive the spend alert notification.
-
type: "email"The notification channel type. Currently only
emailis supported."email"
-
subject_prefix: optional stringOptional subject prefix for alert emails.
-
-
threshold_amount: numberThe alert threshold amount, in cents.
Returns
-
ProjectSpendAlert object { id, currency, interval, 3 more }Represents a spend alert configured at the project level.
-
id: stringThe identifier, which can be referenced in API endpoints.
-
currency: "USD"The currency for the threshold amount.
"USD"
-
interval: "month"The time interval for evaluating spend against the threshold.
"month"
-
notification_channel: object { recipients, type, subject_prefix }Email notification settings for a spend alert.
-
recipients: array of stringEmail addresses that receive the spend alert notification.
-
type: "email"The notification channel type. Currently only
emailis supported."email"
-
subject_prefix: optional stringOptional subject prefix for alert emails.
-
-
object: "project.spend_alert"The object type, which is always
project.spend_alert."project.spend_alert"
-
threshold_amount: numberThe alert threshold amount, in cents.
-
Example
curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/spend_alerts \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-d '{
"currency": "USD",
"interval": "month",
"notification_channel": {
"recipients": [
"string"
],
"type": "email"
},
"threshold_amount": 0
}'
Response
{
"id": "id",
"currency": "USD",
"interval": "month",
"notification_channel": {
"recipients": [
"string"
],
"type": "email",
"subject_prefix": "subject_prefix"
},
"object": "project.spend_alert",
"threshold_amount": 0
}
Example
curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/spend_alerts \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"threshold_amount": 100000,
"currency": "USD",
"interval": "month",
"notification_channel": {
"type": "email",
"recipients": ["finance@example.com"],
"subject_prefix": "OpenAI spend alert"
}
}'
Response
{
"id": "alert_abc123",
"object": "project.spend_alert",
"threshold_amount": 100000,
"currency": "USD",
"interval": "month",
"notification_channel": {
"type": "email",
"recipients": ["finance@example.com"],
"subject_prefix": "OpenAI spend alert"
}
}
Retrieve project spend alert
get /organization/projects/{project_id}/spend_alerts/{alert_id}
Retrieve project spend alert
Path Parameters
-
project_id: string -
alert_id: string
Returns
-
ProjectSpendAlert object { id, currency, interval, 3 more }Represents a spend alert configured at the project level.
-
id: stringThe identifier, which can be referenced in API endpoints.
-
currency: "USD"The currency for the threshold amount.
"USD"
-
interval: "month"The time interval for evaluating spend against the threshold.
"month"
-
notification_channel: object { recipients, type, subject_prefix }Email notification settings for a spend alert.
-
recipients: array of stringEmail addresses that receive the spend alert notification.
-
type: "email"The notification channel type. Currently only
emailis supported."email"
-
subject_prefix: optional stringOptional subject prefix for alert emails.
-
-
object: "project.spend_alert"The object type, which is always
project.spend_alert."project.spend_alert"
-
threshold_amount: numberThe alert threshold amount, in cents.
-
Example
curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/spend_alerts/$ALERT_ID \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"id": "id",
"currency": "USD",
"interval": "month",
"notification_channel": {
"recipients": [
"string"
],
"type": "email",
"subject_prefix": "subject_prefix"
},
"object": "project.spend_alert",
"threshold_amount": 0
}
Example
curl https://api.openai.com/v1/organization/projects/proj_abc/spend_alerts/alert_abc123 \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"id": "alert_abc123",
"object": "project.spend_alert",
"threshold_amount": 150000,
"currency": "USD",
"interval": "month",
"notification_channel": {
"type": "email",
"recipients": ["finance@example.com"],
"subject_prefix": "OpenAI spend alert"
}
}
Update project spend alert
post /organization/projects/{project_id}/spend_alerts/{alert_id}
Update project spend alert
Path Parameters
-
project_id: string -
alert_id: string
Body Parameters
-
currency: "USD"The currency for the threshold amount.
"USD"
-
interval: "month"The time interval for evaluating spend against the threshold.
"month"
-
notification_channel: object { recipients, type, subject_prefix }Email notification settings for a spend alert.
-
recipients: array of stringEmail addresses that receive the spend alert notification.
-
type: "email"The notification channel type. Currently only
emailis supported."email"
-
subject_prefix: optional stringOptional subject prefix for alert emails.
-
-
threshold_amount: numberThe alert threshold amount, in cents.
Returns
-
ProjectSpendAlert object { id, currency, interval, 3 more }Represents a spend alert configured at the project level.
-
id: stringThe identifier, which can be referenced in API endpoints.
-
currency: "USD"The currency for the threshold amount.
"USD"
-
interval: "month"The time interval for evaluating spend against the threshold.
"month"
-
notification_channel: object { recipients, type, subject_prefix }Email notification settings for a spend alert.
-
recipients: array of stringEmail addresses that receive the spend alert notification.
-
type: "email"The notification channel type. Currently only
emailis supported."email"
-
subject_prefix: optional stringOptional subject prefix for alert emails.
-
-
object: "project.spend_alert"The object type, which is always
project.spend_alert."project.spend_alert"
-
threshold_amount: numberThe alert threshold amount, in cents.
-
Example
curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/spend_alerts/$ALERT_ID \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-d '{
"currency": "USD",
"interval": "month",
"notification_channel": {
"recipients": [
"string"
],
"type": "email"
},
"threshold_amount": 0
}'
Response
{
"id": "id",
"currency": "USD",
"interval": "month",
"notification_channel": {
"recipients": [
"string"
],
"type": "email",
"subject_prefix": "subject_prefix"
},
"object": "project.spend_alert",
"threshold_amount": 0
}
Example
curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/spend_alerts/alert_abc123 \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"threshold_amount": 150000,
"currency": "USD",
"interval": "month",
"notification_channel": {
"type": "email",
"recipients": ["finance@example.com"],
"subject_prefix": "OpenAI spend alert"
}
}'
Response
{
"id": "alert_abc123",
"object": "project.spend_alert",
"threshold_amount": 150000,
"currency": "USD",
"interval": "month",
"notification_channel": {
"type": "email",
"recipients": ["finance@example.com"],
"subject_prefix": "OpenAI spend alert"
}
}
Delete project spend alert
delete /organization/projects/{project_id}/spend_alerts/{alert_id}
Delete project spend alert
Path Parameters
-
project_id: string -
alert_id: string
Returns
-
ProjectSpendAlertDeleted object { id, deleted, object }Confirmation payload returned after deleting a project spend alert.
-
id: stringThe deleted spend alert ID.
-
deleted: booleanWhether the spend alert was deleted.
-
object: "project.spend_alert.deleted"Always
project.spend_alert.deleted."project.spend_alert.deleted"
-
Example
curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/spend_alerts/$ALERT_ID \
-X DELETE \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"id": "id",
"deleted": true,
"object": "project.spend_alert.deleted"
}
Example
curl -X DELETE https://api.openai.com/v1/organization/projects/proj_abc/spend_alerts/alert_abc123 \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
{
"id": "alert_abc123",
"object": "project.spend_alert.deleted",
"deleted": true
}
Domain Types
Project Spend Alert
-
ProjectSpendAlert object { id, currency, interval, 3 more }Represents a spend alert configured at the project level.
-
id: stringThe identifier, which can be referenced in API endpoints.
-
currency: "USD"The currency for the threshold amount.
"USD"
-
interval: "month"The time interval for evaluating spend against the threshold.
"month"
-
notification_channel: object { recipients, type, subject_prefix }Email notification settings for a spend alert.
-
recipients: array of stringEmail addresses that receive the spend alert notification.
-
type: "email"The notification channel type. Currently only
emailis supported."email"
-
subject_prefix: optional stringOptional subject prefix for alert emails.
-
-
object: "project.spend_alert"The object type, which is always
project.spend_alert."project.spend_alert"
-
threshold_amount: numberThe alert threshold amount, in cents.
-
Project Spend Alert Deleted
-
ProjectSpendAlertDeleted object { id, deleted, object }Confirmation payload returned after deleting a project spend alert.
-
id: stringThe deleted spend alert ID.
-
deleted: booleanWhether the spend alert was deleted.
-
object: "project.spend_alert.deleted"Always
project.spend_alert.deleted."project.spend_alert.deleted"
-
Certificates
List project certificates
get /organization/projects/{project_id}/certificates
List project certificates
Path Parameters
project_id: string
Query Parameters
-
after: optional stringA cursor for use in pagination.
afteris an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. -
limit: optional numberA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
-
order: optional "asc" or "desc"Sort order by the
created_attimestamp of the objects.ascfor ascending order anddescfor descending order.-
"asc" -
"desc"
-
Returns
-
data: array of object { id, active, certificate_details, 3 more }-
id: stringThe identifier, which can be referenced in API endpoints
-
active: booleanWhether the certificate is currently active at the project level.
-
certificate_details: object { expires_at, valid_at }-
expires_at: optional numberThe Unix timestamp (in seconds) of when the certificate expires.
-
valid_at: optional numberThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
created_at: numberThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
name: stringThe name of the certificate.
-
object: "organization.project.certificate"The object type, which is always
organization.project.certificate."organization.project.certificate"
-
-
first_id: string -
has_more: boolean -
last_id: string -
object: "list""list"
Example
curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/certificates \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"data": [
{
"id": "id",
"active": true,
"certificate_details": {
"expires_at": 0,
"valid_at": 0
},
"created_at": 0,
"name": "name",
"object": "organization.project.certificate"
}
],
"first_id": "cert_abc",
"has_more": true,
"last_id": "cert_abc",
"object": "list"
}
Example
curl https://api.openai.com/v1/organization/projects/proj_abc/certificates \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY"
Response
{
"object": "list",
"data": [
{
"object": "organization.project.certificate",
"id": "cert_abc",
"name": "My Example Certificate",
"active": true,
"created_at": 1234567,
"certificate_details": {
"valid_at": 12345667,
"expires_at": 12345678
}
},
],
"first_id": "cert_abc",
"last_id": "cert_abc",
"has_more": false
}
Activate certificates for project
post /organization/projects/{project_id}/certificates/activate
Activate certificates for project
Path Parameters
project_id: string
Body Parameters
certificate_ids: array of string
Returns
-
data: array of object { id, active, certificate_details, 3 more }-
id: stringThe identifier, which can be referenced in API endpoints
-
active: booleanWhether the certificate is currently active at the project level.
-
certificate_details: object { expires_at, valid_at }-
expires_at: optional numberThe Unix timestamp (in seconds) of when the certificate expires.
-
valid_at: optional numberThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
created_at: numberThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
name: stringThe name of the certificate.
-
object: "organization.project.certificate"The object type, which is always
organization.project.certificate."organization.project.certificate"
-
-
object: "organization.project.certificate.activation"The project certificate activation result type.
"organization.project.certificate.activation"
Example
curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/certificates/activate \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-d '{
"certificate_ids": [
"cert_abc"
]
}'
Response
{
"data": [
{
"id": "id",
"active": true,
"certificate_details": {
"expires_at": 0,
"valid_at": 0
},
"created_at": 0,
"name": "name",
"object": "organization.project.certificate"
}
],
"object": "organization.project.certificate.activation"
}
Example
curl https://api.openai.com/v1/organization/projects/proj_abc/certificates/activate \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"certificate_ids": ["cert_abc", "cert_def"]
}'
Response
{
"object": "organization.project.certificate.activation",
"data": [
{
"object": "organization.project.certificate",
"id": "cert_abc",
"name": "My Example Certificate",
"active": true,
"created_at": 1234567,
"certificate_details": {
"valid_at": 12345667,
"expires_at": 12345678
}
},
{
"object": "organization.project.certificate",
"id": "cert_def",
"name": "My Example Certificate 2",
"active": true,
"created_at": 1234567,
"certificate_details": {
"valid_at": 12345667,
"expires_at": 12345678
}
},
],
}
Deactivate certificates for project
post /organization/projects/{project_id}/certificates/deactivate
Deactivate certificates for project
Path Parameters
project_id: string
Body Parameters
certificate_ids: array of string
Returns
-
data: array of object { id, active, certificate_details, 3 more }-
id: stringThe identifier, which can be referenced in API endpoints
-
active: booleanWhether the certificate is currently active at the project level.
-
certificate_details: object { expires_at, valid_at }-
expires_at: optional numberThe Unix timestamp (in seconds) of when the certificate expires.
-
valid_at: optional numberThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
created_at: numberThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
name: stringThe name of the certificate.
-
object: "organization.project.certificate"The object type, which is always
organization.project.certificate."organization.project.certificate"
-
-
object: "organization.project.certificate.deactivation"The project certificate deactivation result type.
"organization.project.certificate.deactivation"
Example
curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/certificates/deactivate \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-d '{
"certificate_ids": [
"cert_abc"
]
}'
Response
{
"data": [
{
"id": "id",
"active": true,
"certificate_details": {
"expires_at": 0,
"valid_at": 0
},
"created_at": 0,
"name": "name",
"object": "organization.project.certificate"
}
],
"object": "organization.project.certificate.deactivation"
}
Example
curl https://api.openai.com/v1/organization/projects/proj_abc/certificates/deactivate \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"certificate_ids": ["cert_abc", "cert_def"]
}'
Response
{
"object": "organization.project.certificate.deactivation",
"data": [
{
"object": "organization.project.certificate",
"id": "cert_abc",
"name": "My Example Certificate",
"active": false,
"created_at": 1234567,
"certificate_details": {
"valid_at": 12345667,
"expires_at": 12345678
}
},
{
"object": "organization.project.certificate",
"id": "cert_def",
"name": "My Example Certificate 2",
"active": false,
"created_at": 1234567,
"certificate_details": {
"valid_at": 12345667,
"expires_at": 12345678
}
},
],
}
Domain Types
Certificate List Response
-
CertificateListResponse object { id, active, certificate_details, 3 more }Represents an individual certificate configured at the project level.
-
id: stringThe identifier, which can be referenced in API endpoints
-
active: booleanWhether the certificate is currently active at the project level.
-
certificate_details: object { expires_at, valid_at }-
expires_at: optional numberThe Unix timestamp (in seconds) of when the certificate expires.
-
valid_at: optional numberThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
created_at: numberThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
name: stringThe name of the certificate.
-
object: "organization.project.certificate"The object type, which is always
organization.project.certificate."organization.project.certificate"
-
Certificate Activate Response
-
CertificateActivateResponse object { id, active, certificate_details, 3 more }Represents an individual certificate configured at the project level.
-
id: stringThe identifier, which can be referenced in API endpoints
-
active: booleanWhether the certificate is currently active at the project level.
-
certificate_details: object { expires_at, valid_at }-
expires_at: optional numberThe Unix timestamp (in seconds) of when the certificate expires.
-
valid_at: optional numberThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
created_at: numberThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
name: stringThe name of the certificate.
-
object: "organization.project.certificate"The object type, which is always
organization.project.certificate."organization.project.certificate"
-
Certificate Deactivate Response
-
CertificateDeactivateResponse object { id, active, certificate_details, 3 more }Represents an individual certificate configured at the project level.
-
id: stringThe identifier, which can be referenced in API endpoints
-
active: booleanWhether the certificate is currently active at the project level.
-
certificate_details: object { expires_at, valid_at }-
expires_at: optional numberThe Unix timestamp (in seconds) of when the certificate expires.
-
valid_at: optional numberThe Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
created_at: numberThe Unix timestamp (in seconds) of when the certificate was uploaded.
-
name: stringThe name of the certificate.
-
object: "organization.project.certificate"The object type, which is always
organization.project.certificate."organization.project.certificate"
-