diff --git a/en/java/resources/admin/index.md b/en/java/resources/admin/index.md new file mode 100644 index 0000000..4b6374a --- /dev/null +++ b/en/java/resources/admin/index.md @@ -0,0 +1,18505 @@ +# Admin + +# Organization + +# Audit Logs + +## List audit logs + +`AuditLogListPage admin().organization().auditLogs().list(AuditLogListParamsparams = AuditLogListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/audit_logs` + +List user actions and configuration changes within this organization. + +### Parameters + +- `AuditLogListParams params` + + - `Optional> actorEmails` + + Return only events performed by users with these emails. + + - `Optional> actorIds` + + Return only events performed by these actors. Can be a user ID, a service account ID, or an api key tracking ID. + + - `Optional after` + + A cursor for use in pagination. `after` is 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. + + - `Optional before` + + A cursor for use in pagination. `before` is 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. + + - `Optional effectiveAt` + + Return only events whose `effective_at` (Unix seconds) is in this range. + + - `Optional gt` + + Return only events whose `effective_at` (Unix seconds) is greater than this value. + + - `Optional gte` + + Return only events whose `effective_at` (Unix seconds) is greater than or equal to this value. + + - `Optional lt` + + Return only events whose `effective_at` (Unix seconds) is less than this value. + + - `Optional lte` + + Return only events whose `effective_at` (Unix seconds) is less than or equal to this value. + + - `Optional> eventTypes` + + Return only events with a `type` in one of these values. For example, `project.created`. For all options, see the documentation for the [audit log object](https://platform.openai.com/docs/api-reference/audit-logs/object). + + - `API_KEY_CREATED("api_key.created")` + + - `API_KEY_UPDATED("api_key.updated")` + + - `API_KEY_DELETED("api_key.deleted")` + + - `CERTIFICATE_CREATED("certificate.created")` + + - `CERTIFICATE_UPDATED("certificate.updated")` + + - `CERTIFICATE_DELETED("certificate.deleted")` + + - `CERTIFICATES_ACTIVATED("certificates.activated")` + + - `CERTIFICATES_DEACTIVATED("certificates.deactivated")` + + - `CHECKPOINT_PERMISSION_CREATED("checkpoint.permission.created")` + + - `CHECKPOINT_PERMISSION_DELETED("checkpoint.permission.deleted")` + + - `EXTERNAL_KEY_REGISTERED("external_key.registered")` + + - `EXTERNAL_KEY_REMOVED("external_key.removed")` + + - `GROUP_CREATED("group.created")` + + - `GROUP_UPDATED("group.updated")` + + - `GROUP_DELETED("group.deleted")` + + - `INVITE_SENT("invite.sent")` + + - `INVITE_ACCEPTED("invite.accepted")` + + - `INVITE_DELETED("invite.deleted")` + + - `IP_ALLOWLIST_CREATED("ip_allowlist.created")` + + - `IP_ALLOWLIST_UPDATED("ip_allowlist.updated")` + + - `IP_ALLOWLIST_DELETED("ip_allowlist.deleted")` + + - `IP_ALLOWLIST_CONFIG_ACTIVATED("ip_allowlist.config.activated")` + + - `IP_ALLOWLIST_CONFIG_DEACTIVATED("ip_allowlist.config.deactivated")` + + - `LOGIN_SUCCEEDED("login.succeeded")` + + - `LOGIN_FAILED("login.failed")` + + - `LOGOUT_SUCCEEDED("logout.succeeded")` + + - `LOGOUT_FAILED("logout.failed")` + + - `ORGANIZATION_UPDATED("organization.updated")` + + - `PROJECT_CREATED("project.created")` + + - `PROJECT_UPDATED("project.updated")` + + - `PROJECT_ARCHIVED("project.archived")` + + - `PROJECT_DELETED("project.deleted")` + + - `RATE_LIMIT_UPDATED("rate_limit.updated")` + + - `RATE_LIMIT_DELETED("rate_limit.deleted")` + + - `RESOURCE_DELETED("resource.deleted")` + + - `TUNNEL_CREATED("tunnel.created")` + + - `TUNNEL_UPDATED("tunnel.updated")` + + - `TUNNEL_DELETED("tunnel.deleted")` + + - `WORKLOAD_IDENTITY_PROVIDER_CREATED("workload_identity_provider.created")` + + - `WORKLOAD_IDENTITY_PROVIDER_UPDATED("workload_identity_provider.updated")` + + - `WORKLOAD_IDENTITY_PROVIDER_DELETED("workload_identity_provider.deleted")` + + - `WORKLOAD_IDENTITY_PROVIDER_MAPPING_CREATED("workload_identity_provider_mapping.created")` + + - `WORKLOAD_IDENTITY_PROVIDER_MAPPING_UPDATED("workload_identity_provider_mapping.updated")` + + - `WORKLOAD_IDENTITY_PROVIDER_MAPPING_DELETED("workload_identity_provider_mapping.deleted")` + + - `ROLE_CREATED("role.created")` + + - `ROLE_UPDATED("role.updated")` + + - `ROLE_DELETED("role.deleted")` + + - `ROLE_ASSIGNMENT_CREATED("role.assignment.created")` + + - `ROLE_ASSIGNMENT_DELETED("role.assignment.deleted")` + + - `SCIM_ENABLED("scim.enabled")` + + - `SCIM_DISABLED("scim.disabled")` + + - `SERVICE_ACCOUNT_CREATED("service_account.created")` + + - `SERVICE_ACCOUNT_UPDATED("service_account.updated")` + + - `SERVICE_ACCOUNT_DELETED("service_account.deleted")` + + - `USER_ADDED("user.added")` + + - `USER_UPDATED("user.updated")` + + - `USER_DELETED("user.deleted")` + + - `Optional limit` + + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + + - `Optional> projectIds` + + Return only events for these projects. + + - `Optional> resourceIds` + + Return only events performed on these targets. For example, a project ID updated. + +### Returns + +- `class AuditLogListResponse:` + + A log of a user action or configuration change within this organization. + + - `String id` + + The ID of this log. + + - `long effectiveAt` + + The Unix timestamp (in seconds) of the event. + + - `Type type` + + The event type. + + - `API_KEY_CREATED("api_key.created")` + + - `API_KEY_UPDATED("api_key.updated")` + + - `API_KEY_DELETED("api_key.deleted")` + + - `CERTIFICATE_CREATED("certificate.created")` + + - `CERTIFICATE_UPDATED("certificate.updated")` + + - `CERTIFICATE_DELETED("certificate.deleted")` + + - `CERTIFICATES_ACTIVATED("certificates.activated")` + + - `CERTIFICATES_DEACTIVATED("certificates.deactivated")` + + - `CHECKPOINT_PERMISSION_CREATED("checkpoint.permission.created")` + + - `CHECKPOINT_PERMISSION_DELETED("checkpoint.permission.deleted")` + + - `EXTERNAL_KEY_REGISTERED("external_key.registered")` + + - `EXTERNAL_KEY_REMOVED("external_key.removed")` + + - `GROUP_CREATED("group.created")` + + - `GROUP_UPDATED("group.updated")` + + - `GROUP_DELETED("group.deleted")` + + - `INVITE_SENT("invite.sent")` + + - `INVITE_ACCEPTED("invite.accepted")` + + - `INVITE_DELETED("invite.deleted")` + + - `IP_ALLOWLIST_CREATED("ip_allowlist.created")` + + - `IP_ALLOWLIST_UPDATED("ip_allowlist.updated")` + + - `IP_ALLOWLIST_DELETED("ip_allowlist.deleted")` + + - `IP_ALLOWLIST_CONFIG_ACTIVATED("ip_allowlist.config.activated")` + + - `IP_ALLOWLIST_CONFIG_DEACTIVATED("ip_allowlist.config.deactivated")` + + - `LOGIN_SUCCEEDED("login.succeeded")` + + - `LOGIN_FAILED("login.failed")` + + - `LOGOUT_SUCCEEDED("logout.succeeded")` + + - `LOGOUT_FAILED("logout.failed")` + + - `ORGANIZATION_UPDATED("organization.updated")` + + - `PROJECT_CREATED("project.created")` + + - `PROJECT_UPDATED("project.updated")` + + - `PROJECT_ARCHIVED("project.archived")` + + - `PROJECT_DELETED("project.deleted")` + + - `RATE_LIMIT_UPDATED("rate_limit.updated")` + + - `RATE_LIMIT_DELETED("rate_limit.deleted")` + + - `RESOURCE_DELETED("resource.deleted")` + + - `TUNNEL_CREATED("tunnel.created")` + + - `TUNNEL_UPDATED("tunnel.updated")` + + - `TUNNEL_DELETED("tunnel.deleted")` + + - `WORKLOAD_IDENTITY_PROVIDER_CREATED("workload_identity_provider.created")` + + - `WORKLOAD_IDENTITY_PROVIDER_UPDATED("workload_identity_provider.updated")` + + - `WORKLOAD_IDENTITY_PROVIDER_DELETED("workload_identity_provider.deleted")` + + - `WORKLOAD_IDENTITY_PROVIDER_MAPPING_CREATED("workload_identity_provider_mapping.created")` + + - `WORKLOAD_IDENTITY_PROVIDER_MAPPING_UPDATED("workload_identity_provider_mapping.updated")` + + - `WORKLOAD_IDENTITY_PROVIDER_MAPPING_DELETED("workload_identity_provider_mapping.deleted")` + + - `ROLE_CREATED("role.created")` + + - `ROLE_UPDATED("role.updated")` + + - `ROLE_DELETED("role.deleted")` + + - `ROLE_ASSIGNMENT_CREATED("role.assignment.created")` + + - `ROLE_ASSIGNMENT_DELETED("role.assignment.deleted")` + + - `SCIM_ENABLED("scim.enabled")` + + - `SCIM_DISABLED("scim.disabled")` + + - `SERVICE_ACCOUNT_CREATED("service_account.created")` + + - `SERVICE_ACCOUNT_UPDATED("service_account.updated")` + + - `SERVICE_ACCOUNT_DELETED("service_account.deleted")` + + - `USER_ADDED("user.added")` + + - `USER_UPDATED("user.updated")` + + - `USER_DELETED("user.deleted")` + + - `Optional actor` + + The actor who performed the audit logged action. + + - `Optional apiKey` + + The API Key used to perform the audit logged action. + + - `Optional id` + + The tracking id of the API key. + + - `Optional serviceAccount` + + The service account that performed the audit logged action. + + - `Optional id` + + The service account id. + + - `Optional type` + + The type of API key. Can be either `user` or `service_account`. + + - `USER("user")` + + - `SERVICE_ACCOUNT("service_account")` + + - `Optional user` + + The user who performed the audit logged action. + + - `Optional id` + + The user id. + + - `Optional email` + + The user email. + + - `Optional session` + + The session in which the audit logged action was performed. + + - `Optional ipAddress` + + The IP address from which the action was performed. + + - `Optional user` + + The user who performed the audit logged action. + + - `Optional id` + + The user id. + + - `Optional email` + + The user email. + + - `Optional type` + + The type of actor. Is either `session` or `api_key`. + + - `SESSION("session")` + + - `API_KEY("api_key")` + + - `Optional apiKeyCreated` + + The details for events with this `type`. + + - `Optional id` + + The tracking ID of the API key. + + - `Optional data` + + The payload used to create the API key. + + - `Optional> scopes` + + A list of scopes allowed for the API key, e.g. `["api.model.request"]` + + - `Optional apiKeyDeleted` + + The details for events with this `type`. + + - `Optional id` + + The tracking ID of the API key. + + - `Optional apiKeyUpdated` + + The details for events with this `type`. + + - `Optional id` + + The tracking ID of the API key. + + - `Optional changesRequested` + + The payload used to update the API key. + + - `Optional> scopes` + + A list of scopes allowed for the API key, e.g. `["api.model.request"]` + + - `Optional certificateCreated` + + The details for events with this `type`. + + - `Optional id` + + The certificate ID. + + - `Optional name` + + The name of the certificate. + + - `Optional certificateDeleted` + + The details for events with this `type`. + + - `Optional id` + + The certificate ID. + + - `Optional certificate` + + The certificate content in PEM format. + + - `Optional name` + + The name of the certificate. + + - `Optional certificateUpdated` + + The details for events with this `type`. + + - `Optional id` + + The certificate ID. + + - `Optional name` + + The name of the certificate. + + - `Optional certificatesActivated` + + The details for events with this `type`. + + - `Optional> certificates` + + - `Optional id` + + The certificate ID. + + - `Optional name` + + The name of the certificate. + + - `Optional certificatesDeactivated` + + The details for events with this `type`. + + - `Optional> certificates` + + - `Optional id` + + The certificate ID. + + - `Optional name` + + The name of the certificate. + + - `Optional checkpointPermissionCreated` + + The project and fine-tuned model checkpoint that the checkpoint permission was created for. + + - `Optional id` + + The ID of the checkpoint permission. + + - `Optional data` + + The payload used to create the checkpoint permission. + + - `Optional fineTunedModelCheckpoint` + + The ID of the fine-tuned model checkpoint. + + - `Optional projectId` + + The ID of the project that the checkpoint permission was created for. + + - `Optional checkpointPermissionDeleted` + + The details for events with this `type`. + + - `Optional id` + + The ID of the checkpoint permission. + + - `Optional externalKeyRegistered` + + The details for events with this `type`. + + - `Optional id` + + The ID of the external key configuration. + + - `Optional data` + + The configuration for the external key. + + - `Optional externalKeyRemoved` + + The details for events with this `type`. + + - `Optional id` + + The ID of the external key configuration. + + - `Optional groupCreated` + + The details for events with this `type`. + + - `Optional id` + + The ID of the group. + + - `Optional data` + + Information about the created group. + + - `Optional groupName` + + The group name. + + - `Optional groupDeleted` + + The details for events with this `type`. + + - `Optional id` + + The ID of the group. + + - `Optional groupUpdated` + + The details for events with this `type`. + + - `Optional id` + + The ID of the group. + + - `Optional changesRequested` + + The payload used to update the group. + + - `Optional groupName` + + The updated group name. + + - `Optional inviteAccepted` + + The details for events with this `type`. + + - `Optional id` + + The ID of the invite. + + - `Optional inviteDeleted` + + The details for events with this `type`. + + - `Optional id` + + The ID of the invite. + + - `Optional inviteSent` + + The details for events with this `type`. + + - `Optional id` + + The ID of the invite. + + - `Optional data` + + The payload used to create the invite. + + - `Optional email` + + The email invited to the organization. + + - `Optional role` + + The role the email was invited to be. Is either `owner` or `member`. + + - `Optional ipAllowlistConfigActivated` + + The details for events with this `type`. + + - `Optional> configs` + + The configurations that were activated. + + - `Optional id` + + The ID of the IP allowlist configuration. + + - `Optional name` + + The name of the IP allowlist configuration. + + - `Optional ipAllowlistConfigDeactivated` + + The details for events with this `type`. + + - `Optional> configs` + + The configurations that were deactivated. + + - `Optional id` + + The ID of the IP allowlist configuration. + + - `Optional name` + + The name of the IP allowlist configuration. + + - `Optional ipAllowlistCreated` + + The details for events with this `type`. + + - `Optional id` + + The ID of the IP allowlist configuration. + + - `Optional> allowedIps` + + The IP addresses or CIDR ranges included in the configuration. + + - `Optional name` + + The name of the IP allowlist configuration. + + - `Optional ipAllowlistDeleted` + + The details for events with this `type`. + + - `Optional id` + + The ID of the IP allowlist configuration. + + - `Optional> allowedIps` + + The IP addresses or CIDR ranges that were in the configuration. + + - `Optional name` + + The name of the IP allowlist configuration. + + - `Optional ipAllowlistUpdated` + + The details for events with this `type`. + + - `Optional id` + + The ID of the IP allowlist configuration. + + - `Optional> allowedIps` + + The updated set of IP addresses or CIDR ranges in the configuration. + + - `Optional loginFailed` + + The details for events with this `type`. + + - `Optional errorCode` + + The error code of the failure. + + - `Optional errorMessage` + + The error message of the failure. + + - `Optional loginSucceeded` + + This event has no additional fields beyond the standard audit log attributes. + + - `Optional logoutFailed` + + The details for events with this `type`. + + - `Optional errorCode` + + The error code of the failure. + + - `Optional errorMessage` + + The error message of the failure. + + - `Optional logoutSucceeded` + + This event has no additional fields beyond the standard audit log attributes. + + - `Optional organizationUpdated` + + The details for events with this `type`. + + - `Optional id` + + The organization ID. + + - `Optional changesRequested` + + The payload used to update the organization settings. + + - `Optional apiCallLogging` + + How your organization logs data from supported API calls. One of `disabled`, `enabled_per_call`, `enabled_for_all_projects`, or `enabled_for_selected_projects` + + - `Optional apiCallLoggingProjectIds` + + The list of project ids if api_call_logging is set to `enabled_for_selected_projects` + + - `Optional description` + + The organization description. + + - `Optional name` + + The organization name. + + - `Optional threadsUiVisibility` + + Visibility of the threads page which shows messages created with the Assistants API and Playground. One of `ANY_ROLE`, `OWNERS`, or `NONE`. + + - `Optional title` + + The organization title. + + - `Optional usageDashboardVisibility` + + Visibility of the usage dashboard which shows activity and costs for your organization. One of `ANY_ROLE` or `OWNERS`. + + - `Optional project` + + 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. + + - `Optional id` + + The project ID. + + - `Optional name` + + The project title. + + - `Optional projectArchived` + + The details for events with this `type`. + + - `Optional id` + + The project ID. + + - `Optional projectCreated` + + The details for events with this `type`. + + - `Optional id` + + The project ID. + + - `Optional data` + + The payload used to create the project. + + - `Optional name` + + The project name. + + - `Optional title` + + The title of the project as seen on the dashboard. + + - `Optional projectDeleted` + + The details for events with this `type`. + + - `Optional id` + + The project ID. + + - `Optional projectUpdated` + + The details for events with this `type`. + + - `Optional id` + + The project ID. + + - `Optional changesRequested` + + The payload used to update the project. + + - `Optional title` + + The title of the project as seen on the dashboard. + + - `Optional rateLimitDeleted` + + The details for events with this `type`. + + - `Optional id` + + The rate limit ID + + - `Optional rateLimitUpdated` + + The details for events with this `type`. + + - `Optional id` + + The rate limit ID + + - `Optional changesRequested` + + The payload used to update the rate limits. + + - `Optional batch1DayMaxInputTokens` + + The maximum batch input tokens per day. Only relevant for certain models. + + - `Optional maxAudioMegabytesPer1Minute` + + The maximum audio megabytes per minute. Only relevant for certain models. + + - `Optional maxImagesPer1Minute` + + The maximum images per minute. Only relevant for certain models. + + - `Optional maxRequestsPer1Day` + + The maximum requests per day. Only relevant for certain models. + + - `Optional maxRequestsPer1Minute` + + The maximum requests per minute. + + - `Optional maxTokensPer1Minute` + + The maximum tokens per minute. + + - `Optional roleAssignmentCreated` + + The details for events with this `type`. + + - `Optional id` + + The identifier of the role assignment. + + - `Optional principalId` + + The principal (user or group) that received the role. + + - `Optional principalType` + + The type of principal (user or group) that received the role. + + - `Optional resourceId` + + The resource the role assignment is scoped to. + + - `Optional resourceType` + + The type of resource the role assignment is scoped to. + + - `Optional roleAssignmentDeleted` + + The details for events with this `type`. + + - `Optional id` + + The identifier of the role assignment. + + - `Optional principalId` + + The principal (user or group) that had the role removed. + + - `Optional principalType` + + The type of principal (user or group) that had the role removed. + + - `Optional resourceId` + + The resource the role assignment was scoped to. + + - `Optional resourceType` + + The type of resource the role assignment was scoped to. + + - `Optional roleCreated` + + The details for events with this `type`. + + - `Optional id` + + The role ID. + + - `Optional> permissions` + + The permissions granted by the role. + + - `Optional resourceId` + + The resource the role is scoped to. + + - `Optional resourceType` + + The type of resource the role belongs to. + + - `Optional roleName` + + The name of the role. + + - `Optional roleDeleted` + + The details for events with this `type`. + + - `Optional id` + + The role ID. + + - `Optional roleUpdated` + + The details for events with this `type`. + + - `Optional id` + + The role ID. + + - `Optional changesRequested` + + The payload used to update the role. + + - `Optional description` + + The updated role description, when provided. + + - `Optional metadata` + + Additional metadata stored on the role. + + - `Optional> permissionsAdded` + + The permissions added to the role. + + - `Optional> permissionsRemoved` + + The permissions removed from the role. + + - `Optional resourceId` + + The resource the role is scoped to. + + - `Optional resourceType` + + The type of resource the role belongs to. + + - `Optional roleName` + + The updated role name, when provided. + + - `Optional scimDisabled` + + The details for events with this `type`. + + - `Optional id` + + The ID of the SCIM was disabled for. + + - `Optional scimEnabled` + + The details for events with this `type`. + + - `Optional id` + + The ID of the SCIM was enabled for. + + - `Optional serviceAccountCreated` + + The details for events with this `type`. + + - `Optional id` + + The service account ID. + + - `Optional data` + + The payload used to create the service account. + + - `Optional role` + + The role of the service account. Is either `owner` or `member`. + + - `Optional serviceAccountDeleted` + + The details for events with this `type`. + + - `Optional id` + + The service account ID. + + - `Optional serviceAccountUpdated` + + The details for events with this `type`. + + - `Optional id` + + The service account ID. + + - `Optional changesRequested` + + The payload used to updated the service account. + + - `Optional role` + + The role of the service account. Is either `owner` or `member`. + + - `Optional userAdded` + + The details for events with this `type`. + + - `Optional id` + + The user ID. + + - `Optional data` + + The payload used to add the user to the project. + + - `Optional role` + + The role of the user. Is either `owner` or `member`. + + - `Optional userDeleted` + + The details for events with this `type`. + + - `Optional id` + + The user ID. + + - `Optional userUpdated` + + The details for events with this `type`. + + - `Optional id` + + The project ID. + + - `Optional changesRequested` + + The payload used to update the user. + + - `Optional role` + + The role of the user. Is either `owner` or `member`. + + - `Optional workloadIdentityProviderMappingCreated` + + The details for events with this `type`. + + - `Optional id` + + The workload identity provider mapping ID. + + - `Optional data` + + The payload used to create the workload identity provider mapping. + + - `Optional identityProviderId` + + The workload identity provider ID. + + - `Optional workloadIdentityProviderMappingDeleted` + + The details for events with this `type`. + + - `Optional id` + + The workload identity provider mapping ID. + + - `Optional identityProviderId` + + The workload identity provider ID. + + - `Optional projectId` + + The project ID. + + - `Optional serviceAccountId` + + The mapped service account ID. + + - `Optional workloadIdentityProviderMappingUpdated` + + The details for events with this `type`. + + - `Optional id` + + The workload identity provider mapping ID. + + - `Optional changesRequested` + + The payload used to update the workload identity provider mapping. + + - `Optional identityProviderId` + + The workload identity provider ID. + + - `Optional workloadIdentityProviderCreated` + + The details for events with this `type`. + + - `Optional id` + + The workload identity provider ID. + + - `Optional data` + + The payload used to create the workload identity provider. + + - `Optional workloadIdentityProviderDeleted` + + The details for events with this `type`. + + - `Optional id` + + The workload identity provider ID. + + - `Optional name` + + The workload identity provider name. + + - `Optional workloadIdentityProviderUpdated` + + The details for events with this `type`. + + - `Optional id` + + The workload identity provider ID. + + - `Optional changesRequested` + + The payload used to update the workload identity provider. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.auditlogs.AuditLogListPage; +import com.openai.models.admin.organization.auditlogs.AuditLogListParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + AuditLogListPage page = client.admin().organization().auditLogs().list(); + } +} +``` + +#### Response + +```json +{ + "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.created": { + "id": "id", + "permissions": [ + "string" + ], + "resource_id": "resource_id", + "resource_type": "resource_type", + "role_name": "role_name" + }, + "role.deleted": { + "id": "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" +} +``` + +# Admin API Keys + +## List all organization and project API keys. + +`AdminApiKeyListPage admin().organization().adminApiKeys().list(AdminApiKeyListParamsparams = AdminApiKeyListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/admin_api_keys` + +List organization API keys + +### Parameters + +- `AdminApiKeyListParams params` + + - `Optional after` + + Return keys with IDs that come after this ID in the pagination order. + + - `Optional limit` + + Maximum number of keys to return. + + - `Optional order` + + Order results by creation time, ascending or descending. + + - `ASC("asc")` + + - `DESC("desc")` + +### Returns + +- `class AdminApiKey:` + + Represents an individual Admin API key in an org. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `long createdAt` + + The Unix timestamp (in seconds) of when the API key was created + + - `JsonValue; object_ "organization.admin_api_key"constant` + + The object type, which is always `organization.admin_api_key` + + - `ORGANIZATION_ADMIN_API_KEY("organization.admin_api_key")` + + - `Owner owner` + + - `Optional id` + + The identifier, which can be referenced in API endpoints + + - `Optional createdAt` + + The Unix timestamp (in seconds) of when the user was created + + - `Optional name` + + The name of the user + + - `Optional object_` + + The object type, which is always organization.user + + - `Optional role` + + Always `owner` + + - `Optional type` + + Always `user` + + - `String redactedValue` + + The redacted value of the API key + + - `Optional lastUsedAt` + + The Unix timestamp (in seconds) of when the API key was last used + + - `Optional name` + + The name of the API key + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.adminapikeys.AdminApiKeyListPage; +import com.openai.models.admin.organization.adminapikeys.AdminApiKeyListParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + AdminApiKeyListPage page = client.admin().organization().adminApiKeys().list(); + } +} +``` + +#### Response + +```json +{ + "data": [ + { + "id": "key_abc", + "created_at": 1711471533, + "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" +} +``` + +## Create admin API key + +`AdminApiKeyCreateResponse admin().organization().adminApiKeys().create(AdminApiKeyCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/organization/admin_api_keys` + +Create an organization admin API key + +### Parameters + +- `AdminApiKeyCreateParams params` + + - `String name` + +### Returns + +- `class AdminApiKeyCreateResponse:` + + Represents an individual Admin API key in an org. + + - `String value` + + The value of the API key. Only shown on create. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.adminapikeys.AdminApiKeyCreateParams; +import com.openai.models.admin.organization.adminapikeys.AdminApiKeyCreateResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + AdminApiKeyCreateParams params = AdminApiKeyCreateParams.builder() + .name("New Admin Key") + .build(); + AdminApiKeyCreateResponse adminApiKey = client.admin().organization().adminApiKeys().create(params); + } +} +``` + +#### Response + +```json +{ + "id": "key_abc", + "created_at": 1711471533, + "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" +} +``` + +## Retrieve admin API key + +`AdminApiKey admin().organization().adminApiKeys().retrieve(AdminApiKeyRetrieveParamsparams = AdminApiKeyRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/admin_api_keys/{key_id}` + +Retrieve a single organization API key + +### Parameters + +- `AdminApiKeyRetrieveParams params` + + - `Optional keyId` + + The ID of the API key. + +### Returns + +- `class AdminApiKey:` + + Represents an individual Admin API key in an org. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `long createdAt` + + The Unix timestamp (in seconds) of when the API key was created + + - `JsonValue; object_ "organization.admin_api_key"constant` + + The object type, which is always `organization.admin_api_key` + + - `ORGANIZATION_ADMIN_API_KEY("organization.admin_api_key")` + + - `Owner owner` + + - `Optional id` + + The identifier, which can be referenced in API endpoints + + - `Optional createdAt` + + The Unix timestamp (in seconds) of when the user was created + + - `Optional name` + + The name of the user + + - `Optional object_` + + The object type, which is always organization.user + + - `Optional role` + + Always `owner` + + - `Optional type` + + Always `user` + + - `String redactedValue` + + The redacted value of the API key + + - `Optional lastUsedAt` + + The Unix timestamp (in seconds) of when the API key was last used + + - `Optional name` + + The name of the API key + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.adminapikeys.AdminApiKey; +import com.openai.models.admin.organization.adminapikeys.AdminApiKeyRetrieveParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + AdminApiKey adminApiKey = client.admin().organization().adminApiKeys().retrieve("key_id"); + } +} +``` + +#### Response + +```json +{ + "id": "key_abc", + "created_at": 1711471533, + "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" +} +``` + +## Delete admin API key + +`AdminApiKeyDeleteResponse admin().organization().adminApiKeys().delete(AdminApiKeyDeleteParamsparams = AdminApiKeyDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**delete** `/organization/admin_api_keys/{key_id}` + +Delete an organization admin API key + +### Parameters + +- `AdminApiKeyDeleteParams params` + + - `Optional keyId` + + The ID of the API key to be deleted. + +### Returns + +- `class AdminApiKeyDeleteResponse:` + + - `String id` + + - `boolean deleted` + + - `JsonValue; object_ "organization.admin_api_key.deleted"constant` + + - `ORGANIZATION_ADMIN_API_KEY_DELETED("organization.admin_api_key.deleted")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.adminapikeys.AdminApiKeyDeleteParams; +import com.openai.models.admin.organization.adminapikeys.AdminApiKeyDeleteResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + AdminApiKeyDeleteResponse adminApiKey = client.admin().organization().adminApiKeys().delete("key_id"); + } +} +``` + +#### Response + +```json +{ + "id": "key_abc", + "deleted": true, + "object": "organization.admin_api_key.deleted" +} +``` + +## Domain Types + +### Admin API Key + +- `class AdminApiKey:` + + Represents an individual Admin API key in an org. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `long createdAt` + + The Unix timestamp (in seconds) of when the API key was created + + - `JsonValue; object_ "organization.admin_api_key"constant` + + The object type, which is always `organization.admin_api_key` + + - `ORGANIZATION_ADMIN_API_KEY("organization.admin_api_key")` + + - `Owner owner` + + - `Optional id` + + The identifier, which can be referenced in API endpoints + + - `Optional createdAt` + + The Unix timestamp (in seconds) of when the user was created + + - `Optional name` + + The name of the user + + - `Optional object_` + + The object type, which is always organization.user + + - `Optional role` + + Always `owner` + + - `Optional type` + + Always `user` + + - `String redactedValue` + + The redacted value of the API key + + - `Optional lastUsedAt` + + The Unix timestamp (in seconds) of when the API key was last used + + - `Optional name` + + The name of the API key + +# Usage + +## Audio speeches + +`UsageAudioSpeechesResponse admin().organization().usage().audioSpeeches(UsageAudioSpeechesParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/usage/audio_speeches` + +Get audio speeches usage details for the organization. + +### Parameters + +- `UsageAudioSpeechesParams params` + + - `long startTime` + + Start time (Unix seconds) of the query time range, inclusive. + + - `Optional> apiKeyIds` + + Return only usage for these API keys. + + - `Optional bucketWidth` + + Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`. + + - `_1M("1m")` + + - `_1H("1h")` + + - `_1D("1d")` + + - `Optional endTime` + + End time (Unix seconds) of the query time range, exclusive. + + - `Optional> groupBy` + + Group the usage data by the specified fields. Support fields include `project_id`, `user_id`, `api_key_id`, `model` or any combination of them. + + - `PROJECT_ID("project_id")` + + - `USER_ID("user_id")` + + - `API_KEY_ID("api_key_id")` + + - `MODEL("model")` + + - `Optional limit` + + Specifies the number of buckets to return. + + - `bucket_width=1d`: default: 7, max: 31 + - `bucket_width=1h`: default: 24, max: 168 + - `bucket_width=1m`: default: 60, max: 1440 + + - `Optional> models` + + Return only usage for these models. + + - `Optional page` + + A cursor for use in pagination. Corresponding to the `next_page` field from the previous response. + + - `Optional> projectIds` + + Return only usage for these projects. + + - `Optional> userIds` + + Return only usage for these users. + +### Returns + +- `class UsageAudioSpeechesResponse:` + + - `List data` + + - `long endTime` + + - `JsonValue; object_ "bucket"constant` + + - `BUCKET("bucket")` + + - `List results` + + - `class OrganizationUsageCompletionsResult:` + + The aggregated completions usage details of the specific time bucket. + + - `long inputTokens` + + The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.completions.result"constant` + + - `ORGANIZATION_USAGE_COMPLETIONS_RESULT("organization.usage.completions.result")` + + - `long outputTokens` + + The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens. + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional batch` + + When `group_by=batch`, this field tells whether the grouped usage result is batch or not. + + - `Optional inputAudioTokens` + + The aggregated number of audio input tokens used, including cached tokens. + + - `Optional inputCachedTokens` + + The aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional outputAudioTokens` + + The aggregated number of audio output tokens used. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional serviceTier` + + When `group_by=service_tier`, this field provides the service tier of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageEmbeddingsResult:` + + The aggregated embeddings usage details of the specific time bucket. + + - `long inputTokens` + + The aggregated number of input tokens used. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.embeddings.result"constant` + + - `ORGANIZATION_USAGE_EMBEDDINGS_RESULT("organization.usage.embeddings.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageModerationsResult:` + + The aggregated moderations usage details of the specific time bucket. + + - `long inputTokens` + + The aggregated number of input tokens used. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.moderations.result"constant` + + - `ORGANIZATION_USAGE_MODERATIONS_RESULT("organization.usage.moderations.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageImagesResult:` + + The aggregated images usage details of the specific time bucket. + + - `long images` + + The number of images processed. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.images.result"constant` + + - `ORGANIZATION_USAGE_IMAGES_RESULT("organization.usage.images.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional size` + + When `group_by=size`, this field provides the image size of the grouped usage result. + + - `Optional source` + + When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageAudioSpeechesResult:` + + The aggregated audio speeches usage details of the specific time bucket. + + - `long characters` + + The number of characters processed. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.audio_speeches.result"constant` + + - `ORGANIZATION_USAGE_AUDIO_SPEECHES_RESULT("organization.usage.audio_speeches.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageAudioTranscriptionsResult:` + + The aggregated audio transcriptions usage details of the specific time bucket. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.audio_transcriptions.result"constant` + + - `ORGANIZATION_USAGE_AUDIO_TRANSCRIPTIONS_RESULT("organization.usage.audio_transcriptions.result")` + + - `long seconds` + + The number of seconds processed. + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageVectorStoresResult:` + + The aggregated vector stores usage details of the specific time bucket. + + - `JsonValue; object_ "organization.usage.vector_stores.result"constant` + + - `ORGANIZATION_USAGE_VECTOR_STORES_RESULT("organization.usage.vector_stores.result")` + + - `long usageBytes` + + The vector stores usage in bytes. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `class OrganizationUsageCodeInterpreterSessionsResult:` + + The aggregated code interpreter sessions usage details of the specific time bucket. + + - `long numSessions` + + The number of code interpreter sessions. + + - `JsonValue; object_ "organization.usage.code_interpreter_sessions.result"constant` + + - `ORGANIZATION_USAGE_CODE_INTERPRETER_SESSIONS_RESULT("organization.usage.code_interpreter_sessions.result")` + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `class OrganizationUsageFileSearchesResult:` + + The aggregated file search calls usage details of the specific time bucket. + + - `long numRequests` + + The count of file search calls. + + - `JsonValue; object_ "organization.usage.file_searches.result"constant` + + - `ORGANIZATION_USAGE_FILE_SEARCHES_RESULT("organization.usage.file_searches.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `Optional vectorStoreId` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `class OrganizationUsageWebSearchesResult:` + + The aggregated web search calls usage details of the specific time bucket. + + - `long numModelRequests` + + The count of model requests. + + - `long numRequests` + + The count of web search calls. + + - `JsonValue; object_ "organization.usage.web_searches.result"constant` + + - `ORGANIZATION_USAGE_WEB_SEARCHES_RESULT("organization.usage.web_searches.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional contextLevel` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationCostsResult:` + + The aggregated costs details of the specific time bucket. + + - `JsonValue; object_ "organization.costs.result"constant` + + - `ORGANIZATION_COSTS_RESULT("organization.costs.result")` + + - `Optional amount` + + The monetary value in its associated currency. + + - `Optional currency` + + Lowercase ISO-4217 currency e.g. "usd" + + - `Optional value` + + The numeric value of the cost. + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result. + + - `Optional lineItem` + + When `group_by=line_item`, this field provides the line item of the grouped costs result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped costs result. + + - `Optional quantity` + + When `group_by=line_item`, this field provides the quantity of the grouped costs result. + + - `long startTime` + + - `boolean hasMore` + + - `Optional nextPage` + + - `JsonValue; object_ "page"constant` + + - `PAGE("page")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.usage.UsageAudioSpeechesParams; +import com.openai.models.admin.organization.usage.UsageAudioSpeechesResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UsageAudioSpeechesParams params = UsageAudioSpeechesParams.builder() + .startTime(0L) + .build(); + UsageAudioSpeechesResponse response = client.admin().organization().usage().audioSpeeches(params); + } +} +``` + +#### Response + +```json +{ + "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" +} +``` + +## Audio transcriptions + +`UsageAudioTranscriptionsResponse admin().organization().usage().audioTranscriptions(UsageAudioTranscriptionsParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/usage/audio_transcriptions` + +Get audio transcriptions usage details for the organization. + +### Parameters + +- `UsageAudioTranscriptionsParams params` + + - `long startTime` + + Start time (Unix seconds) of the query time range, inclusive. + + - `Optional> apiKeyIds` + + Return only usage for these API keys. + + - `Optional bucketWidth` + + Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`. + + - `_1M("1m")` + + - `_1H("1h")` + + - `_1D("1d")` + + - `Optional endTime` + + End time (Unix seconds) of the query time range, exclusive. + + - `Optional> groupBy` + + Group the usage data by the specified fields. Support fields include `project_id`, `user_id`, `api_key_id`, `model` or any combination of them. + + - `PROJECT_ID("project_id")` + + - `USER_ID("user_id")` + + - `API_KEY_ID("api_key_id")` + + - `MODEL("model")` + + - `Optional limit` + + Specifies the number of buckets to return. + + - `bucket_width=1d`: default: 7, max: 31 + - `bucket_width=1h`: default: 24, max: 168 + - `bucket_width=1m`: default: 60, max: 1440 + + - `Optional> models` + + Return only usage for these models. + + - `Optional page` + + A cursor for use in pagination. Corresponding to the `next_page` field from the previous response. + + - `Optional> projectIds` + + Return only usage for these projects. + + - `Optional> userIds` + + Return only usage for these users. + +### Returns + +- `class UsageAudioTranscriptionsResponse:` + + - `List data` + + - `long endTime` + + - `JsonValue; object_ "bucket"constant` + + - `BUCKET("bucket")` + + - `List results` + + - `class OrganizationUsageCompletionsResult:` + + The aggregated completions usage details of the specific time bucket. + + - `long inputTokens` + + The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.completions.result"constant` + + - `ORGANIZATION_USAGE_COMPLETIONS_RESULT("organization.usage.completions.result")` + + - `long outputTokens` + + The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens. + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional batch` + + When `group_by=batch`, this field tells whether the grouped usage result is batch or not. + + - `Optional inputAudioTokens` + + The aggregated number of audio input tokens used, including cached tokens. + + - `Optional inputCachedTokens` + + The aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional outputAudioTokens` + + The aggregated number of audio output tokens used. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional serviceTier` + + When `group_by=service_tier`, this field provides the service tier of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageEmbeddingsResult:` + + The aggregated embeddings usage details of the specific time bucket. + + - `long inputTokens` + + The aggregated number of input tokens used. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.embeddings.result"constant` + + - `ORGANIZATION_USAGE_EMBEDDINGS_RESULT("organization.usage.embeddings.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageModerationsResult:` + + The aggregated moderations usage details of the specific time bucket. + + - `long inputTokens` + + The aggregated number of input tokens used. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.moderations.result"constant` + + - `ORGANIZATION_USAGE_MODERATIONS_RESULT("organization.usage.moderations.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageImagesResult:` + + The aggregated images usage details of the specific time bucket. + + - `long images` + + The number of images processed. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.images.result"constant` + + - `ORGANIZATION_USAGE_IMAGES_RESULT("organization.usage.images.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional size` + + When `group_by=size`, this field provides the image size of the grouped usage result. + + - `Optional source` + + When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageAudioSpeechesResult:` + + The aggregated audio speeches usage details of the specific time bucket. + + - `long characters` + + The number of characters processed. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.audio_speeches.result"constant` + + - `ORGANIZATION_USAGE_AUDIO_SPEECHES_RESULT("organization.usage.audio_speeches.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageAudioTranscriptionsResult:` + + The aggregated audio transcriptions usage details of the specific time bucket. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.audio_transcriptions.result"constant` + + - `ORGANIZATION_USAGE_AUDIO_TRANSCRIPTIONS_RESULT("organization.usage.audio_transcriptions.result")` + + - `long seconds` + + The number of seconds processed. + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageVectorStoresResult:` + + The aggregated vector stores usage details of the specific time bucket. + + - `JsonValue; object_ "organization.usage.vector_stores.result"constant` + + - `ORGANIZATION_USAGE_VECTOR_STORES_RESULT("organization.usage.vector_stores.result")` + + - `long usageBytes` + + The vector stores usage in bytes. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `class OrganizationUsageCodeInterpreterSessionsResult:` + + The aggregated code interpreter sessions usage details of the specific time bucket. + + - `long numSessions` + + The number of code interpreter sessions. + + - `JsonValue; object_ "organization.usage.code_interpreter_sessions.result"constant` + + - `ORGANIZATION_USAGE_CODE_INTERPRETER_SESSIONS_RESULT("organization.usage.code_interpreter_sessions.result")` + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `class OrganizationUsageFileSearchesResult:` + + The aggregated file search calls usage details of the specific time bucket. + + - `long numRequests` + + The count of file search calls. + + - `JsonValue; object_ "organization.usage.file_searches.result"constant` + + - `ORGANIZATION_USAGE_FILE_SEARCHES_RESULT("organization.usage.file_searches.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `Optional vectorStoreId` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `class OrganizationUsageWebSearchesResult:` + + The aggregated web search calls usage details of the specific time bucket. + + - `long numModelRequests` + + The count of model requests. + + - `long numRequests` + + The count of web search calls. + + - `JsonValue; object_ "organization.usage.web_searches.result"constant` + + - `ORGANIZATION_USAGE_WEB_SEARCHES_RESULT("organization.usage.web_searches.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional contextLevel` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationCostsResult:` + + The aggregated costs details of the specific time bucket. + + - `JsonValue; object_ "organization.costs.result"constant` + + - `ORGANIZATION_COSTS_RESULT("organization.costs.result")` + + - `Optional amount` + + The monetary value in its associated currency. + + - `Optional currency` + + Lowercase ISO-4217 currency e.g. "usd" + + - `Optional value` + + The numeric value of the cost. + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result. + + - `Optional lineItem` + + When `group_by=line_item`, this field provides the line item of the grouped costs result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped costs result. + + - `Optional quantity` + + When `group_by=line_item`, this field provides the quantity of the grouped costs result. + + - `long startTime` + + - `boolean hasMore` + + - `Optional nextPage` + + - `JsonValue; object_ "page"constant` + + - `PAGE("page")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.usage.UsageAudioTranscriptionsParams; +import com.openai.models.admin.organization.usage.UsageAudioTranscriptionsResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UsageAudioTranscriptionsParams params = UsageAudioTranscriptionsParams.builder() + .startTime(0L) + .build(); + UsageAudioTranscriptionsResponse response = client.admin().organization().usage().audioTranscriptions(params); + } +} +``` + +#### Response + +```json +{ + "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" +} +``` + +## Code interpreter sessions + +`UsageCodeInterpreterSessionsResponse admin().organization().usage().codeInterpreterSessions(UsageCodeInterpreterSessionsParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/usage/code_interpreter_sessions` + +Get code interpreter sessions usage details for the organization. + +### Parameters + +- `UsageCodeInterpreterSessionsParams params` + + - `long startTime` + + Start time (Unix seconds) of the query time range, inclusive. + + - `Optional bucketWidth` + + Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`. + + - `_1M("1m")` + + - `_1H("1h")` + + - `_1D("1d")` + + - `Optional endTime` + + End time (Unix seconds) of the query time range, exclusive. + + - `Optional> groupBy` + + Group the usage data by the specified fields. Support fields include `project_id`. + + - `PROJECT_ID("project_id")` + + - `Optional limit` + + Specifies the number of buckets to return. + + - `bucket_width=1d`: default: 7, max: 31 + - `bucket_width=1h`: default: 24, max: 168 + - `bucket_width=1m`: default: 60, max: 1440 + + - `Optional page` + + A cursor for use in pagination. Corresponding to the `next_page` field from the previous response. + + - `Optional> projectIds` + + Return only usage for these projects. + +### Returns + +- `class UsageCodeInterpreterSessionsResponse:` + + - `List data` + + - `long endTime` + + - `JsonValue; object_ "bucket"constant` + + - `BUCKET("bucket")` + + - `List results` + + - `class OrganizationUsageCompletionsResult:` + + The aggregated completions usage details of the specific time bucket. + + - `long inputTokens` + + The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.completions.result"constant` + + - `ORGANIZATION_USAGE_COMPLETIONS_RESULT("organization.usage.completions.result")` + + - `long outputTokens` + + The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens. + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional batch` + + When `group_by=batch`, this field tells whether the grouped usage result is batch or not. + + - `Optional inputAudioTokens` + + The aggregated number of audio input tokens used, including cached tokens. + + - `Optional inputCachedTokens` + + The aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional outputAudioTokens` + + The aggregated number of audio output tokens used. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional serviceTier` + + When `group_by=service_tier`, this field provides the service tier of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageEmbeddingsResult:` + + The aggregated embeddings usage details of the specific time bucket. + + - `long inputTokens` + + The aggregated number of input tokens used. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.embeddings.result"constant` + + - `ORGANIZATION_USAGE_EMBEDDINGS_RESULT("organization.usage.embeddings.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageModerationsResult:` + + The aggregated moderations usage details of the specific time bucket. + + - `long inputTokens` + + The aggregated number of input tokens used. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.moderations.result"constant` + + - `ORGANIZATION_USAGE_MODERATIONS_RESULT("organization.usage.moderations.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageImagesResult:` + + The aggregated images usage details of the specific time bucket. + + - `long images` + + The number of images processed. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.images.result"constant` + + - `ORGANIZATION_USAGE_IMAGES_RESULT("organization.usage.images.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional size` + + When `group_by=size`, this field provides the image size of the grouped usage result. + + - `Optional source` + + When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageAudioSpeechesResult:` + + The aggregated audio speeches usage details of the specific time bucket. + + - `long characters` + + The number of characters processed. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.audio_speeches.result"constant` + + - `ORGANIZATION_USAGE_AUDIO_SPEECHES_RESULT("organization.usage.audio_speeches.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageAudioTranscriptionsResult:` + + The aggregated audio transcriptions usage details of the specific time bucket. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.audio_transcriptions.result"constant` + + - `ORGANIZATION_USAGE_AUDIO_TRANSCRIPTIONS_RESULT("organization.usage.audio_transcriptions.result")` + + - `long seconds` + + The number of seconds processed. + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageVectorStoresResult:` + + The aggregated vector stores usage details of the specific time bucket. + + - `JsonValue; object_ "organization.usage.vector_stores.result"constant` + + - `ORGANIZATION_USAGE_VECTOR_STORES_RESULT("organization.usage.vector_stores.result")` + + - `long usageBytes` + + The vector stores usage in bytes. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `class OrganizationUsageCodeInterpreterSessionsResult:` + + The aggregated code interpreter sessions usage details of the specific time bucket. + + - `long numSessions` + + The number of code interpreter sessions. + + - `JsonValue; object_ "organization.usage.code_interpreter_sessions.result"constant` + + - `ORGANIZATION_USAGE_CODE_INTERPRETER_SESSIONS_RESULT("organization.usage.code_interpreter_sessions.result")` + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `class OrganizationUsageFileSearchesResult:` + + The aggregated file search calls usage details of the specific time bucket. + + - `long numRequests` + + The count of file search calls. + + - `JsonValue; object_ "organization.usage.file_searches.result"constant` + + - `ORGANIZATION_USAGE_FILE_SEARCHES_RESULT("organization.usage.file_searches.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `Optional vectorStoreId` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `class OrganizationUsageWebSearchesResult:` + + The aggregated web search calls usage details of the specific time bucket. + + - `long numModelRequests` + + The count of model requests. + + - `long numRequests` + + The count of web search calls. + + - `JsonValue; object_ "organization.usage.web_searches.result"constant` + + - `ORGANIZATION_USAGE_WEB_SEARCHES_RESULT("organization.usage.web_searches.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional contextLevel` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationCostsResult:` + + The aggregated costs details of the specific time bucket. + + - `JsonValue; object_ "organization.costs.result"constant` + + - `ORGANIZATION_COSTS_RESULT("organization.costs.result")` + + - `Optional amount` + + The monetary value in its associated currency. + + - `Optional currency` + + Lowercase ISO-4217 currency e.g. "usd" + + - `Optional value` + + The numeric value of the cost. + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result. + + - `Optional lineItem` + + When `group_by=line_item`, this field provides the line item of the grouped costs result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped costs result. + + - `Optional quantity` + + When `group_by=line_item`, this field provides the quantity of the grouped costs result. + + - `long startTime` + + - `boolean hasMore` + + - `Optional nextPage` + + - `JsonValue; object_ "page"constant` + + - `PAGE("page")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.usage.UsageCodeInterpreterSessionsParams; +import com.openai.models.admin.organization.usage.UsageCodeInterpreterSessionsResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UsageCodeInterpreterSessionsParams params = UsageCodeInterpreterSessionsParams.builder() + .startTime(0L) + .build(); + UsageCodeInterpreterSessionsResponse response = client.admin().organization().usage().codeInterpreterSessions(params); + } +} +``` + +#### Response + +```json +{ + "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" +} +``` + +## Completions + +`UsageCompletionsResponse admin().organization().usage().completions(UsageCompletionsParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/usage/completions` + +Get completions usage details for the organization. + +### Parameters + +- `UsageCompletionsParams params` + + - `long startTime` + + Start time (Unix seconds) of the query time range, inclusive. + + - `Optional> apiKeyIds` + + Return only usage for these API keys. + + - `Optional batch` + + If `true`, return batch jobs only. If `false`, return non-batch jobs only. By default, return both. + + - `Optional bucketWidth` + + Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`. + + - `_1M("1m")` + + - `_1H("1h")` + + - `_1D("1d")` + + - `Optional endTime` + + End time (Unix seconds) of the query time range, exclusive. + + - `Optional> groupBy` + + Group the usage data by the specified fields. Support fields include `project_id`, `user_id`, `api_key_id`, `model`, `batch`, `service_tier` or any combination of them. + + - `PROJECT_ID("project_id")` + + - `USER_ID("user_id")` + + - `API_KEY_ID("api_key_id")` + + - `MODEL("model")` + + - `BATCH("batch")` + + - `SERVICE_TIER("service_tier")` + + - `Optional limit` + + Specifies the number of buckets to return. + + - `bucket_width=1d`: default: 7, max: 31 + - `bucket_width=1h`: default: 24, max: 168 + - `bucket_width=1m`: default: 60, max: 1440 + + - `Optional> models` + + Return only usage for these models. + + - `Optional page` + + A cursor for use in pagination. Corresponding to the `next_page` field from the previous response. + + - `Optional> projectIds` + + Return only usage for these projects. + + - `Optional> userIds` + + Return only usage for these users. + +### Returns + +- `class UsageCompletionsResponse:` + + - `List data` + + - `long endTime` + + - `JsonValue; object_ "bucket"constant` + + - `BUCKET("bucket")` + + - `List results` + + - `class OrganizationUsageCompletionsResult:` + + The aggregated completions usage details of the specific time bucket. + + - `long inputTokens` + + The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.completions.result"constant` + + - `ORGANIZATION_USAGE_COMPLETIONS_RESULT("organization.usage.completions.result")` + + - `long outputTokens` + + The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens. + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional batch` + + When `group_by=batch`, this field tells whether the grouped usage result is batch or not. + + - `Optional inputAudioTokens` + + The aggregated number of audio input tokens used, including cached tokens. + + - `Optional inputCachedTokens` + + The aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional outputAudioTokens` + + The aggregated number of audio output tokens used. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional serviceTier` + + When `group_by=service_tier`, this field provides the service tier of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageEmbeddingsResult:` + + The aggregated embeddings usage details of the specific time bucket. + + - `long inputTokens` + + The aggregated number of input tokens used. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.embeddings.result"constant` + + - `ORGANIZATION_USAGE_EMBEDDINGS_RESULT("organization.usage.embeddings.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageModerationsResult:` + + The aggregated moderations usage details of the specific time bucket. + + - `long inputTokens` + + The aggregated number of input tokens used. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.moderations.result"constant` + + - `ORGANIZATION_USAGE_MODERATIONS_RESULT("organization.usage.moderations.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageImagesResult:` + + The aggregated images usage details of the specific time bucket. + + - `long images` + + The number of images processed. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.images.result"constant` + + - `ORGANIZATION_USAGE_IMAGES_RESULT("organization.usage.images.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional size` + + When `group_by=size`, this field provides the image size of the grouped usage result. + + - `Optional source` + + When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageAudioSpeechesResult:` + + The aggregated audio speeches usage details of the specific time bucket. + + - `long characters` + + The number of characters processed. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.audio_speeches.result"constant` + + - `ORGANIZATION_USAGE_AUDIO_SPEECHES_RESULT("organization.usage.audio_speeches.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageAudioTranscriptionsResult:` + + The aggregated audio transcriptions usage details of the specific time bucket. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.audio_transcriptions.result"constant` + + - `ORGANIZATION_USAGE_AUDIO_TRANSCRIPTIONS_RESULT("organization.usage.audio_transcriptions.result")` + + - `long seconds` + + The number of seconds processed. + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageVectorStoresResult:` + + The aggregated vector stores usage details of the specific time bucket. + + - `JsonValue; object_ "organization.usage.vector_stores.result"constant` + + - `ORGANIZATION_USAGE_VECTOR_STORES_RESULT("organization.usage.vector_stores.result")` + + - `long usageBytes` + + The vector stores usage in bytes. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `class OrganizationUsageCodeInterpreterSessionsResult:` + + The aggregated code interpreter sessions usage details of the specific time bucket. + + - `long numSessions` + + The number of code interpreter sessions. + + - `JsonValue; object_ "organization.usage.code_interpreter_sessions.result"constant` + + - `ORGANIZATION_USAGE_CODE_INTERPRETER_SESSIONS_RESULT("organization.usage.code_interpreter_sessions.result")` + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `class OrganizationUsageFileSearchesResult:` + + The aggregated file search calls usage details of the specific time bucket. + + - `long numRequests` + + The count of file search calls. + + - `JsonValue; object_ "organization.usage.file_searches.result"constant` + + - `ORGANIZATION_USAGE_FILE_SEARCHES_RESULT("organization.usage.file_searches.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `Optional vectorStoreId` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `class OrganizationUsageWebSearchesResult:` + + The aggregated web search calls usage details of the specific time bucket. + + - `long numModelRequests` + + The count of model requests. + + - `long numRequests` + + The count of web search calls. + + - `JsonValue; object_ "organization.usage.web_searches.result"constant` + + - `ORGANIZATION_USAGE_WEB_SEARCHES_RESULT("organization.usage.web_searches.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional contextLevel` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationCostsResult:` + + The aggregated costs details of the specific time bucket. + + - `JsonValue; object_ "organization.costs.result"constant` + + - `ORGANIZATION_COSTS_RESULT("organization.costs.result")` + + - `Optional amount` + + The monetary value in its associated currency. + + - `Optional currency` + + Lowercase ISO-4217 currency e.g. "usd" + + - `Optional value` + + The numeric value of the cost. + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result. + + - `Optional lineItem` + + When `group_by=line_item`, this field provides the line item of the grouped costs result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped costs result. + + - `Optional quantity` + + When `group_by=line_item`, this field provides the quantity of the grouped costs result. + + - `long startTime` + + - `boolean hasMore` + + - `Optional nextPage` + + - `JsonValue; object_ "page"constant` + + - `PAGE("page")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.usage.UsageCompletionsParams; +import com.openai.models.admin.organization.usage.UsageCompletionsResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UsageCompletionsParams params = UsageCompletionsParams.builder() + .startTime(0L) + .build(); + UsageCompletionsResponse response = client.admin().organization().usage().completions(params); + } +} +``` + +#### Response + +```json +{ + "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" +} +``` + +## Embeddings + +`UsageEmbeddingsResponse admin().organization().usage().embeddings(UsageEmbeddingsParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/usage/embeddings` + +Get embeddings usage details for the organization. + +### Parameters + +- `UsageEmbeddingsParams params` + + - `long startTime` + + Start time (Unix seconds) of the query time range, inclusive. + + - `Optional> apiKeyIds` + + Return only usage for these API keys. + + - `Optional bucketWidth` + + Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`. + + - `_1M("1m")` + + - `_1H("1h")` + + - `_1D("1d")` + + - `Optional endTime` + + End time (Unix seconds) of the query time range, exclusive. + + - `Optional> groupBy` + + Group the usage data by the specified fields. Support fields include `project_id`, `user_id`, `api_key_id`, `model` or any combination of them. + + - `PROJECT_ID("project_id")` + + - `USER_ID("user_id")` + + - `API_KEY_ID("api_key_id")` + + - `MODEL("model")` + + - `Optional limit` + + Specifies the number of buckets to return. + + - `bucket_width=1d`: default: 7, max: 31 + - `bucket_width=1h`: default: 24, max: 168 + - `bucket_width=1m`: default: 60, max: 1440 + + - `Optional> models` + + Return only usage for these models. + + - `Optional page` + + A cursor for use in pagination. Corresponding to the `next_page` field from the previous response. + + - `Optional> projectIds` + + Return only usage for these projects. + + - `Optional> userIds` + + Return only usage for these users. + +### Returns + +- `class UsageEmbeddingsResponse:` + + - `List data` + + - `long endTime` + + - `JsonValue; object_ "bucket"constant` + + - `BUCKET("bucket")` + + - `List results` + + - `class OrganizationUsageCompletionsResult:` + + The aggregated completions usage details of the specific time bucket. + + - `long inputTokens` + + The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.completions.result"constant` + + - `ORGANIZATION_USAGE_COMPLETIONS_RESULT("organization.usage.completions.result")` + + - `long outputTokens` + + The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens. + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional batch` + + When `group_by=batch`, this field tells whether the grouped usage result is batch or not. + + - `Optional inputAudioTokens` + + The aggregated number of audio input tokens used, including cached tokens. + + - `Optional inputCachedTokens` + + The aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional outputAudioTokens` + + The aggregated number of audio output tokens used. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional serviceTier` + + When `group_by=service_tier`, this field provides the service tier of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageEmbeddingsResult:` + + The aggregated embeddings usage details of the specific time bucket. + + - `long inputTokens` + + The aggregated number of input tokens used. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.embeddings.result"constant` + + - `ORGANIZATION_USAGE_EMBEDDINGS_RESULT("organization.usage.embeddings.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageModerationsResult:` + + The aggregated moderations usage details of the specific time bucket. + + - `long inputTokens` + + The aggregated number of input tokens used. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.moderations.result"constant` + + - `ORGANIZATION_USAGE_MODERATIONS_RESULT("organization.usage.moderations.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageImagesResult:` + + The aggregated images usage details of the specific time bucket. + + - `long images` + + The number of images processed. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.images.result"constant` + + - `ORGANIZATION_USAGE_IMAGES_RESULT("organization.usage.images.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional size` + + When `group_by=size`, this field provides the image size of the grouped usage result. + + - `Optional source` + + When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageAudioSpeechesResult:` + + The aggregated audio speeches usage details of the specific time bucket. + + - `long characters` + + The number of characters processed. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.audio_speeches.result"constant` + + - `ORGANIZATION_USAGE_AUDIO_SPEECHES_RESULT("organization.usage.audio_speeches.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageAudioTranscriptionsResult:` + + The aggregated audio transcriptions usage details of the specific time bucket. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.audio_transcriptions.result"constant` + + - `ORGANIZATION_USAGE_AUDIO_TRANSCRIPTIONS_RESULT("organization.usage.audio_transcriptions.result")` + + - `long seconds` + + The number of seconds processed. + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageVectorStoresResult:` + + The aggregated vector stores usage details of the specific time bucket. + + - `JsonValue; object_ "organization.usage.vector_stores.result"constant` + + - `ORGANIZATION_USAGE_VECTOR_STORES_RESULT("organization.usage.vector_stores.result")` + + - `long usageBytes` + + The vector stores usage in bytes. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `class OrganizationUsageCodeInterpreterSessionsResult:` + + The aggregated code interpreter sessions usage details of the specific time bucket. + + - `long numSessions` + + The number of code interpreter sessions. + + - `JsonValue; object_ "organization.usage.code_interpreter_sessions.result"constant` + + - `ORGANIZATION_USAGE_CODE_INTERPRETER_SESSIONS_RESULT("organization.usage.code_interpreter_sessions.result")` + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `class OrganizationUsageFileSearchesResult:` + + The aggregated file search calls usage details of the specific time bucket. + + - `long numRequests` + + The count of file search calls. + + - `JsonValue; object_ "organization.usage.file_searches.result"constant` + + - `ORGANIZATION_USAGE_FILE_SEARCHES_RESULT("organization.usage.file_searches.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `Optional vectorStoreId` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `class OrganizationUsageWebSearchesResult:` + + The aggregated web search calls usage details of the specific time bucket. + + - `long numModelRequests` + + The count of model requests. + + - `long numRequests` + + The count of web search calls. + + - `JsonValue; object_ "organization.usage.web_searches.result"constant` + + - `ORGANIZATION_USAGE_WEB_SEARCHES_RESULT("organization.usage.web_searches.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional contextLevel` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationCostsResult:` + + The aggregated costs details of the specific time bucket. + + - `JsonValue; object_ "organization.costs.result"constant` + + - `ORGANIZATION_COSTS_RESULT("organization.costs.result")` + + - `Optional amount` + + The monetary value in its associated currency. + + - `Optional currency` + + Lowercase ISO-4217 currency e.g. "usd" + + - `Optional value` + + The numeric value of the cost. + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result. + + - `Optional lineItem` + + When `group_by=line_item`, this field provides the line item of the grouped costs result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped costs result. + + - `Optional quantity` + + When `group_by=line_item`, this field provides the quantity of the grouped costs result. + + - `long startTime` + + - `boolean hasMore` + + - `Optional nextPage` + + - `JsonValue; object_ "page"constant` + + - `PAGE("page")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.usage.UsageEmbeddingsParams; +import com.openai.models.admin.organization.usage.UsageEmbeddingsResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UsageEmbeddingsParams params = UsageEmbeddingsParams.builder() + .startTime(0L) + .build(); + UsageEmbeddingsResponse response = client.admin().organization().usage().embeddings(params); + } +} +``` + +#### Response + +```json +{ + "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" +} +``` + +## Images + +`UsageImagesResponse admin().organization().usage().images(UsageImagesParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/usage/images` + +Get images usage details for the organization. + +### Parameters + +- `UsageImagesParams params` + + - `long startTime` + + Start time (Unix seconds) of the query time range, inclusive. + + - `Optional> apiKeyIds` + + Return only usage for these API keys. + + - `Optional bucketWidth` + + Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`. + + - `_1M("1m")` + + - `_1H("1h")` + + - `_1D("1d")` + + - `Optional endTime` + + End time (Unix seconds) of the query time range, exclusive. + + - `Optional> groupBy` + + Group the usage data by the specified fields. Support fields include `project_id`, `user_id`, `api_key_id`, `model`, `size`, `source` or any combination of them. + + - `PROJECT_ID("project_id")` + + - `USER_ID("user_id")` + + - `API_KEY_ID("api_key_id")` + + - `MODEL("model")` + + - `SIZE("size")` + + - `SOURCE("source")` + + - `Optional limit` + + Specifies the number of buckets to return. + + - `bucket_width=1d`: default: 7, max: 31 + - `bucket_width=1h`: default: 24, max: 168 + - `bucket_width=1m`: default: 60, max: 1440 + + - `Optional> models` + + Return only usage for these models. + + - `Optional page` + + A cursor for use in pagination. Corresponding to the `next_page` field from the previous response. + + - `Optional> projectIds` + + Return only usage for these projects. + + - `Optional> sizes` + + Return only usages for these image sizes. Possible values are `256x256`, `512x512`, `1024x1024`, `1792x1792`, `1024x1792` or any combination of them. + + - `_256X256("256x256")` + + - `_512X512("512x512")` + + - `_1024X1024("1024x1024")` + + - `_1792X1792("1792x1792")` + + - `_1024X1792("1024x1792")` + + - `Optional> sources` + + Return only usages for these sources. Possible values are `image.generation`, `image.edit`, `image.variation` or any combination of them. + + - `IMAGE_GENERATION("image.generation")` + + - `IMAGE_EDIT("image.edit")` + + - `IMAGE_VARIATION("image.variation")` + + - `Optional> userIds` + + Return only usage for these users. + +### Returns + +- `class UsageImagesResponse:` + + - `List data` + + - `long endTime` + + - `JsonValue; object_ "bucket"constant` + + - `BUCKET("bucket")` + + - `List results` + + - `class OrganizationUsageCompletionsResult:` + + The aggregated completions usage details of the specific time bucket. + + - `long inputTokens` + + The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.completions.result"constant` + + - `ORGANIZATION_USAGE_COMPLETIONS_RESULT("organization.usage.completions.result")` + + - `long outputTokens` + + The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens. + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional batch` + + When `group_by=batch`, this field tells whether the grouped usage result is batch or not. + + - `Optional inputAudioTokens` + + The aggregated number of audio input tokens used, including cached tokens. + + - `Optional inputCachedTokens` + + The aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional outputAudioTokens` + + The aggregated number of audio output tokens used. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional serviceTier` + + When `group_by=service_tier`, this field provides the service tier of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageEmbeddingsResult:` + + The aggregated embeddings usage details of the specific time bucket. + + - `long inputTokens` + + The aggregated number of input tokens used. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.embeddings.result"constant` + + - `ORGANIZATION_USAGE_EMBEDDINGS_RESULT("organization.usage.embeddings.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageModerationsResult:` + + The aggregated moderations usage details of the specific time bucket. + + - `long inputTokens` + + The aggregated number of input tokens used. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.moderations.result"constant` + + - `ORGANIZATION_USAGE_MODERATIONS_RESULT("organization.usage.moderations.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageImagesResult:` + + The aggregated images usage details of the specific time bucket. + + - `long images` + + The number of images processed. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.images.result"constant` + + - `ORGANIZATION_USAGE_IMAGES_RESULT("organization.usage.images.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional size` + + When `group_by=size`, this field provides the image size of the grouped usage result. + + - `Optional source` + + When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageAudioSpeechesResult:` + + The aggregated audio speeches usage details of the specific time bucket. + + - `long characters` + + The number of characters processed. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.audio_speeches.result"constant` + + - `ORGANIZATION_USAGE_AUDIO_SPEECHES_RESULT("organization.usage.audio_speeches.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageAudioTranscriptionsResult:` + + The aggregated audio transcriptions usage details of the specific time bucket. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.audio_transcriptions.result"constant` + + - `ORGANIZATION_USAGE_AUDIO_TRANSCRIPTIONS_RESULT("organization.usage.audio_transcriptions.result")` + + - `long seconds` + + The number of seconds processed. + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageVectorStoresResult:` + + The aggregated vector stores usage details of the specific time bucket. + + - `JsonValue; object_ "organization.usage.vector_stores.result"constant` + + - `ORGANIZATION_USAGE_VECTOR_STORES_RESULT("organization.usage.vector_stores.result")` + + - `long usageBytes` + + The vector stores usage in bytes. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `class OrganizationUsageCodeInterpreterSessionsResult:` + + The aggregated code interpreter sessions usage details of the specific time bucket. + + - `long numSessions` + + The number of code interpreter sessions. + + - `JsonValue; object_ "organization.usage.code_interpreter_sessions.result"constant` + + - `ORGANIZATION_USAGE_CODE_INTERPRETER_SESSIONS_RESULT("organization.usage.code_interpreter_sessions.result")` + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `class OrganizationUsageFileSearchesResult:` + + The aggregated file search calls usage details of the specific time bucket. + + - `long numRequests` + + The count of file search calls. + + - `JsonValue; object_ "organization.usage.file_searches.result"constant` + + - `ORGANIZATION_USAGE_FILE_SEARCHES_RESULT("organization.usage.file_searches.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `Optional vectorStoreId` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `class OrganizationUsageWebSearchesResult:` + + The aggregated web search calls usage details of the specific time bucket. + + - `long numModelRequests` + + The count of model requests. + + - `long numRequests` + + The count of web search calls. + + - `JsonValue; object_ "organization.usage.web_searches.result"constant` + + - `ORGANIZATION_USAGE_WEB_SEARCHES_RESULT("organization.usage.web_searches.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional contextLevel` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationCostsResult:` + + The aggregated costs details of the specific time bucket. + + - `JsonValue; object_ "organization.costs.result"constant` + + - `ORGANIZATION_COSTS_RESULT("organization.costs.result")` + + - `Optional amount` + + The monetary value in its associated currency. + + - `Optional currency` + + Lowercase ISO-4217 currency e.g. "usd" + + - `Optional value` + + The numeric value of the cost. + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result. + + - `Optional lineItem` + + When `group_by=line_item`, this field provides the line item of the grouped costs result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped costs result. + + - `Optional quantity` + + When `group_by=line_item`, this field provides the quantity of the grouped costs result. + + - `long startTime` + + - `boolean hasMore` + + - `Optional nextPage` + + - `JsonValue; object_ "page"constant` + + - `PAGE("page")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.usage.UsageImagesParams; +import com.openai.models.admin.organization.usage.UsageImagesResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UsageImagesParams params = UsageImagesParams.builder() + .startTime(0L) + .build(); + UsageImagesResponse response = client.admin().organization().usage().images(params); + } +} +``` + +#### Response + +```json +{ + "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" +} +``` + +## Moderations + +`UsageModerationsResponse admin().organization().usage().moderations(UsageModerationsParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/usage/moderations` + +Get moderations usage details for the organization. + +### Parameters + +- `UsageModerationsParams params` + + - `long startTime` + + Start time (Unix seconds) of the query time range, inclusive. + + - `Optional> apiKeyIds` + + Return only usage for these API keys. + + - `Optional bucketWidth` + + Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`. + + - `_1M("1m")` + + - `_1H("1h")` + + - `_1D("1d")` + + - `Optional endTime` + + End time (Unix seconds) of the query time range, exclusive. + + - `Optional> groupBy` + + Group the usage data by the specified fields. Support fields include `project_id`, `user_id`, `api_key_id`, `model` or any combination of them. + + - `PROJECT_ID("project_id")` + + - `USER_ID("user_id")` + + - `API_KEY_ID("api_key_id")` + + - `MODEL("model")` + + - `Optional limit` + + Specifies the number of buckets to return. + + - `bucket_width=1d`: default: 7, max: 31 + - `bucket_width=1h`: default: 24, max: 168 + - `bucket_width=1m`: default: 60, max: 1440 + + - `Optional> models` + + Return only usage for these models. + + - `Optional page` + + A cursor for use in pagination. Corresponding to the `next_page` field from the previous response. + + - `Optional> projectIds` + + Return only usage for these projects. + + - `Optional> userIds` + + Return only usage for these users. + +### Returns + +- `class UsageModerationsResponse:` + + - `List data` + + - `long endTime` + + - `JsonValue; object_ "bucket"constant` + + - `BUCKET("bucket")` + + - `List results` + + - `class OrganizationUsageCompletionsResult:` + + The aggregated completions usage details of the specific time bucket. + + - `long inputTokens` + + The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.completions.result"constant` + + - `ORGANIZATION_USAGE_COMPLETIONS_RESULT("organization.usage.completions.result")` + + - `long outputTokens` + + The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens. + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional batch` + + When `group_by=batch`, this field tells whether the grouped usage result is batch or not. + + - `Optional inputAudioTokens` + + The aggregated number of audio input tokens used, including cached tokens. + + - `Optional inputCachedTokens` + + The aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional outputAudioTokens` + + The aggregated number of audio output tokens used. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional serviceTier` + + When `group_by=service_tier`, this field provides the service tier of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageEmbeddingsResult:` + + The aggregated embeddings usage details of the specific time bucket. + + - `long inputTokens` + + The aggregated number of input tokens used. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.embeddings.result"constant` + + - `ORGANIZATION_USAGE_EMBEDDINGS_RESULT("organization.usage.embeddings.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageModerationsResult:` + + The aggregated moderations usage details of the specific time bucket. + + - `long inputTokens` + + The aggregated number of input tokens used. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.moderations.result"constant` + + - `ORGANIZATION_USAGE_MODERATIONS_RESULT("organization.usage.moderations.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageImagesResult:` + + The aggregated images usage details of the specific time bucket. + + - `long images` + + The number of images processed. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.images.result"constant` + + - `ORGANIZATION_USAGE_IMAGES_RESULT("organization.usage.images.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional size` + + When `group_by=size`, this field provides the image size of the grouped usage result. + + - `Optional source` + + When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageAudioSpeechesResult:` + + The aggregated audio speeches usage details of the specific time bucket. + + - `long characters` + + The number of characters processed. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.audio_speeches.result"constant` + + - `ORGANIZATION_USAGE_AUDIO_SPEECHES_RESULT("organization.usage.audio_speeches.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageAudioTranscriptionsResult:` + + The aggregated audio transcriptions usage details of the specific time bucket. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.audio_transcriptions.result"constant` + + - `ORGANIZATION_USAGE_AUDIO_TRANSCRIPTIONS_RESULT("organization.usage.audio_transcriptions.result")` + + - `long seconds` + + The number of seconds processed. + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageVectorStoresResult:` + + The aggregated vector stores usage details of the specific time bucket. + + - `JsonValue; object_ "organization.usage.vector_stores.result"constant` + + - `ORGANIZATION_USAGE_VECTOR_STORES_RESULT("organization.usage.vector_stores.result")` + + - `long usageBytes` + + The vector stores usage in bytes. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `class OrganizationUsageCodeInterpreterSessionsResult:` + + The aggregated code interpreter sessions usage details of the specific time bucket. + + - `long numSessions` + + The number of code interpreter sessions. + + - `JsonValue; object_ "organization.usage.code_interpreter_sessions.result"constant` + + - `ORGANIZATION_USAGE_CODE_INTERPRETER_SESSIONS_RESULT("organization.usage.code_interpreter_sessions.result")` + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `class OrganizationUsageFileSearchesResult:` + + The aggregated file search calls usage details of the specific time bucket. + + - `long numRequests` + + The count of file search calls. + + - `JsonValue; object_ "organization.usage.file_searches.result"constant` + + - `ORGANIZATION_USAGE_FILE_SEARCHES_RESULT("organization.usage.file_searches.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `Optional vectorStoreId` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `class OrganizationUsageWebSearchesResult:` + + The aggregated web search calls usage details of the specific time bucket. + + - `long numModelRequests` + + The count of model requests. + + - `long numRequests` + + The count of web search calls. + + - `JsonValue; object_ "organization.usage.web_searches.result"constant` + + - `ORGANIZATION_USAGE_WEB_SEARCHES_RESULT("organization.usage.web_searches.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional contextLevel` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationCostsResult:` + + The aggregated costs details of the specific time bucket. + + - `JsonValue; object_ "organization.costs.result"constant` + + - `ORGANIZATION_COSTS_RESULT("organization.costs.result")` + + - `Optional amount` + + The monetary value in its associated currency. + + - `Optional currency` + + Lowercase ISO-4217 currency e.g. "usd" + + - `Optional value` + + The numeric value of the cost. + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result. + + - `Optional lineItem` + + When `group_by=line_item`, this field provides the line item of the grouped costs result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped costs result. + + - `Optional quantity` + + When `group_by=line_item`, this field provides the quantity of the grouped costs result. + + - `long startTime` + + - `boolean hasMore` + + - `Optional nextPage` + + - `JsonValue; object_ "page"constant` + + - `PAGE("page")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.usage.UsageModerationsParams; +import com.openai.models.admin.organization.usage.UsageModerationsResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UsageModerationsParams params = UsageModerationsParams.builder() + .startTime(0L) + .build(); + UsageModerationsResponse response = client.admin().organization().usage().moderations(params); + } +} +``` + +#### Response + +```json +{ + "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" +} +``` + +## Vector stores + +`UsageVectorStoresResponse admin().organization().usage().vectorStores(UsageVectorStoresParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/usage/vector_stores` + +Get vector stores usage details for the organization. + +### Parameters + +- `UsageVectorStoresParams params` + + - `long startTime` + + Start time (Unix seconds) of the query time range, inclusive. + + - `Optional bucketWidth` + + Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`. + + - `_1M("1m")` + + - `_1H("1h")` + + - `_1D("1d")` + + - `Optional endTime` + + End time (Unix seconds) of the query time range, exclusive. + + - `Optional> groupBy` + + Group the usage data by the specified fields. Support fields include `project_id`. + + - `PROJECT_ID("project_id")` + + - `Optional limit` + + Specifies the number of buckets to return. + + - `bucket_width=1d`: default: 7, max: 31 + - `bucket_width=1h`: default: 24, max: 168 + - `bucket_width=1m`: default: 60, max: 1440 + + - `Optional page` + + A cursor for use in pagination. Corresponding to the `next_page` field from the previous response. + + - `Optional> projectIds` + + Return only usage for these projects. + +### Returns + +- `class UsageVectorStoresResponse:` + + - `List data` + + - `long endTime` + + - `JsonValue; object_ "bucket"constant` + + - `BUCKET("bucket")` + + - `List results` + + - `class OrganizationUsageCompletionsResult:` + + The aggregated completions usage details of the specific time bucket. + + - `long inputTokens` + + The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.completions.result"constant` + + - `ORGANIZATION_USAGE_COMPLETIONS_RESULT("organization.usage.completions.result")` + + - `long outputTokens` + + The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens. + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional batch` + + When `group_by=batch`, this field tells whether the grouped usage result is batch or not. + + - `Optional inputAudioTokens` + + The aggregated number of audio input tokens used, including cached tokens. + + - `Optional inputCachedTokens` + + The aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional outputAudioTokens` + + The aggregated number of audio output tokens used. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional serviceTier` + + When `group_by=service_tier`, this field provides the service tier of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageEmbeddingsResult:` + + The aggregated embeddings usage details of the specific time bucket. + + - `long inputTokens` + + The aggregated number of input tokens used. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.embeddings.result"constant` + + - `ORGANIZATION_USAGE_EMBEDDINGS_RESULT("organization.usage.embeddings.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageModerationsResult:` + + The aggregated moderations usage details of the specific time bucket. + + - `long inputTokens` + + The aggregated number of input tokens used. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.moderations.result"constant` + + - `ORGANIZATION_USAGE_MODERATIONS_RESULT("organization.usage.moderations.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageImagesResult:` + + The aggregated images usage details of the specific time bucket. + + - `long images` + + The number of images processed. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.images.result"constant` + + - `ORGANIZATION_USAGE_IMAGES_RESULT("organization.usage.images.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional size` + + When `group_by=size`, this field provides the image size of the grouped usage result. + + - `Optional source` + + When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageAudioSpeechesResult:` + + The aggregated audio speeches usage details of the specific time bucket. + + - `long characters` + + The number of characters processed. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.audio_speeches.result"constant` + + - `ORGANIZATION_USAGE_AUDIO_SPEECHES_RESULT("organization.usage.audio_speeches.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageAudioTranscriptionsResult:` + + The aggregated audio transcriptions usage details of the specific time bucket. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.audio_transcriptions.result"constant` + + - `ORGANIZATION_USAGE_AUDIO_TRANSCRIPTIONS_RESULT("organization.usage.audio_transcriptions.result")` + + - `long seconds` + + The number of seconds processed. + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageVectorStoresResult:` + + The aggregated vector stores usage details of the specific time bucket. + + - `JsonValue; object_ "organization.usage.vector_stores.result"constant` + + - `ORGANIZATION_USAGE_VECTOR_STORES_RESULT("organization.usage.vector_stores.result")` + + - `long usageBytes` + + The vector stores usage in bytes. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `class OrganizationUsageCodeInterpreterSessionsResult:` + + The aggregated code interpreter sessions usage details of the specific time bucket. + + - `long numSessions` + + The number of code interpreter sessions. + + - `JsonValue; object_ "organization.usage.code_interpreter_sessions.result"constant` + + - `ORGANIZATION_USAGE_CODE_INTERPRETER_SESSIONS_RESULT("organization.usage.code_interpreter_sessions.result")` + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `class OrganizationUsageFileSearchesResult:` + + The aggregated file search calls usage details of the specific time bucket. + + - `long numRequests` + + The count of file search calls. + + - `JsonValue; object_ "organization.usage.file_searches.result"constant` + + - `ORGANIZATION_USAGE_FILE_SEARCHES_RESULT("organization.usage.file_searches.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `Optional vectorStoreId` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `class OrganizationUsageWebSearchesResult:` + + The aggregated web search calls usage details of the specific time bucket. + + - `long numModelRequests` + + The count of model requests. + + - `long numRequests` + + The count of web search calls. + + - `JsonValue; object_ "organization.usage.web_searches.result"constant` + + - `ORGANIZATION_USAGE_WEB_SEARCHES_RESULT("organization.usage.web_searches.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional contextLevel` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationCostsResult:` + + The aggregated costs details of the specific time bucket. + + - `JsonValue; object_ "organization.costs.result"constant` + + - `ORGANIZATION_COSTS_RESULT("organization.costs.result")` + + - `Optional amount` + + The monetary value in its associated currency. + + - `Optional currency` + + Lowercase ISO-4217 currency e.g. "usd" + + - `Optional value` + + The numeric value of the cost. + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result. + + - `Optional lineItem` + + When `group_by=line_item`, this field provides the line item of the grouped costs result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped costs result. + + - `Optional quantity` + + When `group_by=line_item`, this field provides the quantity of the grouped costs result. + + - `long startTime` + + - `boolean hasMore` + + - `Optional nextPage` + + - `JsonValue; object_ "page"constant` + + - `PAGE("page")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.usage.UsageVectorStoresParams; +import com.openai.models.admin.organization.usage.UsageVectorStoresResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UsageVectorStoresParams params = UsageVectorStoresParams.builder() + .startTime(0L) + .build(); + UsageVectorStoresResponse response = client.admin().organization().usage().vectorStores(params); + } +} +``` + +#### Response + +```json +{ + "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" +} +``` + +## File search calls + +`UsageFileSearchCallsResponse admin().organization().usage().fileSearchCalls(UsageFileSearchCallsParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/usage/file_search_calls` + +Get file search calls usage details for the organization. + +### Parameters + +- `UsageFileSearchCallsParams params` + + - `long startTime` + + Start time (Unix seconds) of the query time range, inclusive. + + - `Optional> apiKeyIds` + + Return only usage for these API keys. + + - `Optional bucketWidth` + + Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`. + + - `_1M("1m")` + + - `_1H("1h")` + + - `_1D("1d")` + + - `Optional endTime` + + End time (Unix seconds) of the query time range, exclusive. + + - `Optional> groupBy` + + Group the usage data by the specified fields. Support fields include `project_id`, `user_id`, `api_key_id`, `vector_store_id` or any combination of them. + + - `PROJECT_ID("project_id")` + + - `USER_ID("user_id")` + + - `API_KEY_ID("api_key_id")` + + - `VECTOR_STORE_ID("vector_store_id")` + + - `Optional limit` + + Specifies the number of buckets to return. + + - `bucket_width=1d`: default: 7, max: 31 + - `bucket_width=1h`: default: 24, max: 168 + - `bucket_width=1m`: default: 60, max: 1440 + + - `Optional page` + + A cursor for use in pagination. Corresponding to the `next_page` field from the previous response. + + - `Optional> projectIds` + + Return only usage for these projects. + + - `Optional> userIds` + + Return only usage for these users. + + - `Optional> vectorStoreIds` + + Return only usage for these vector stores. + +### Returns + +- `class UsageFileSearchCallsResponse:` + + - `List data` + + - `long endTime` + + - `JsonValue; object_ "bucket"constant` + + - `BUCKET("bucket")` + + - `List results` + + - `class OrganizationUsageCompletionsResult:` + + The aggregated completions usage details of the specific time bucket. + + - `long inputTokens` + + The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.completions.result"constant` + + - `ORGANIZATION_USAGE_COMPLETIONS_RESULT("organization.usage.completions.result")` + + - `long outputTokens` + + The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens. + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional batch` + + When `group_by=batch`, this field tells whether the grouped usage result is batch or not. + + - `Optional inputAudioTokens` + + The aggregated number of audio input tokens used, including cached tokens. + + - `Optional inputCachedTokens` + + The aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional outputAudioTokens` + + The aggregated number of audio output tokens used. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional serviceTier` + + When `group_by=service_tier`, this field provides the service tier of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageEmbeddingsResult:` + + The aggregated embeddings usage details of the specific time bucket. + + - `long inputTokens` + + The aggregated number of input tokens used. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.embeddings.result"constant` + + - `ORGANIZATION_USAGE_EMBEDDINGS_RESULT("organization.usage.embeddings.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageModerationsResult:` + + The aggregated moderations usage details of the specific time bucket. + + - `long inputTokens` + + The aggregated number of input tokens used. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.moderations.result"constant` + + - `ORGANIZATION_USAGE_MODERATIONS_RESULT("organization.usage.moderations.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageImagesResult:` + + The aggregated images usage details of the specific time bucket. + + - `long images` + + The number of images processed. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.images.result"constant` + + - `ORGANIZATION_USAGE_IMAGES_RESULT("organization.usage.images.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional size` + + When `group_by=size`, this field provides the image size of the grouped usage result. + + - `Optional source` + + When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageAudioSpeechesResult:` + + The aggregated audio speeches usage details of the specific time bucket. + + - `long characters` + + The number of characters processed. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.audio_speeches.result"constant` + + - `ORGANIZATION_USAGE_AUDIO_SPEECHES_RESULT("organization.usage.audio_speeches.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageAudioTranscriptionsResult:` + + The aggregated audio transcriptions usage details of the specific time bucket. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.audio_transcriptions.result"constant` + + - `ORGANIZATION_USAGE_AUDIO_TRANSCRIPTIONS_RESULT("organization.usage.audio_transcriptions.result")` + + - `long seconds` + + The number of seconds processed. + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageVectorStoresResult:` + + The aggregated vector stores usage details of the specific time bucket. + + - `JsonValue; object_ "organization.usage.vector_stores.result"constant` + + - `ORGANIZATION_USAGE_VECTOR_STORES_RESULT("organization.usage.vector_stores.result")` + + - `long usageBytes` + + The vector stores usage in bytes. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `class OrganizationUsageCodeInterpreterSessionsResult:` + + The aggregated code interpreter sessions usage details of the specific time bucket. + + - `long numSessions` + + The number of code interpreter sessions. + + - `JsonValue; object_ "organization.usage.code_interpreter_sessions.result"constant` + + - `ORGANIZATION_USAGE_CODE_INTERPRETER_SESSIONS_RESULT("organization.usage.code_interpreter_sessions.result")` + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `class OrganizationUsageFileSearchesResult:` + + The aggregated file search calls usage details of the specific time bucket. + + - `long numRequests` + + The count of file search calls. + + - `JsonValue; object_ "organization.usage.file_searches.result"constant` + + - `ORGANIZATION_USAGE_FILE_SEARCHES_RESULT("organization.usage.file_searches.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `Optional vectorStoreId` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `class OrganizationUsageWebSearchesResult:` + + The aggregated web search calls usage details of the specific time bucket. + + - `long numModelRequests` + + The count of model requests. + + - `long numRequests` + + The count of web search calls. + + - `JsonValue; object_ "organization.usage.web_searches.result"constant` + + - `ORGANIZATION_USAGE_WEB_SEARCHES_RESULT("organization.usage.web_searches.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional contextLevel` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationCostsResult:` + + The aggregated costs details of the specific time bucket. + + - `JsonValue; object_ "organization.costs.result"constant` + + - `ORGANIZATION_COSTS_RESULT("organization.costs.result")` + + - `Optional amount` + + The monetary value in its associated currency. + + - `Optional currency` + + Lowercase ISO-4217 currency e.g. "usd" + + - `Optional value` + + The numeric value of the cost. + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result. + + - `Optional lineItem` + + When `group_by=line_item`, this field provides the line item of the grouped costs result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped costs result. + + - `Optional quantity` + + When `group_by=line_item`, this field provides the quantity of the grouped costs result. + + - `long startTime` + + - `boolean hasMore` + + - `Optional nextPage` + + - `JsonValue; object_ "page"constant` + + - `PAGE("page")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.usage.UsageFileSearchCallsParams; +import com.openai.models.admin.organization.usage.UsageFileSearchCallsResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UsageFileSearchCallsParams params = UsageFileSearchCallsParams.builder() + .startTime(0L) + .build(); + UsageFileSearchCallsResponse response = client.admin().organization().usage().fileSearchCalls(params); + } +} +``` + +#### Response + +```json +{ + "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" +} +``` + +## Web search calls + +`UsageWebSearchCallsResponse admin().organization().usage().webSearchCalls(UsageWebSearchCallsParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/usage/web_search_calls` + +Get web search calls usage details for the organization. + +### Parameters + +- `UsageWebSearchCallsParams params` + + - `long startTime` + + Start time (Unix seconds) of the query time range, inclusive. + + - `Optional> apiKeyIds` + + Return only usage for these API keys. + + - `Optional bucketWidth` + + Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`. + + - `_1M("1m")` + + - `_1H("1h")` + + - `_1D("1d")` + + - `Optional> contextLevels` + + Return only web search usage for these context levels. + + - `LOW("low")` + + - `MEDIUM("medium")` + + - `HIGH("high")` + + - `Optional endTime` + + End time (Unix seconds) of the query time range, exclusive. + + - `Optional> groupBy` + + Group the usage data by the specified fields. Support fields include `project_id`, `user_id`, `api_key_id`, `model`, `context_level` or any combination of them. + + - `PROJECT_ID("project_id")` + + - `USER_ID("user_id")` + + - `API_KEY_ID("api_key_id")` + + - `MODEL("model")` + + - `CONTEXT_LEVEL("context_level")` + + - `Optional limit` + + Specifies the number of buckets to return. + + - `bucket_width=1d`: default: 7, max: 31 + - `bucket_width=1h`: default: 24, max: 168 + - `bucket_width=1m`: default: 60, max: 1440 + + - `Optional> models` + + Return only usage for these models. + + - `Optional page` + + A cursor for use in pagination. Corresponding to the `next_page` field from the previous response. + + - `Optional> projectIds` + + Return only usage for these projects. + + - `Optional> userIds` + + Return only usage for these users. + +### Returns + +- `class UsageWebSearchCallsResponse:` + + - `List data` + + - `long endTime` + + - `JsonValue; object_ "bucket"constant` + + - `BUCKET("bucket")` + + - `List results` + + - `class OrganizationUsageCompletionsResult:` + + The aggregated completions usage details of the specific time bucket. + + - `long inputTokens` + + The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.completions.result"constant` + + - `ORGANIZATION_USAGE_COMPLETIONS_RESULT("organization.usage.completions.result")` + + - `long outputTokens` + + The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens. + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional batch` + + When `group_by=batch`, this field tells whether the grouped usage result is batch or not. + + - `Optional inputAudioTokens` + + The aggregated number of audio input tokens used, including cached tokens. + + - `Optional inputCachedTokens` + + The aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional outputAudioTokens` + + The aggregated number of audio output tokens used. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional serviceTier` + + When `group_by=service_tier`, this field provides the service tier of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageEmbeddingsResult:` + + The aggregated embeddings usage details of the specific time bucket. + + - `long inputTokens` + + The aggregated number of input tokens used. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.embeddings.result"constant` + + - `ORGANIZATION_USAGE_EMBEDDINGS_RESULT("organization.usage.embeddings.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageModerationsResult:` + + The aggregated moderations usage details of the specific time bucket. + + - `long inputTokens` + + The aggregated number of input tokens used. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.moderations.result"constant` + + - `ORGANIZATION_USAGE_MODERATIONS_RESULT("organization.usage.moderations.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageImagesResult:` + + The aggregated images usage details of the specific time bucket. + + - `long images` + + The number of images processed. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.images.result"constant` + + - `ORGANIZATION_USAGE_IMAGES_RESULT("organization.usage.images.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional size` + + When `group_by=size`, this field provides the image size of the grouped usage result. + + - `Optional source` + + When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageAudioSpeechesResult:` + + The aggregated audio speeches usage details of the specific time bucket. + + - `long characters` + + The number of characters processed. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.audio_speeches.result"constant` + + - `ORGANIZATION_USAGE_AUDIO_SPEECHES_RESULT("organization.usage.audio_speeches.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageAudioTranscriptionsResult:` + + The aggregated audio transcriptions usage details of the specific time bucket. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.audio_transcriptions.result"constant` + + - `ORGANIZATION_USAGE_AUDIO_TRANSCRIPTIONS_RESULT("organization.usage.audio_transcriptions.result")` + + - `long seconds` + + The number of seconds processed. + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageVectorStoresResult:` + + The aggregated vector stores usage details of the specific time bucket. + + - `JsonValue; object_ "organization.usage.vector_stores.result"constant` + + - `ORGANIZATION_USAGE_VECTOR_STORES_RESULT("organization.usage.vector_stores.result")` + + - `long usageBytes` + + The vector stores usage in bytes. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `class OrganizationUsageCodeInterpreterSessionsResult:` + + The aggregated code interpreter sessions usage details of the specific time bucket. + + - `long numSessions` + + The number of code interpreter sessions. + + - `JsonValue; object_ "organization.usage.code_interpreter_sessions.result"constant` + + - `ORGANIZATION_USAGE_CODE_INTERPRETER_SESSIONS_RESULT("organization.usage.code_interpreter_sessions.result")` + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `class OrganizationUsageFileSearchesResult:` + + The aggregated file search calls usage details of the specific time bucket. + + - `long numRequests` + + The count of file search calls. + + - `JsonValue; object_ "organization.usage.file_searches.result"constant` + + - `ORGANIZATION_USAGE_FILE_SEARCHES_RESULT("organization.usage.file_searches.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `Optional vectorStoreId` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `class OrganizationUsageWebSearchesResult:` + + The aggregated web search calls usage details of the specific time bucket. + + - `long numModelRequests` + + The count of model requests. + + - `long numRequests` + + The count of web search calls. + + - `JsonValue; object_ "organization.usage.web_searches.result"constant` + + - `ORGANIZATION_USAGE_WEB_SEARCHES_RESULT("organization.usage.web_searches.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional contextLevel` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationCostsResult:` + + The aggregated costs details of the specific time bucket. + + - `JsonValue; object_ "organization.costs.result"constant` + + - `ORGANIZATION_COSTS_RESULT("organization.costs.result")` + + - `Optional amount` + + The monetary value in its associated currency. + + - `Optional currency` + + Lowercase ISO-4217 currency e.g. "usd" + + - `Optional value` + + The numeric value of the cost. + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result. + + - `Optional lineItem` + + When `group_by=line_item`, this field provides the line item of the grouped costs result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped costs result. + + - `Optional quantity` + + When `group_by=line_item`, this field provides the quantity of the grouped costs result. + + - `long startTime` + + - `boolean hasMore` + + - `Optional nextPage` + + - `JsonValue; object_ "page"constant` + + - `PAGE("page")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.usage.UsageWebSearchCallsParams; +import com.openai.models.admin.organization.usage.UsageWebSearchCallsResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UsageWebSearchCallsParams params = UsageWebSearchCallsParams.builder() + .startTime(0L) + .build(); + UsageWebSearchCallsResponse response = client.admin().organization().usage().webSearchCalls(params); + } +} +``` + +#### Response + +```json +{ + "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" +} +``` + +## Costs + +`UsageCostsResponse admin().organization().usage().costs(UsageCostsParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/costs` + +Get costs details for the organization. + +### Parameters + +- `UsageCostsParams params` + + - `long startTime` + + Start time (Unix seconds) of the query time range, inclusive. + + - `Optional> apiKeyIds` + + Return only costs for these API keys. + + - `Optional bucketWidth` + + Width of each time bucket in response. Currently only `1d` is supported, default to `1d`. + + - `_1D("1d")` + + - `Optional endTime` + + End time (Unix seconds) of the query time range, exclusive. + + - `Optional> groupBy` + + Group the costs by the specified fields. Support fields include `project_id`, `line_item`, `api_key_id` and any combination of them. + + - `PROJECT_ID("project_id")` + + - `LINE_ITEM("line_item")` + + - `API_KEY_ID("api_key_id")` + + - `Optional limit` + + A limit on the number of buckets to be returned. Limit can range between 1 and 180, and the default is 7. + + - `Optional page` + + A cursor for use in pagination. Corresponding to the `next_page` field from the previous response. + + - `Optional> projectIds` + + Return only costs for these projects. + +### Returns + +- `class UsageCostsResponse:` + + - `List data` + + - `long endTime` + + - `JsonValue; object_ "bucket"constant` + + - `BUCKET("bucket")` + + - `List results` + + - `class OrganizationUsageCompletionsResult:` + + The aggregated completions usage details of the specific time bucket. + + - `long inputTokens` + + The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.completions.result"constant` + + - `ORGANIZATION_USAGE_COMPLETIONS_RESULT("organization.usage.completions.result")` + + - `long outputTokens` + + The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens. + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional batch` + + When `group_by=batch`, this field tells whether the grouped usage result is batch or not. + + - `Optional inputAudioTokens` + + The aggregated number of audio input tokens used, including cached tokens. + + - `Optional inputCachedTokens` + + The aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional outputAudioTokens` + + The aggregated number of audio output tokens used. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional serviceTier` + + When `group_by=service_tier`, this field provides the service tier of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageEmbeddingsResult:` + + The aggregated embeddings usage details of the specific time bucket. + + - `long inputTokens` + + The aggregated number of input tokens used. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.embeddings.result"constant` + + - `ORGANIZATION_USAGE_EMBEDDINGS_RESULT("organization.usage.embeddings.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageModerationsResult:` + + The aggregated moderations usage details of the specific time bucket. + + - `long inputTokens` + + The aggregated number of input tokens used. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.moderations.result"constant` + + - `ORGANIZATION_USAGE_MODERATIONS_RESULT("organization.usage.moderations.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageImagesResult:` + + The aggregated images usage details of the specific time bucket. + + - `long images` + + The number of images processed. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.images.result"constant` + + - `ORGANIZATION_USAGE_IMAGES_RESULT("organization.usage.images.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional size` + + When `group_by=size`, this field provides the image size of the grouped usage result. + + - `Optional source` + + When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageAudioSpeechesResult:` + + The aggregated audio speeches usage details of the specific time bucket. + + - `long characters` + + The number of characters processed. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.audio_speeches.result"constant` + + - `ORGANIZATION_USAGE_AUDIO_SPEECHES_RESULT("organization.usage.audio_speeches.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageAudioTranscriptionsResult:` + + The aggregated audio transcriptions usage details of the specific time bucket. + + - `long numModelRequests` + + The count of requests made to the model. + + - `JsonValue; object_ "organization.usage.audio_transcriptions.result"constant` + + - `ORGANIZATION_USAGE_AUDIO_TRANSCRIPTIONS_RESULT("organization.usage.audio_transcriptions.result")` + + - `long seconds` + + The number of seconds processed. + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationUsageVectorStoresResult:` + + The aggregated vector stores usage details of the specific time bucket. + + - `JsonValue; object_ "organization.usage.vector_stores.result"constant` + + - `ORGANIZATION_USAGE_VECTOR_STORES_RESULT("organization.usage.vector_stores.result")` + + - `long usageBytes` + + The vector stores usage in bytes. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `class OrganizationUsageCodeInterpreterSessionsResult:` + + The aggregated code interpreter sessions usage details of the specific time bucket. + + - `long numSessions` + + The number of code interpreter sessions. + + - `JsonValue; object_ "organization.usage.code_interpreter_sessions.result"constant` + + - `ORGANIZATION_USAGE_CODE_INTERPRETER_SESSIONS_RESULT("organization.usage.code_interpreter_sessions.result")` + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `class OrganizationUsageFileSearchesResult:` + + The aggregated file search calls usage details of the specific time bucket. + + - `long numRequests` + + The count of file search calls. + + - `JsonValue; object_ "organization.usage.file_searches.result"constant` + + - `ORGANIZATION_USAGE_FILE_SEARCHES_RESULT("organization.usage.file_searches.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `Optional vectorStoreId` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `class OrganizationUsageWebSearchesResult:` + + The aggregated web search calls usage details of the specific time bucket. + + - `long numModelRequests` + + The count of model requests. + + - `long numRequests` + + The count of web search calls. + + - `JsonValue; object_ "organization.usage.web_searches.result"constant` + + - `ORGANIZATION_USAGE_WEB_SEARCHES_RESULT("organization.usage.web_searches.result")` + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Optional contextLevel` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `Optional model` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Optional userId` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationCostsResult:` + + The aggregated costs details of the specific time bucket. + + - `JsonValue; object_ "organization.costs.result"constant` + + - `ORGANIZATION_COSTS_RESULT("organization.costs.result")` + + - `Optional amount` + + The monetary value in its associated currency. + + - `Optional currency` + + Lowercase ISO-4217 currency e.g. "usd" + + - `Optional value` + + The numeric value of the cost. + + - `Optional apiKeyId` + + When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result. + + - `Optional lineItem` + + When `group_by=line_item`, this field provides the line item of the grouped costs result. + + - `Optional projectId` + + When `group_by=project_id`, this field provides the project ID of the grouped costs result. + + - `Optional quantity` + + When `group_by=line_item`, this field provides the quantity of the grouped costs result. + + - `long startTime` + + - `boolean hasMore` + + - `Optional nextPage` + + - `JsonValue; object_ "page"constant` + + - `PAGE("page")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.usage.UsageCostsParams; +import com.openai.models.admin.organization.usage.UsageCostsResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UsageCostsParams params = UsageCostsParams.builder() + .startTime(0L) + .build(); + UsageCostsResponse response = client.admin().organization().usage().costs(params); + } +} +``` + +#### Response + +```json +{ + "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" +} +``` + +# Invites + +## List invites + +`InviteListPage admin().organization().invites().list(InviteListParamsparams = InviteListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/invites` + +Returns a list of invites in the organization. + +### Parameters + +- `InviteListParams params` + + - `Optional after` + + A cursor for use in pagination. `after` is 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. + + - `Optional limit` + + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + +### Returns + +- `class Invite:` + + Represents an individual `invite` to the organization. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `long createdAt` + + The Unix timestamp (in seconds) of when the invite was sent. + + - `String email` + + The email address of the individual to whom the invite was sent + + - `JsonValue; object_ "organization.invite"constant` + + The object type, which is always `organization.invite` + + - `ORGANIZATION_INVITE("organization.invite")` + + - `List projects` + + The projects that were granted membership upon acceptance of the invite. + + - `String id` + + Project's public ID + + - `Role role` + + Project membership role + + - `MEMBER("member")` + + - `OWNER("owner")` + + - `Role role` + + `owner` or `reader` + + - `OWNER("owner")` + + - `READER("reader")` + + - `Status status` + + `accepted`,`expired`, or `pending` + + - `ACCEPTED("accepted")` + + - `EXPIRED("expired")` + + - `PENDING("pending")` + + - `Optional acceptedAt` + + The Unix timestamp (in seconds) of when the invite was accepted. + + - `Optional expiresAt` + + The Unix timestamp (in seconds) of when the invite expires. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.invites.InviteListPage; +import com.openai.models.admin.organization.invites.InviteListParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + InviteListPage page = client.admin().organization().invites().list(); + } +} +``` + +#### Response + +```json +{ + "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" +} +``` + +## Create invite + +`Invite admin().organization().invites().create(InviteCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/organization/invites` + +Create an invite for a user to the organization. The invite must be accepted by the user before they have access to the organization. + +### Parameters + +- `InviteCreateParams params` + + - `String email` + + Send an email to this address + + - `Role role` + + `owner` or `reader` + + - `READER("reader")` + + - `OWNER("owner")` + + - `Optional> projects` + + 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. + + - `String id` + + Project's public ID + + - `Role role` + + Project membership role + + - `MEMBER("member")` + + - `OWNER("owner")` + +### Returns + +- `class Invite:` + + Represents an individual `invite` to the organization. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `long createdAt` + + The Unix timestamp (in seconds) of when the invite was sent. + + - `String email` + + The email address of the individual to whom the invite was sent + + - `JsonValue; object_ "organization.invite"constant` + + The object type, which is always `organization.invite` + + - `ORGANIZATION_INVITE("organization.invite")` + + - `List projects` + + The projects that were granted membership upon acceptance of the invite. + + - `String id` + + Project's public ID + + - `Role role` + + Project membership role + + - `MEMBER("member")` + + - `OWNER("owner")` + + - `Role role` + + `owner` or `reader` + + - `OWNER("owner")` + + - `READER("reader")` + + - `Status status` + + `accepted`,`expired`, or `pending` + + - `ACCEPTED("accepted")` + + - `EXPIRED("expired")` + + - `PENDING("pending")` + + - `Optional acceptedAt` + + The Unix timestamp (in seconds) of when the invite was accepted. + + - `Optional expiresAt` + + The Unix timestamp (in seconds) of when the invite expires. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.invites.Invite; +import com.openai.models.admin.organization.invites.InviteCreateParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + InviteCreateParams params = InviteCreateParams.builder() + .email("email") + .role(InviteCreateParams.Role.READER) + .build(); + Invite invite = client.admin().organization().invites().create(params); + } +} +``` + +#### Response + +```json +{ + "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 +} +``` + +## Retrieve invite + +`Invite admin().organization().invites().retrieve(InviteRetrieveParamsparams = InviteRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/invites/{invite_id}` + +Retrieves an invite. + +### Parameters + +- `InviteRetrieveParams params` + + - `Optional inviteId` + +### Returns + +- `class Invite:` + + Represents an individual `invite` to the organization. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `long createdAt` + + The Unix timestamp (in seconds) of when the invite was sent. + + - `String email` + + The email address of the individual to whom the invite was sent + + - `JsonValue; object_ "organization.invite"constant` + + The object type, which is always `organization.invite` + + - `ORGANIZATION_INVITE("organization.invite")` + + - `List projects` + + The projects that were granted membership upon acceptance of the invite. + + - `String id` + + Project's public ID + + - `Role role` + + Project membership role + + - `MEMBER("member")` + + - `OWNER("owner")` + + - `Role role` + + `owner` or `reader` + + - `OWNER("owner")` + + - `READER("reader")` + + - `Status status` + + `accepted`,`expired`, or `pending` + + - `ACCEPTED("accepted")` + + - `EXPIRED("expired")` + + - `PENDING("pending")` + + - `Optional acceptedAt` + + The Unix timestamp (in seconds) of when the invite was accepted. + + - `Optional expiresAt` + + The Unix timestamp (in seconds) of when the invite expires. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.invites.Invite; +import com.openai.models.admin.organization.invites.InviteRetrieveParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Invite invite = client.admin().organization().invites().retrieve("invite_id"); + } +} +``` + +#### Response + +```json +{ + "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 +} +``` + +## Delete invite + +`InviteDeleteResponse admin().organization().invites().delete(InviteDeleteParamsparams = InviteDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**delete** `/organization/invites/{invite_id}` + +Delete an invite. If the invite has already been accepted, it cannot be deleted. + +### Parameters + +- `InviteDeleteParams params` + + - `Optional inviteId` + +### Returns + +- `class InviteDeleteResponse:` + + - `String id` + + - `boolean deleted` + + - `JsonValue; object_ "organization.invite.deleted"constant` + + The object type, which is always `organization.invite.deleted` + + - `ORGANIZATION_INVITE_DELETED("organization.invite.deleted")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.invites.InviteDeleteParams; +import com.openai.models.admin.organization.invites.InviteDeleteResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + InviteDeleteResponse invite = client.admin().organization().invites().delete("invite_id"); + } +} +``` + +#### Response + +```json +{ + "id": "id", + "deleted": true, + "object": "organization.invite.deleted" +} +``` + +## Domain Types + +### Invite + +- `class Invite:` + + Represents an individual `invite` to the organization. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `long createdAt` + + The Unix timestamp (in seconds) of when the invite was sent. + + - `String email` + + The email address of the individual to whom the invite was sent + + - `JsonValue; object_ "organization.invite"constant` + + The object type, which is always `organization.invite` + + - `ORGANIZATION_INVITE("organization.invite")` + + - `List projects` + + The projects that were granted membership upon acceptance of the invite. + + - `String id` + + Project's public ID + + - `Role role` + + Project membership role + + - `MEMBER("member")` + + - `OWNER("owner")` + + - `Role role` + + `owner` or `reader` + + - `OWNER("owner")` + + - `READER("reader")` + + - `Status status` + + `accepted`,`expired`, or `pending` + + - `ACCEPTED("accepted")` + + - `EXPIRED("expired")` + + - `PENDING("pending")` + + - `Optional acceptedAt` + + The Unix timestamp (in seconds) of when the invite was accepted. + + - `Optional expiresAt` + + The Unix timestamp (in seconds) of when the invite expires. + +# Users + +## List users + +`UserListPage admin().organization().users().list(UserListParamsparams = UserListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/users` + +Lists all of the users in the organization. + +### Parameters + +- `UserListParams params` + + - `Optional after` + + A cursor for use in pagination. `after` is 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. + + - `Optional> emails` + + Filter by the email address of users. + + - `Optional limit` + + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + +### Returns + +- `class OrganizationUser:` + + Represents an individual `user` within an organization. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `long addedAt` + + The Unix timestamp (in seconds) of when the user was added. + + - `JsonValue; object_ "organization.user"constant` + + The object type, which is always `organization.user` + + - `ORGANIZATION_USER("organization.user")` + + - `Optional apiKeyLastUsedAt` + + The Unix timestamp (in seconds) of the user's last API key usage. + + - `Optional created` + + The Unix timestamp (in seconds) of when the user was created. + + - `Optional developerPersona` + + The developer persona metadata for the user. + + - `Optional email` + + The email address of the user + + - `Optional isDefault` + + Whether this is the organization's default user. + + - `Optional isScaleTierAuthorizedPurchaser` + + Whether the user is an authorized purchaser for Scale Tier. + + - `Optional isScimManaged` + + Whether the user is managed through SCIM. + + - `Optional isServiceAccount` + + Whether the user is a service account. + + - `Optional name` + + The name of the user + + - `Optional projects` + + Projects associated with the user, if included. + + - `List data` + + - `Optional id` + + - `Optional name` + + - `Optional role` + + - `JsonValue; object_ "list"constant` + + - `LIST("list")` + + - `Optional role` + + `owner` or `reader` + + - `Optional technicalLevel` + + The technical level metadata for the user. + + - `Optional user` + + Nested user details. + + - `String id` + + - `JsonValue; object_ "user"constant` + + - `USER("user")` + + - `Optional banned` + + - `Optional bannedAt` + + - `Optional email` + + - `Optional enabled` + + - `Optional name` + + - `Optional picture` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.users.UserListPage; +import com.openai.models.admin.organization.users.UserListParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UserListPage page = client.admin().organization().users().list(); + } +} +``` + +#### Response + +```json +{ + "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" +} +``` + +## Retrieve user + +`OrganizationUser admin().organization().users().retrieve(UserRetrieveParamsparams = UserRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/users/{user_id}` + +Retrieves a user by their identifier. + +### Parameters + +- `UserRetrieveParams params` + + - `Optional userId` + +### Returns + +- `class OrganizationUser:` + + Represents an individual `user` within an organization. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `long addedAt` + + The Unix timestamp (in seconds) of when the user was added. + + - `JsonValue; object_ "organization.user"constant` + + The object type, which is always `organization.user` + + - `ORGANIZATION_USER("organization.user")` + + - `Optional apiKeyLastUsedAt` + + The Unix timestamp (in seconds) of the user's last API key usage. + + - `Optional created` + + The Unix timestamp (in seconds) of when the user was created. + + - `Optional developerPersona` + + The developer persona metadata for the user. + + - `Optional email` + + The email address of the user + + - `Optional isDefault` + + Whether this is the organization's default user. + + - `Optional isScaleTierAuthorizedPurchaser` + + Whether the user is an authorized purchaser for Scale Tier. + + - `Optional isScimManaged` + + Whether the user is managed through SCIM. + + - `Optional isServiceAccount` + + Whether the user is a service account. + + - `Optional name` + + The name of the user + + - `Optional projects` + + Projects associated with the user, if included. + + - `List data` + + - `Optional id` + + - `Optional name` + + - `Optional role` + + - `JsonValue; object_ "list"constant` + + - `LIST("list")` + + - `Optional role` + + `owner` or `reader` + + - `Optional technicalLevel` + + The technical level metadata for the user. + + - `Optional user` + + Nested user details. + + - `String id` + + - `JsonValue; object_ "user"constant` + + - `USER("user")` + + - `Optional banned` + + - `Optional bannedAt` + + - `Optional email` + + - `Optional enabled` + + - `Optional name` + + - `Optional picture` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.users.OrganizationUser; +import com.openai.models.admin.organization.users.UserRetrieveParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + OrganizationUser organizationUser = client.admin().organization().users().retrieve("user_id"); + } +} +``` + +#### Response + +```json +{ + "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" + } +} +``` + +## Modify user + +`OrganizationUser admin().organization().users().update(UserUpdateParamsparams = UserUpdateParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/organization/users/{user_id}` + +Modifies a user's role in the organization. + +### Parameters + +- `UserUpdateParams params` + + - `Optional userId` + + - `Optional developerPersona` + + Developer persona metadata. + + - `Optional role` + + `owner` or `reader` + + - `Optional roleId` + + Role ID to assign to the user. + + - `Optional technicalLevel` + + Technical level metadata. + +### Returns + +- `class OrganizationUser:` + + Represents an individual `user` within an organization. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `long addedAt` + + The Unix timestamp (in seconds) of when the user was added. + + - `JsonValue; object_ "organization.user"constant` + + The object type, which is always `organization.user` + + - `ORGANIZATION_USER("organization.user")` + + - `Optional apiKeyLastUsedAt` + + The Unix timestamp (in seconds) of the user's last API key usage. + + - `Optional created` + + The Unix timestamp (in seconds) of when the user was created. + + - `Optional developerPersona` + + The developer persona metadata for the user. + + - `Optional email` + + The email address of the user + + - `Optional isDefault` + + Whether this is the organization's default user. + + - `Optional isScaleTierAuthorizedPurchaser` + + Whether the user is an authorized purchaser for Scale Tier. + + - `Optional isScimManaged` + + Whether the user is managed through SCIM. + + - `Optional isServiceAccount` + + Whether the user is a service account. + + - `Optional name` + + The name of the user + + - `Optional projects` + + Projects associated with the user, if included. + + - `List data` + + - `Optional id` + + - `Optional name` + + - `Optional role` + + - `JsonValue; object_ "list"constant` + + - `LIST("list")` + + - `Optional role` + + `owner` or `reader` + + - `Optional technicalLevel` + + The technical level metadata for the user. + + - `Optional user` + + Nested user details. + + - `String id` + + - `JsonValue; object_ "user"constant` + + - `USER("user")` + + - `Optional banned` + + - `Optional bannedAt` + + - `Optional email` + + - `Optional enabled` + + - `Optional name` + + - `Optional picture` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.users.OrganizationUser; +import com.openai.models.admin.organization.users.UserUpdateParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + OrganizationUser organizationUser = client.admin().organization().users().update("user_id"); + } +} +``` + +#### Response + +```json +{ + "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" + } +} +``` + +## Delete user + +`UserDeleteResponse admin().organization().users().delete(UserDeleteParamsparams = UserDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**delete** `/organization/users/{user_id}` + +Deletes a user from the organization. + +### Parameters + +- `UserDeleteParams params` + + - `Optional userId` + +### Returns + +- `class UserDeleteResponse:` + + - `String id` + + - `boolean deleted` + + - `JsonValue; object_ "organization.user.deleted"constant` + + - `ORGANIZATION_USER_DELETED("organization.user.deleted")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.users.UserDeleteParams; +import com.openai.models.admin.organization.users.UserDeleteResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UserDeleteResponse user = client.admin().organization().users().delete("user_id"); + } +} +``` + +#### Response + +```json +{ + "id": "id", + "deleted": true, + "object": "organization.user.deleted" +} +``` + +## Domain Types + +### Organization User + +- `class OrganizationUser:` + + Represents an individual `user` within an organization. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `long addedAt` + + The Unix timestamp (in seconds) of when the user was added. + + - `JsonValue; object_ "organization.user"constant` + + The object type, which is always `organization.user` + + - `ORGANIZATION_USER("organization.user")` + + - `Optional apiKeyLastUsedAt` + + The Unix timestamp (in seconds) of the user's last API key usage. + + - `Optional created` + + The Unix timestamp (in seconds) of when the user was created. + + - `Optional developerPersona` + + The developer persona metadata for the user. + + - `Optional email` + + The email address of the user + + - `Optional isDefault` + + Whether this is the organization's default user. + + - `Optional isScaleTierAuthorizedPurchaser` + + Whether the user is an authorized purchaser for Scale Tier. + + - `Optional isScimManaged` + + Whether the user is managed through SCIM. + + - `Optional isServiceAccount` + + Whether the user is a service account. + + - `Optional name` + + The name of the user + + - `Optional projects` + + Projects associated with the user, if included. + + - `List data` + + - `Optional id` + + - `Optional name` + + - `Optional role` + + - `JsonValue; object_ "list"constant` + + - `LIST("list")` + + - `Optional role` + + `owner` or `reader` + + - `Optional technicalLevel` + + The technical level metadata for the user. + + - `Optional user` + + Nested user details. + + - `String id` + + - `JsonValue; object_ "user"constant` + + - `USER("user")` + + - `Optional banned` + + - `Optional bannedAt` + + - `Optional email` + + - `Optional enabled` + + - `Optional name` + + - `Optional picture` + +# Roles + +## List user organization role assignments + +`RoleListPage admin().organization().users().roles().list(RoleListParamsparams = RoleListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/users/{user_id}/roles` + +Lists the organization roles assigned to a user within the organization. + +### Parameters + +- `RoleListParams params` + + - `Optional userId` + + - `Optional after` + + Cursor for pagination. Provide the value from the previous response's `next` field to continue listing organization roles. + + - `Optional limit` + + A limit on the number of organization role assignments to return. + + - `Optional order` + + Sort order for the returned organization roles. + + - `ASC("asc")` + + - `DESC("desc")` + +### Returns + +- `class RoleListResponse:` + + Detailed information about a role assignment entry returned when listing assignments. + + - `String id` + + Identifier for the role. + + - `Optional> assignmentSources` + + Principals from which the role assignment is inherited, when available. + + - `String principalId` + + - `String principalType` + + - `Optional createdAt` + + When the role was created. + + - `Optional createdBy` + + Identifier of the actor who created the role. + + - `Optional createdByUserObj` + + User details for the actor that created the role, when available. + + - `Optional description` + + Description of the role. + + - `Optional metadata` + + Arbitrary metadata stored on the role. + + - `String name` + + Name of the role. + + - `List permissions` + + Permissions associated with the role. + + - `boolean predefinedRole` + + Whether the role is predefined by OpenAI. + + - `String resourceType` + + Resource type the role applies to. + + - `Optional updatedAt` + + When the role was last updated. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.users.roles.RoleListPage; +import com.openai.models.admin.organization.users.roles.RoleListParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleListPage page = client.admin().organization().users().roles().list("user_id"); + } +} +``` + +#### Response + +```json +{ + "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" +} +``` + +## Assign organization role to user + +`RoleCreateResponse admin().organization().users().roles().create(RoleCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/organization/users/{user_id}/roles` + +Assigns an organization role to a user within the organization. + +### Parameters + +- `RoleCreateParams params` + + - `Optional userId` + + - `String roleId` + + Identifier of the role to assign. + +### Returns + +- `class RoleCreateResponse:` + + Role assignment linking a user to a role. + + - `JsonValue; object_ "user.role"constant` + + Always `user.role`. + + - `USER_ROLE("user.role")` + + - `Role role` + + Details about a role that can be assigned through the public Roles API. + + - `String id` + + Identifier for the role. + + - `Optional description` + + Optional description of the role. + + - `String name` + + Unique name for the role. + + - `JsonValue; object_ "role"constant` + + Always `role`. + + - `ROLE("role")` + + - `List permissions` + + Permissions granted by the role. + + - `boolean predefinedRole` + + Whether the role is predefined and managed by OpenAI. + + - `String resourceType` + + Resource type the role is bound to (for example `api.organization` or `api.project`). + + - `OrganizationUser user` + + Represents an individual `user` within an organization. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `long addedAt` + + The Unix timestamp (in seconds) of when the user was added. + + - `JsonValue; object_ "organization.user"constant` + + The object type, which is always `organization.user` + + - `ORGANIZATION_USER("organization.user")` + + - `Optional apiKeyLastUsedAt` + + The Unix timestamp (in seconds) of the user's last API key usage. + + - `Optional created` + + The Unix timestamp (in seconds) of when the user was created. + + - `Optional developerPersona` + + The developer persona metadata for the user. + + - `Optional email` + + The email address of the user + + - `Optional isDefault` + + Whether this is the organization's default user. + + - `Optional isScaleTierAuthorizedPurchaser` + + Whether the user is an authorized purchaser for Scale Tier. + + - `Optional isScimManaged` + + Whether the user is managed through SCIM. + + - `Optional isServiceAccount` + + Whether the user is a service account. + + - `Optional name` + + The name of the user + + - `Optional projects` + + Projects associated with the user, if included. + + - `List data` + + - `Optional id` + + - `Optional name` + + - `Optional role` + + - `JsonValue; object_ "list"constant` + + - `LIST("list")` + + - `Optional role` + + `owner` or `reader` + + - `Optional technicalLevel` + + The technical level metadata for the user. + + - `Optional user` + + Nested user details. + + - `String id` + + - `JsonValue; object_ "user"constant` + + - `USER("user")` + + - `Optional banned` + + - `Optional bannedAt` + + - `Optional email` + + - `Optional enabled` + + - `Optional name` + + - `Optional picture` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.users.roles.RoleCreateParams; +import com.openai.models.admin.organization.users.roles.RoleCreateResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleCreateParams params = RoleCreateParams.builder() + .userId("user_id") + .roleId("role_id") + .build(); + RoleCreateResponse role = client.admin().organization().users().roles().create(params); + } +} +``` + +#### Response + +```json +{ + "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" + } + } +} +``` + +## Retrieve user organization role + +`RoleRetrieveResponse admin().organization().users().roles().retrieve(RoleRetrieveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/users/{user_id}/roles/{role_id}` + +Retrieves an organization role assigned to a user. + +### Parameters + +- `RoleRetrieveParams params` + + - `String userId` + + - `Optional roleId` + +### Returns + +- `class RoleRetrieveResponse:` + + Detailed information about a role assignment entry returned when listing assignments. + + - `String id` + + Identifier for the role. + + - `Optional> assignmentSources` + + Principals from which the role assignment is inherited, when available. + + - `String principalId` + + - `String principalType` + + - `Optional createdAt` + + When the role was created. + + - `Optional createdBy` + + Identifier of the actor who created the role. + + - `Optional createdByUserObj` + + User details for the actor that created the role, when available. + + - `Optional description` + + Description of the role. + + - `Optional metadata` + + Arbitrary metadata stored on the role. + + - `String name` + + Name of the role. + + - `List permissions` + + Permissions associated with the role. + + - `boolean predefinedRole` + + Whether the role is predefined by OpenAI. + + - `String resourceType` + + Resource type the role applies to. + + - `Optional updatedAt` + + When the role was last updated. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.users.roles.RoleRetrieveParams; +import com.openai.models.admin.organization.users.roles.RoleRetrieveResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleRetrieveParams params = RoleRetrieveParams.builder() + .userId("user_id") + .roleId("role_id") + .build(); + RoleRetrieveResponse role = client.admin().organization().users().roles().retrieve(params); + } +} +``` + +#### Response + +```json +{ + "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 +} +``` + +## Unassign organization role from user + +`RoleDeleteResponse admin().organization().users().roles().delete(RoleDeleteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**delete** `/organization/users/{user_id}/roles/{role_id}` + +Unassigns an organization role from a user within the organization. + +### Parameters + +- `RoleDeleteParams params` + + - `String userId` + + - `Optional roleId` + +### Returns + +- `class RoleDeleteResponse:` + + Confirmation payload returned after unassigning a role. + + - `boolean deleted` + + Whether the assignment was removed. + + - `String object_` + + Identifier for the deleted assignment, such as `group.role.deleted` or `user.role.deleted`. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.users.roles.RoleDeleteParams; +import com.openai.models.admin.organization.users.roles.RoleDeleteResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleDeleteParams params = RoleDeleteParams.builder() + .userId("user_id") + .roleId("role_id") + .build(); + RoleDeleteResponse role = client.admin().organization().users().roles().delete(params); + } +} +``` + +#### Response + +```json +{ + "deleted": true, + "object": "object" +} +``` + +# Groups + +## List groups + +`GroupListPage admin().organization().groups().list(GroupListParamsparams = GroupListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/groups` + +Lists all groups in the organization. + +### Parameters + +- `GroupListParams params` + + - `Optional after` + + A cursor for use in pagination. `after` is 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 include `after=group_abc` in order to fetch the next page of the list. + + - `Optional limit` + + A limit on the number of groups to be returned. Limit can range between 0 and 1000, and the default is 100. + + - `Optional order` + + Specifies the sort order of the returned groups. + + - `ASC("asc")` + + - `DESC("desc")` + +### Returns + +- `class Group:` + + Details about an organization group. + + - `String id` + + Identifier for the group. + + - `long createdAt` + + Unix timestamp (in seconds) when the group was created. + + - `GroupType groupType` + + The type of the group. + + - `GROUP("group")` + + - `TENANT_GROUP("tenant_group")` + + - `boolean isScimManaged` + + Whether the group is managed through SCIM and controlled by your identity provider. + + - `String name` + + Display name of the group. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.groups.GroupListPage; +import com.openai.models.admin.organization.groups.GroupListParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + GroupListPage page = client.admin().organization().groups().list(); + } +} +``` + +#### Response + +```json +{ + "data": [ + { + "id": "id", + "created_at": 0, + "group_type": "group", + "is_scim_managed": true, + "name": "name" + } + ], + "has_more": true, + "next": "next", + "object": "list" +} +``` + +## Create group + +`Group admin().organization().groups().create(GroupCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/organization/groups` + +Creates a new group in the organization. + +### Parameters + +- `GroupCreateParams params` + + - `String name` + + Human readable name for the group. + +### Returns + +- `class Group:` + + Details about an organization group. + + - `String id` + + Identifier for the group. + + - `long createdAt` + + Unix timestamp (in seconds) when the group was created. + + - `GroupType groupType` + + The type of the group. + + - `GROUP("group")` + + - `TENANT_GROUP("tenant_group")` + + - `boolean isScimManaged` + + Whether the group is managed through SCIM and controlled by your identity provider. + + - `String name` + + Display name of the group. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.groups.Group; +import com.openai.models.admin.organization.groups.GroupCreateParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + GroupCreateParams params = GroupCreateParams.builder() + .name("x") + .build(); + Group group = client.admin().organization().groups().create(params); + } +} +``` + +#### Response + +```json +{ + "id": "id", + "created_at": 0, + "group_type": "group", + "is_scim_managed": true, + "name": "name" +} +``` + +## Retrieve group + +`Group admin().organization().groups().retrieve(GroupRetrieveParamsparams = GroupRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/groups/{group_id}` + +Retrieves a group. + +### Parameters + +- `GroupRetrieveParams params` + + - `Optional groupId` + +### Returns + +- `class Group:` + + Details about an organization group. + + - `String id` + + Identifier for the group. + + - `long createdAt` + + Unix timestamp (in seconds) when the group was created. + + - `GroupType groupType` + + The type of the group. + + - `GROUP("group")` + + - `TENANT_GROUP("tenant_group")` + + - `boolean isScimManaged` + + Whether the group is managed through SCIM and controlled by your identity provider. + + - `String name` + + Display name of the group. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.groups.Group; +import com.openai.models.admin.organization.groups.GroupRetrieveParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Group group = client.admin().organization().groups().retrieve("group_id"); + } +} +``` + +#### Response + +```json +{ + "id": "id", + "created_at": 0, + "group_type": "group", + "is_scim_managed": true, + "name": "name" +} +``` + +## Update group + +`GroupUpdateResponse admin().organization().groups().update(GroupUpdateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/organization/groups/{group_id}` + +Updates a group's information. + +### Parameters + +- `GroupUpdateParams params` + + - `Optional groupId` + + - `String name` + + New display name for the group. + +### Returns + +- `class GroupUpdateResponse:` + + Response returned after updating a group. + + - `String id` + + Identifier for the group. + + - `long createdAt` + + Unix timestamp (in seconds) when the group was created. + + - `boolean isScimManaged` + + Whether the group is managed through SCIM and controlled by your identity provider. + + - `String name` + + Updated display name for the group. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.groups.GroupUpdateParams; +import com.openai.models.admin.organization.groups.GroupUpdateResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + GroupUpdateParams params = GroupUpdateParams.builder() + .groupId("group_id") + .name("x") + .build(); + GroupUpdateResponse group = client.admin().organization().groups().update(params); + } +} +``` + +#### Response + +```json +{ + "id": "id", + "created_at": 0, + "is_scim_managed": true, + "name": "name" +} +``` + +## Delete group + +`GroupDeleteResponse admin().organization().groups().delete(GroupDeleteParamsparams = GroupDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**delete** `/organization/groups/{group_id}` + +Deletes a group from the organization. + +### Parameters + +- `GroupDeleteParams params` + + - `Optional groupId` + +### Returns + +- `class GroupDeleteResponse:` + + Confirmation payload returned after deleting a group. + + - `String id` + + Identifier of the deleted group. + + - `boolean deleted` + + Whether the group was deleted. + + - `JsonValue; object_ "group.deleted"constant` + + Always `group.deleted`. + + - `GROUP_DELETED("group.deleted")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.groups.GroupDeleteParams; +import com.openai.models.admin.organization.groups.GroupDeleteResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + GroupDeleteResponse group = client.admin().organization().groups().delete("group_id"); + } +} +``` + +#### Response + +```json +{ + "id": "id", + "deleted": true, + "object": "group.deleted" +} +``` + +## Domain Types + +### Group + +- `class Group:` + + Details about an organization group. + + - `String id` + + Identifier for the group. + + - `long createdAt` + + Unix timestamp (in seconds) when the group was created. + + - `GroupType groupType` + + The type of the group. + + - `GROUP("group")` + + - `TENANT_GROUP("tenant_group")` + + - `boolean isScimManaged` + + Whether the group is managed through SCIM and controlled by your identity provider. + + - `String name` + + Display name of the group. + +# Users + +## List group users + +`UserListPage admin().organization().groups().users().list(UserListParamsparams = UserListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/groups/{group_id}/users` + +Lists the users assigned to a group. + +### Parameters + +- `UserListParams params` + + - `Optional groupId` + + - `Optional after` + + A cursor for use in pagination. Provide the ID of the last user from the previous list response to retrieve the next page. + + - `Optional limit` + + A limit on the number of users to be returned. Limit can range between 0 and 1000, and the default is 100. + + - `Optional order` + + Specifies the sort order of users in the list. + + - `ASC("asc")` + + - `DESC("desc")` + +### Returns + +- `class OrganizationGroupUser:` + + Represents an individual user returned when inspecting group membership. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `Optional email` + + The email address of the user. + + - `String name` + + The name of the user. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.groups.users.UserListPage; +import com.openai.models.admin.organization.groups.users.UserListParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UserListPage page = client.admin().organization().groups().users().list("group_id"); + } +} +``` + +#### Response + +```json +{ + "data": [ + { + "id": "id", + "email": "email", + "name": "name" + } + ], + "has_more": true, + "next": "next", + "object": "list" +} +``` + +## Add group user + +`UserCreateResponse admin().organization().groups().users().create(UserCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/organization/groups/{group_id}/users` + +Adds a user to a group. + +### Parameters + +- `UserCreateParams params` + + - `Optional groupId` + + - `String userId` + + Identifier of the user to add to the group. + +### Returns + +- `class UserCreateResponse:` + + Confirmation payload returned after adding a user to a group. + + - `String groupId` + + Identifier of the group the user was added to. + + - `JsonValue; object_ "group.user"constant` + + Always `group.user`. + + - `GROUP_USER("group.user")` + + - `String userId` + + Identifier of the user that was added. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.groups.users.UserCreateParams; +import com.openai.models.admin.organization.groups.users.UserCreateResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UserCreateParams params = UserCreateParams.builder() + .groupId("group_id") + .userId("user_id") + .build(); + UserCreateResponse user = client.admin().organization().groups().users().create(params); + } +} +``` + +#### Response + +```json +{ + "group_id": "group_id", + "object": "group.user", + "user_id": "user_id" +} +``` + +## Retrieve group user + +`UserRetrieveResponse admin().organization().groups().users().retrieve(UserRetrieveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/groups/{group_id}/users/{user_id}` + +Retrieves a user in a group. + +### Parameters + +- `UserRetrieveParams params` + + - `String groupId` + + - `Optional userId` + +### Returns + +- `class UserRetrieveResponse:` + + Details about a user returned from an organization group membership lookup. + + - `String id` + + Identifier for the user. + + - `Optional email` + + Email address of the user, or `null` for users without an email. + + - `Optional isServiceAccount` + + Whether the user is a service account. + + - `String name` + + Display name of the user. + + - `Optional picture` + + URL of the user's profile picture, if available. + + - `UserType userType` + + The type of user. + + - `USER("user")` + + - `TENANT_USER("tenant_user")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.groups.users.UserRetrieveParams; +import com.openai.models.admin.organization.groups.users.UserRetrieveResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UserRetrieveParams params = UserRetrieveParams.builder() + .groupId("group_id") + .userId("user_id") + .build(); + UserRetrieveResponse user = client.admin().organization().groups().users().retrieve(params); + } +} +``` + +#### Response + +```json +{ + "id": "id", + "email": "email", + "is_service_account": true, + "name": "name", + "picture": "picture", + "user_type": "user" +} +``` + +## Remove group user + +`UserDeleteResponse admin().organization().groups().users().delete(UserDeleteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**delete** `/organization/groups/{group_id}/users/{user_id}` + +Removes a user from a group. + +### Parameters + +- `UserDeleteParams params` + + - `String groupId` + + - `Optional userId` + +### Returns + +- `class UserDeleteResponse:` + + Confirmation payload returned after removing a user from a group. + + - `boolean deleted` + + Whether the group membership was removed. + + - `JsonValue; object_ "group.user.deleted"constant` + + Always `group.user.deleted`. + + - `GROUP_USER_DELETED("group.user.deleted")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.groups.users.UserDeleteParams; +import com.openai.models.admin.organization.groups.users.UserDeleteResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UserDeleteParams params = UserDeleteParams.builder() + .groupId("group_id") + .userId("user_id") + .build(); + UserDeleteResponse user = client.admin().organization().groups().users().delete(params); + } +} +``` + +#### Response + +```json +{ + "deleted": true, + "object": "group.user.deleted" +} +``` + +## Domain Types + +### Organization Group User + +- `class OrganizationGroupUser:` + + Represents an individual user returned when inspecting group membership. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `Optional email` + + The email address of the user. + + - `String name` + + The name of the user. + +# Roles + +## List group organization role assignments + +`RoleListPage admin().organization().groups().roles().list(RoleListParamsparams = RoleListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/groups/{group_id}/roles` + +Lists the organization roles assigned to a group within the organization. + +### Parameters + +- `RoleListParams params` + + - `Optional groupId` + + - `Optional after` + + Cursor for pagination. Provide the value from the previous response's `next` field to continue listing organization roles. + + - `Optional limit` + + A limit on the number of organization role assignments to return. + + - `Optional order` + + Sort order for the returned organization roles. + + - `ASC("asc")` + + - `DESC("desc")` + +### Returns + +- `class RoleListResponse:` + + Detailed information about a role assignment entry returned when listing assignments. + + - `String id` + + Identifier for the role. + + - `Optional> assignmentSources` + + Principals from which the role assignment is inherited, when available. + + - `String principalId` + + - `String principalType` + + - `Optional createdAt` + + When the role was created. + + - `Optional createdBy` + + Identifier of the actor who created the role. + + - `Optional createdByUserObj` + + User details for the actor that created the role, when available. + + - `Optional description` + + Description of the role. + + - `Optional metadata` + + Arbitrary metadata stored on the role. + + - `String name` + + Name of the role. + + - `List permissions` + + Permissions associated with the role. + + - `boolean predefinedRole` + + Whether the role is predefined by OpenAI. + + - `String resourceType` + + Resource type the role applies to. + + - `Optional updatedAt` + + When the role was last updated. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.groups.roles.RoleListPage; +import com.openai.models.admin.organization.groups.roles.RoleListParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleListPage page = client.admin().organization().groups().roles().list("group_id"); + } +} +``` + +#### Response + +```json +{ + "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" +} +``` + +## Assign organization role to group + +`RoleCreateResponse admin().organization().groups().roles().create(RoleCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/organization/groups/{group_id}/roles` + +Assigns an organization role to a group within the organization. + +### Parameters + +- `RoleCreateParams params` + + - `Optional groupId` + + - `String roleId` + + Identifier of the role to assign. + +### Returns + +- `class RoleCreateResponse:` + + Role assignment linking a group to a role. + + - `Group group` + + Summary information about a group returned in role assignment responses. + + - `String id` + + Identifier for the group. + + - `long createdAt` + + Unix timestamp (in seconds) when the group was created. + + - `String name` + + Display name of the group. + + - `JsonValue; object_ "group"constant` + + Always `group`. + + - `GROUP("group")` + + - `boolean scimManaged` + + Whether the group is managed through SCIM. + + - `JsonValue; object_ "group.role"constant` + + Always `group.role`. + + - `GROUP_ROLE("group.role")` + + - `Role role` + + Details about a role that can be assigned through the public Roles API. + + - `String id` + + Identifier for the role. + + - `Optional description` + + Optional description of the role. + + - `String name` + + Unique name for the role. + + - `JsonValue; object_ "role"constant` + + Always `role`. + + - `ROLE("role")` + + - `List permissions` + + Permissions granted by the role. + + - `boolean predefinedRole` + + Whether the role is predefined and managed by OpenAI. + + - `String resourceType` + + Resource type the role is bound to (for example `api.organization` or `api.project`). + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.groups.roles.RoleCreateParams; +import com.openai.models.admin.organization.groups.roles.RoleCreateResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleCreateParams params = RoleCreateParams.builder() + .groupId("group_id") + .roleId("role_id") + .build(); + RoleCreateResponse role = client.admin().organization().groups().roles().create(params); + } +} +``` + +#### Response + +```json +{ + "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" + } +} +``` + +## Retrieve group organization role + +`RoleRetrieveResponse admin().organization().groups().roles().retrieve(RoleRetrieveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/groups/{group_id}/roles/{role_id}` + +Retrieves an organization role assigned to a group. + +### Parameters + +- `RoleRetrieveParams params` + + - `String groupId` + + - `Optional roleId` + +### Returns + +- `class RoleRetrieveResponse:` + + Detailed information about a role assignment entry returned when listing assignments. + + - `String id` + + Identifier for the role. + + - `Optional> assignmentSources` + + Principals from which the role assignment is inherited, when available. + + - `String principalId` + + - `String principalType` + + - `Optional createdAt` + + When the role was created. + + - `Optional createdBy` + + Identifier of the actor who created the role. + + - `Optional createdByUserObj` + + User details for the actor that created the role, when available. + + - `Optional description` + + Description of the role. + + - `Optional metadata` + + Arbitrary metadata stored on the role. + + - `String name` + + Name of the role. + + - `List permissions` + + Permissions associated with the role. + + - `boolean predefinedRole` + + Whether the role is predefined by OpenAI. + + - `String resourceType` + + Resource type the role applies to. + + - `Optional updatedAt` + + When the role was last updated. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.groups.roles.RoleRetrieveParams; +import com.openai.models.admin.organization.groups.roles.RoleRetrieveResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleRetrieveParams params = RoleRetrieveParams.builder() + .groupId("group_id") + .roleId("role_id") + .build(); + RoleRetrieveResponse role = client.admin().organization().groups().roles().retrieve(params); + } +} +``` + +#### Response + +```json +{ + "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 +} +``` + +## Unassign organization role from group + +`RoleDeleteResponse admin().organization().groups().roles().delete(RoleDeleteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**delete** `/organization/groups/{group_id}/roles/{role_id}` + +Unassigns an organization role from a group within the organization. + +### Parameters + +- `RoleDeleteParams params` + + - `String groupId` + + - `Optional roleId` + +### Returns + +- `class RoleDeleteResponse:` + + Confirmation payload returned after unassigning a role. + + - `boolean deleted` + + Whether the assignment was removed. + + - `String object_` + + Identifier for the deleted assignment, such as `group.role.deleted` or `user.role.deleted`. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.groups.roles.RoleDeleteParams; +import com.openai.models.admin.organization.groups.roles.RoleDeleteResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleDeleteParams params = RoleDeleteParams.builder() + .groupId("group_id") + .roleId("role_id") + .build(); + RoleDeleteResponse role = client.admin().organization().groups().roles().delete(params); + } +} +``` + +#### Response + +```json +{ + "deleted": true, + "object": "object" +} +``` + +# Roles + +## List organization roles + +`RoleListPage admin().organization().roles().list(RoleListParamsparams = RoleListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/roles` + +Lists the roles configured for the organization. + +### Parameters + +- `RoleListParams params` + + - `Optional after` + + Cursor for pagination. Provide the value from the previous response's `next` field to continue listing roles. + + - `Optional limit` + + A limit on the number of roles to return. Defaults to 1000. + + - `Optional order` + + Sort order for the returned roles. + + - `ASC("asc")` + + - `DESC("desc")` + +### Returns + +- `class Role:` + + Details about a role that can be assigned through the public Roles API. + + - `String id` + + Identifier for the role. + + - `Optional description` + + Optional description of the role. + + - `String name` + + Unique name for the role. + + - `JsonValue; object_ "role"constant` + + Always `role`. + + - `ROLE("role")` + + - `List permissions` + + Permissions granted by the role. + + - `boolean predefinedRole` + + Whether the role is predefined and managed by OpenAI. + + - `String resourceType` + + Resource type the role is bound to (for example `api.organization` or `api.project`). + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.roles.RoleListPage; +import com.openai.models.admin.organization.roles.RoleListParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleListPage page = client.admin().organization().roles().list(); + } +} +``` + +#### Response + +```json +{ + "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" +} +``` + +## Create organization role + +`Role admin().organization().roles().create(RoleCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/organization/roles` + +Creates a custom role for the organization. + +### Parameters + +- `RoleCreateParams params` + + - `List permissions` + + Permissions to grant to the role. + + - `String roleName` + + Unique name for the role. + + - `Optional description` + + Optional description of the role. + +### Returns + +- `class Role:` + + Details about a role that can be assigned through the public Roles API. + + - `String id` + + Identifier for the role. + + - `Optional description` + + Optional description of the role. + + - `String name` + + Unique name for the role. + + - `JsonValue; object_ "role"constant` + + Always `role`. + + - `ROLE("role")` + + - `List permissions` + + Permissions granted by the role. + + - `boolean predefinedRole` + + Whether the role is predefined and managed by OpenAI. + + - `String resourceType` + + Resource type the role is bound to (for example `api.organization` or `api.project`). + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.roles.Role; +import com.openai.models.admin.organization.roles.RoleCreateParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleCreateParams params = RoleCreateParams.builder() + .addPermission("string") + .roleName("role_name") + .build(); + Role role = client.admin().organization().roles().create(params); + } +} +``` + +#### Response + +```json +{ + "id": "id", + "description": "description", + "name": "name", + "object": "role", + "permissions": [ + "string" + ], + "predefined_role": true, + "resource_type": "resource_type" +} +``` + +## Retrieve organization role + +`Role admin().organization().roles().retrieve(RoleRetrieveParamsparams = RoleRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/roles/{role_id}` + +Retrieves an organization role. + +### Parameters + +- `RoleRetrieveParams params` + + - `Optional roleId` + +### Returns + +- `class Role:` + + Details about a role that can be assigned through the public Roles API. + + - `String id` + + Identifier for the role. + + - `Optional description` + + Optional description of the role. + + - `String name` + + Unique name for the role. + + - `JsonValue; object_ "role"constant` + + Always `role`. + + - `ROLE("role")` + + - `List permissions` + + Permissions granted by the role. + + - `boolean predefinedRole` + + Whether the role is predefined and managed by OpenAI. + + - `String resourceType` + + Resource type the role is bound to (for example `api.organization` or `api.project`). + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.roles.Role; +import com.openai.models.admin.organization.roles.RoleRetrieveParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Role role = client.admin().organization().roles().retrieve("role_id"); + } +} +``` + +#### Response + +```json +{ + "id": "id", + "description": "description", + "name": "name", + "object": "role", + "permissions": [ + "string" + ], + "predefined_role": true, + "resource_type": "resource_type" +} +``` + +## Update organization role + +`Role admin().organization().roles().update(RoleUpdateParamsparams = RoleUpdateParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/organization/roles/{role_id}` + +Updates an existing organization role. + +### Parameters + +- `RoleUpdateParams params` + + - `Optional roleId` + + - `Optional description` + + New description for the role. + + - `Optional> permissions` + + Updated set of permissions for the role. + + - `Optional roleName` + + New name for the role. + +### Returns + +- `class Role:` + + Details about a role that can be assigned through the public Roles API. + + - `String id` + + Identifier for the role. + + - `Optional description` + + Optional description of the role. + + - `String name` + + Unique name for the role. + + - `JsonValue; object_ "role"constant` + + Always `role`. + + - `ROLE("role")` + + - `List permissions` + + Permissions granted by the role. + + - `boolean predefinedRole` + + Whether the role is predefined and managed by OpenAI. + + - `String resourceType` + + Resource type the role is bound to (for example `api.organization` or `api.project`). + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.roles.Role; +import com.openai.models.admin.organization.roles.RoleUpdateParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Role role = client.admin().organization().roles().update("role_id"); + } +} +``` + +#### Response + +```json +{ + "id": "id", + "description": "description", + "name": "name", + "object": "role", + "permissions": [ + "string" + ], + "predefined_role": true, + "resource_type": "resource_type" +} +``` + +## Delete organization role + +`RoleDeleteResponse admin().organization().roles().delete(RoleDeleteParamsparams = RoleDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**delete** `/organization/roles/{role_id}` + +Deletes a custom role from the organization. + +### Parameters + +- `RoleDeleteParams params` + + - `Optional roleId` + +### Returns + +- `class RoleDeleteResponse:` + + Confirmation payload returned after deleting a role. + + - `String id` + + Identifier of the deleted role. + + - `boolean deleted` + + Whether the role was deleted. + + - `JsonValue; object_ "role.deleted"constant` + + Always `role.deleted`. + + - `ROLE_DELETED("role.deleted")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.roles.RoleDeleteParams; +import com.openai.models.admin.organization.roles.RoleDeleteResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleDeleteResponse role = client.admin().organization().roles().delete("role_id"); + } +} +``` + +#### Response + +```json +{ + "id": "id", + "deleted": true, + "object": "role.deleted" +} +``` + +## Domain Types + +### Role + +- `class Role:` + + Details about a role that can be assigned through the public Roles API. + + - `String id` + + Identifier for the role. + + - `Optional description` + + Optional description of the role. + + - `String name` + + Unique name for the role. + + - `JsonValue; object_ "role"constant` + + Always `role`. + + - `ROLE("role")` + + - `List permissions` + + Permissions granted by the role. + + - `boolean predefinedRole` + + Whether the role is predefined and managed by OpenAI. + + - `String resourceType` + + Resource type the role is bound to (for example `api.organization` or `api.project`). + +# Data Retention + +## Retrieve organization data retention + +`OrganizationDataRetention admin().organization().dataRetention().retrieve(DataRetentionRetrieveParamsparams = DataRetentionRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/data_retention` + +Retrieves organization data retention controls. + +### Parameters + +- `DataRetentionRetrieveParams params` + +### Returns + +- `class OrganizationDataRetention:` + + Represents the organization's data retention control setting. + + - `JsonValue; object_ "organization.data_retention"constant` + + The object type, which is always `organization.data_retention`. + + - `ORGANIZATION_DATA_RETENTION("organization.data_retention")` + + - `Type type` + + The configured organization data retention type. + + - `ZERO_DATA_RETENTION("zero_data_retention")` + + - `MODIFIED_ABUSE_MONITORING("modified_abuse_monitoring")` + + - `ENHANCED_ZERO_DATA_RETENTION("enhanced_zero_data_retention")` + + - `ENHANCED_MODIFIED_ABUSE_MONITORING("enhanced_modified_abuse_monitoring")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.dataretention.DataRetentionRetrieveParams; +import com.openai.models.admin.organization.dataretention.OrganizationDataRetention; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + OrganizationDataRetention organizationDataRetention = client.admin().organization().dataRetention().retrieve(); + } +} +``` + +#### Response + +```json +{ + "object": "organization.data_retention", + "type": "zero_data_retention" +} +``` + +## Update organization data retention + +`OrganizationDataRetention admin().organization().dataRetention().update(DataRetentionUpdateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/organization/data_retention` + +Updates organization data retention controls. + +### Parameters + +- `DataRetentionUpdateParams params` + + - `RetentionType retentionType` + + The desired organization data retention type. + + - `ZERO_DATA_RETENTION("zero_data_retention")` + + - `MODIFIED_ABUSE_MONITORING("modified_abuse_monitoring")` + + - `ENHANCED_ZERO_DATA_RETENTION("enhanced_zero_data_retention")` + + - `ENHANCED_MODIFIED_ABUSE_MONITORING("enhanced_modified_abuse_monitoring")` + +### Returns + +- `class OrganizationDataRetention:` + + Represents the organization's data retention control setting. + + - `JsonValue; object_ "organization.data_retention"constant` + + The object type, which is always `organization.data_retention`. + + - `ORGANIZATION_DATA_RETENTION("organization.data_retention")` + + - `Type type` + + The configured organization data retention type. + + - `ZERO_DATA_RETENTION("zero_data_retention")` + + - `MODIFIED_ABUSE_MONITORING("modified_abuse_monitoring")` + + - `ENHANCED_ZERO_DATA_RETENTION("enhanced_zero_data_retention")` + + - `ENHANCED_MODIFIED_ABUSE_MONITORING("enhanced_modified_abuse_monitoring")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.dataretention.DataRetentionUpdateParams; +import com.openai.models.admin.organization.dataretention.OrganizationDataRetention; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + DataRetentionUpdateParams params = DataRetentionUpdateParams.builder() + .retentionType(DataRetentionUpdateParams.RetentionType.ZERO_DATA_RETENTION) + .build(); + OrganizationDataRetention organizationDataRetention = client.admin().organization().dataRetention().update(params); + } +} +``` + +#### Response + +```json +{ + "object": "organization.data_retention", + "type": "zero_data_retention" +} +``` + +## Domain Types + +### Organization Data Retention + +- `class OrganizationDataRetention:` + + Represents the organization's data retention control setting. + + - `JsonValue; object_ "organization.data_retention"constant` + + The object type, which is always `organization.data_retention`. + + - `ORGANIZATION_DATA_RETENTION("organization.data_retention")` + + - `Type type` + + The configured organization data retention type. + + - `ZERO_DATA_RETENTION("zero_data_retention")` + + - `MODIFIED_ABUSE_MONITORING("modified_abuse_monitoring")` + + - `ENHANCED_ZERO_DATA_RETENTION("enhanced_zero_data_retention")` + + - `ENHANCED_MODIFIED_ABUSE_MONITORING("enhanced_modified_abuse_monitoring")` + +# Spend Alerts + +## List organization spend alerts + +`SpendAlertListPage admin().organization().spendAlerts().list(SpendAlertListParamsparams = SpendAlertListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/spend_alerts` + +Lists organization spend alerts. + +### Parameters + +- `SpendAlertListParams params` + + - `Optional after` + + Cursor for pagination. Provide the ID of the last spend alert from the previous response to fetch the next page. + + - `Optional before` + + Cursor for pagination. Provide the ID of the first spend alert from the previous response to fetch the previous page. + + - `Optional limit` + + A limit on the number of spend alerts to return. Defaults to 20. + + - `Optional order` + + Sort order for the returned spend alerts. + + - `ASC("asc")` + + - `DESC("desc")` + +### Returns + +- `class OrganizationSpendAlert:` + + Represents a spend alert configured at the organization level. + + - `String id` + + The identifier, which can be referenced in API endpoints. + + - `Currency currency` + + The currency for the threshold amount. + + - `USD("USD")` + + - `Interval interval` + + The time interval for evaluating spend against the threshold. + + - `MONTH("month")` + + - `NotificationChannel notificationChannel` + + Email notification settings for a spend alert. + + - `List recipients` + + Email addresses that receive the spend alert notification. + + - `JsonValue; type "email"constant` + + The notification channel type. Currently only `email` is supported. + + - `EMAIL("email")` + + - `Optional subjectPrefix` + + Optional subject prefix for alert emails. + + - `JsonValue; object_ "organization.spend_alert"constant` + + The object type, which is always `organization.spend_alert`. + + - `ORGANIZATION_SPEND_ALERT("organization.spend_alert")` + + - `long thresholdAmount` + + The alert threshold amount, in cents. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.spendalerts.SpendAlertListPage; +import com.openai.models.admin.organization.spendalerts.SpendAlertListParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + SpendAlertListPage page = client.admin().organization().spendAlerts().list(); + } +} +``` + +#### Response + +```json +{ + "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" +} +``` + +## Create organization spend alert + +`OrganizationSpendAlert admin().organization().spendAlerts().create(SpendAlertCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/organization/spend_alerts` + +Creates an organization spend alert. + +### Parameters + +- `SpendAlertCreateParams params` + + - `Currency currency` + + The currency for the threshold amount. + + - `USD("USD")` + + - `Interval interval` + + The time interval for evaluating spend against the threshold. + + - `MONTH("month")` + + - `NotificationChannel notificationChannel` + + Email notification settings for a spend alert. + + - `List recipients` + + Email addresses that receive the spend alert notification. + + - `JsonValue; type "email"constant` + + The notification channel type. Currently only `email` is supported. + + - `EMAIL("email")` + + - `Optional subjectPrefix` + + Optional subject prefix for alert emails. + + - `long thresholdAmount` + + The alert threshold amount, in cents. + +### Returns + +- `class OrganizationSpendAlert:` + + Represents a spend alert configured at the organization level. + + - `String id` + + The identifier, which can be referenced in API endpoints. + + - `Currency currency` + + The currency for the threshold amount. + + - `USD("USD")` + + - `Interval interval` + + The time interval for evaluating spend against the threshold. + + - `MONTH("month")` + + - `NotificationChannel notificationChannel` + + Email notification settings for a spend alert. + + - `List recipients` + + Email addresses that receive the spend alert notification. + + - `JsonValue; type "email"constant` + + The notification channel type. Currently only `email` is supported. + + - `EMAIL("email")` + + - `Optional subjectPrefix` + + Optional subject prefix for alert emails. + + - `JsonValue; object_ "organization.spend_alert"constant` + + The object type, which is always `organization.spend_alert`. + + - `ORGANIZATION_SPEND_ALERT("organization.spend_alert")` + + - `long thresholdAmount` + + The alert threshold amount, in cents. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.spendalerts.OrganizationSpendAlert; +import com.openai.models.admin.organization.spendalerts.SpendAlertCreateParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + SpendAlertCreateParams params = SpendAlertCreateParams.builder() + .currency(SpendAlertCreateParams.Currency.USD) + .interval(SpendAlertCreateParams.Interval.MONTH) + .notificationChannel(SpendAlertCreateParams.NotificationChannel.builder() + .addRecipient("string") + .build()) + .thresholdAmount(0L) + .build(); + OrganizationSpendAlert organizationSpendAlert = client.admin().organization().spendAlerts().create(params); + } +} +``` + +#### Response + +```json +{ + "id": "id", + "currency": "USD", + "interval": "month", + "notification_channel": { + "recipients": [ + "string" + ], + "type": "email", + "subject_prefix": "subject_prefix" + }, + "object": "organization.spend_alert", + "threshold_amount": 0 +} +``` + +## Update organization spend alert + +`OrganizationSpendAlert admin().organization().spendAlerts().update(SpendAlertUpdateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/organization/spend_alerts/{alert_id}` + +Updates an organization spend alert. + +### Parameters + +- `SpendAlertUpdateParams params` + + - `Optional alertId` + + - `Currency currency` + + The currency for the threshold amount. + + - `USD("USD")` + + - `Interval interval` + + The time interval for evaluating spend against the threshold. + + - `MONTH("month")` + + - `NotificationChannel notificationChannel` + + Email notification settings for a spend alert. + + - `List recipients` + + Email addresses that receive the spend alert notification. + + - `JsonValue; type "email"constant` + + The notification channel type. Currently only `email` is supported. + + - `EMAIL("email")` + + - `Optional subjectPrefix` + + Optional subject prefix for alert emails. + + - `long thresholdAmount` + + The alert threshold amount, in cents. + +### Returns + +- `class OrganizationSpendAlert:` + + Represents a spend alert configured at the organization level. + + - `String id` + + The identifier, which can be referenced in API endpoints. + + - `Currency currency` + + The currency for the threshold amount. + + - `USD("USD")` + + - `Interval interval` + + The time interval for evaluating spend against the threshold. + + - `MONTH("month")` + + - `NotificationChannel notificationChannel` + + Email notification settings for a spend alert. + + - `List recipients` + + Email addresses that receive the spend alert notification. + + - `JsonValue; type "email"constant` + + The notification channel type. Currently only `email` is supported. + + - `EMAIL("email")` + + - `Optional subjectPrefix` + + Optional subject prefix for alert emails. + + - `JsonValue; object_ "organization.spend_alert"constant` + + The object type, which is always `organization.spend_alert`. + + - `ORGANIZATION_SPEND_ALERT("organization.spend_alert")` + + - `long thresholdAmount` + + The alert threshold amount, in cents. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.spendalerts.OrganizationSpendAlert; +import com.openai.models.admin.organization.spendalerts.SpendAlertUpdateParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + SpendAlertUpdateParams params = SpendAlertUpdateParams.builder() + .alertId("alert_id") + .currency(SpendAlertUpdateParams.Currency.USD) + .interval(SpendAlertUpdateParams.Interval.MONTH) + .notificationChannel(SpendAlertUpdateParams.NotificationChannel.builder() + .addRecipient("string") + .build()) + .thresholdAmount(0L) + .build(); + OrganizationSpendAlert organizationSpendAlert = client.admin().organization().spendAlerts().update(params); + } +} +``` + +#### Response + +```json +{ + "id": "id", + "currency": "USD", + "interval": "month", + "notification_channel": { + "recipients": [ + "string" + ], + "type": "email", + "subject_prefix": "subject_prefix" + }, + "object": "organization.spend_alert", + "threshold_amount": 0 +} +``` + +## Delete organization spend alert + +`OrganizationSpendAlertDeleted admin().organization().spendAlerts().delete(SpendAlertDeleteParamsparams = SpendAlertDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**delete** `/organization/spend_alerts/{alert_id}` + +Deletes an organization spend alert. + +### Parameters + +- `SpendAlertDeleteParams params` + + - `Optional alertId` + +### Returns + +- `class OrganizationSpendAlertDeleted:` + + Confirmation payload returned after deleting an organization spend alert. + + - `String id` + + The deleted spend alert ID. + + - `boolean deleted` + + Whether the spend alert was deleted. + + - `JsonValue; object_ "organization.spend_alert.deleted"constant` + + Always `organization.spend_alert.deleted`. + + - `ORGANIZATION_SPEND_ALERT_DELETED("organization.spend_alert.deleted")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.spendalerts.OrganizationSpendAlertDeleted; +import com.openai.models.admin.organization.spendalerts.SpendAlertDeleteParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + OrganizationSpendAlertDeleted organizationSpendAlertDeleted = client.admin().organization().spendAlerts().delete("alert_id"); + } +} +``` + +#### Response + +```json +{ + "id": "id", + "deleted": true, + "object": "organization.spend_alert.deleted" +} +``` + +## Domain Types + +### Organization Spend Alert + +- `class OrganizationSpendAlert:` + + Represents a spend alert configured at the organization level. + + - `String id` + + The identifier, which can be referenced in API endpoints. + + - `Currency currency` + + The currency for the threshold amount. + + - `USD("USD")` + + - `Interval interval` + + The time interval for evaluating spend against the threshold. + + - `MONTH("month")` + + - `NotificationChannel notificationChannel` + + Email notification settings for a spend alert. + + - `List recipients` + + Email addresses that receive the spend alert notification. + + - `JsonValue; type "email"constant` + + The notification channel type. Currently only `email` is supported. + + - `EMAIL("email")` + + - `Optional subjectPrefix` + + Optional subject prefix for alert emails. + + - `JsonValue; object_ "organization.spend_alert"constant` + + The object type, which is always `organization.spend_alert`. + + - `ORGANIZATION_SPEND_ALERT("organization.spend_alert")` + + - `long thresholdAmount` + + The alert threshold amount, in cents. + +### Organization Spend Alert Deleted + +- `class OrganizationSpendAlertDeleted:` + + Confirmation payload returned after deleting an organization spend alert. + + - `String id` + + The deleted spend alert ID. + + - `boolean deleted` + + Whether the spend alert was deleted. + + - `JsonValue; object_ "organization.spend_alert.deleted"constant` + + Always `organization.spend_alert.deleted`. + + - `ORGANIZATION_SPEND_ALERT_DELETED("organization.spend_alert.deleted")` + +# Certificates + +## List organization certificates + +`CertificateListPage admin().organization().certificates().list(CertificateListParamsparams = CertificateListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/certificates` + +List uploaded certificates for this organization. + +### Parameters + +- `CertificateListParams params` + + - `Optional after` + + A cursor for use in pagination. `after` is 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. + + - `Optional limit` + + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + + - `Optional order` + + Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. + + - `ASC("asc")` + + - `DESC("desc")` + +### Returns + +- `class CertificateListResponse:` + + Represents an individual certificate configured at the organization level. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `boolean active` + + Whether the certificate is currently active at the organization level. + + - `CertificateDetails certificateDetails` + + - `Optional expiresAt` + + The Unix timestamp (in seconds) of when the certificate expires. + + - `Optional validAt` + + The Unix timestamp (in seconds) of when the certificate becomes valid. + + - `long createdAt` + + The Unix timestamp (in seconds) of when the certificate was uploaded. + + - `Optional name` + + The name of the certificate. + + - `JsonValue; object_ "organization.certificate"constant` + + The object type, which is always `organization.certificate`. + + - `ORGANIZATION_CERTIFICATE("organization.certificate")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.certificates.CertificateListPage; +import com.openai.models.admin.organization.certificates.CertificateListParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + CertificateListPage page = client.admin().organization().certificates().list(); + } +} +``` + +#### Response + +```json +{ + "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" +} +``` + +## Upload certificate + +`Certificate admin().organization().certificates().create(CertificateCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/organization/certificates` + +Upload a certificate to the organization. This does **not** automatically activate the certificate. + +Organizations can upload up to 50 certificates. + +### Parameters + +- `CertificateCreateParams params` + + - `String certificate` + + The certificate content in PEM format + + - `Optional name` + + An optional name for the certificate + +### Returns + +- `class Certificate:` + + Represents an individual `certificate` uploaded to the organization. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `CertificateDetails certificateDetails` + + - `Optional content` + + The content of the certificate in PEM format. + + - `Optional expiresAt` + + The Unix timestamp (in seconds) of when the certificate expires. + + - `Optional validAt` + + The Unix timestamp (in seconds) of when the certificate becomes valid. + + - `long createdAt` + + The Unix timestamp (in seconds) of when the certificate was uploaded. + + - `Optional name` + + The name of the certificate. + + - `Object object_` + + 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("certificate")` + + - `ORGANIZATION_CERTIFICATE("organization.certificate")` + + - `ORGANIZATION_PROJECT_CERTIFICATE("organization.project.certificate")` + + - `Optional active` + + Whether the certificate is currently active at the specified scope. Not returned when getting details for a specific certificate. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.certificates.Certificate; +import com.openai.models.admin.organization.certificates.CertificateCreateParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + CertificateCreateParams params = CertificateCreateParams.builder() + .certificate("certificate") + .build(); + Certificate certificate = client.admin().organization().certificates().create(params); + } +} +``` + +#### Response + +```json +{ + "id": "id", + "certificate_details": { + "content": "content", + "expires_at": 0, + "valid_at": 0 + }, + "created_at": 0, + "name": "name", + "object": "certificate", + "active": true +} +``` + +## Get certificate + +`Certificate admin().organization().certificates().retrieve(CertificateRetrieveParamsparams = CertificateRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/certificates/{certificate_id}` + +Get a certificate that has been uploaded to the organization. + +You can get a certificate regardless of whether it is active or not. + +### Parameters + +- `CertificateRetrieveParams params` + + - `Optional certificateId` + + - `Optional> include` + + A list of additional fields to include in the response. Currently the only supported value is `content` to fetch the PEM content of the certificate. + + - `CONTENT("content")` + +### Returns + +- `class Certificate:` + + Represents an individual `certificate` uploaded to the organization. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `CertificateDetails certificateDetails` + + - `Optional content` + + The content of the certificate in PEM format. + + - `Optional expiresAt` + + The Unix timestamp (in seconds) of when the certificate expires. + + - `Optional validAt` + + The Unix timestamp (in seconds) of when the certificate becomes valid. + + - `long createdAt` + + The Unix timestamp (in seconds) of when the certificate was uploaded. + + - `Optional name` + + The name of the certificate. + + - `Object object_` + + 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("certificate")` + + - `ORGANIZATION_CERTIFICATE("organization.certificate")` + + - `ORGANIZATION_PROJECT_CERTIFICATE("organization.project.certificate")` + + - `Optional active` + + Whether the certificate is currently active at the specified scope. Not returned when getting details for a specific certificate. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.certificates.Certificate; +import com.openai.models.admin.organization.certificates.CertificateRetrieveParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Certificate certificate = client.admin().organization().certificates().retrieve("certificate_id"); + } +} +``` + +#### Response + +```json +{ + "id": "id", + "certificate_details": { + "content": "content", + "expires_at": 0, + "valid_at": 0 + }, + "created_at": 0, + "name": "name", + "object": "certificate", + "active": true +} +``` + +## Modify certificate + +`Certificate admin().organization().certificates().update(CertificateUpdateParamsparams = CertificateUpdateParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/organization/certificates/{certificate_id}` + +Modify a certificate. Note that only the name can be modified. + +### Parameters + +- `CertificateUpdateParams params` + + - `Optional certificateId` + + - `Optional name` + + The updated name for the certificate + +### Returns + +- `class Certificate:` + + Represents an individual `certificate` uploaded to the organization. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `CertificateDetails certificateDetails` + + - `Optional content` + + The content of the certificate in PEM format. + + - `Optional expiresAt` + + The Unix timestamp (in seconds) of when the certificate expires. + + - `Optional validAt` + + The Unix timestamp (in seconds) of when the certificate becomes valid. + + - `long createdAt` + + The Unix timestamp (in seconds) of when the certificate was uploaded. + + - `Optional name` + + The name of the certificate. + + - `Object object_` + + 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("certificate")` + + - `ORGANIZATION_CERTIFICATE("organization.certificate")` + + - `ORGANIZATION_PROJECT_CERTIFICATE("organization.project.certificate")` + + - `Optional active` + + Whether the certificate is currently active at the specified scope. Not returned when getting details for a specific certificate. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.certificates.Certificate; +import com.openai.models.admin.organization.certificates.CertificateUpdateParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Certificate certificate = client.admin().organization().certificates().update("certificate_id"); + } +} +``` + +#### Response + +```json +{ + "id": "id", + "certificate_details": { + "content": "content", + "expires_at": 0, + "valid_at": 0 + }, + "created_at": 0, + "name": "name", + "object": "certificate", + "active": true +} +``` + +## Delete certificate + +`CertificateDeleteResponse admin().organization().certificates().delete(CertificateDeleteParamsparams = CertificateDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**delete** `/organization/certificates/{certificate_id}` + +Delete a certificate from the organization. + +The certificate must be inactive for the organization and all projects. + +### Parameters + +- `CertificateDeleteParams params` + + - `Optional certificateId` + +### Returns + +- `class CertificateDeleteResponse:` + + - `String id` + + The ID of the certificate that was deleted. + + - `JsonValue; object_ "certificate.deleted"constant` + + The object type, must be `certificate.deleted`. + + - `CERTIFICATE_DELETED("certificate.deleted")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.certificates.CertificateDeleteParams; +import com.openai.models.admin.organization.certificates.CertificateDeleteResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + CertificateDeleteResponse certificate = client.admin().organization().certificates().delete("certificate_id"); + } +} +``` + +#### Response + +```json +{ + "id": "id", + "object": "certificate.deleted" +} +``` + +## Activate certificates for organization + +`CertificateActivatePage admin().organization().certificates().activate(CertificateActivateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/organization/certificates/activate` + +Activate certificates at the organization level. + +You can atomically and idempotently activate up to 10 certificates at a time. + +### Parameters + +- `CertificateActivateParams params` + + - `List certificateIds` + +### Returns + +- `class CertificateActivateResponse:` + + Represents an individual certificate configured at the organization level. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `boolean active` + + Whether the certificate is currently active at the organization level. + + - `CertificateDetails certificateDetails` + + - `Optional expiresAt` + + The Unix timestamp (in seconds) of when the certificate expires. + + - `Optional validAt` + + The Unix timestamp (in seconds) of when the certificate becomes valid. + + - `long createdAt` + + The Unix timestamp (in seconds) of when the certificate was uploaded. + + - `Optional name` + + The name of the certificate. + + - `JsonValue; object_ "organization.certificate"constant` + + The object type, which is always `organization.certificate`. + + - `ORGANIZATION_CERTIFICATE("organization.certificate")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.certificates.CertificateActivatePage; +import com.openai.models.admin.organization.certificates.CertificateActivateParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + CertificateActivateParams params = CertificateActivateParams.builder() + .addCertificateId("cert_abc") + .build(); + CertificateActivatePage page = client.admin().organization().certificates().activate(params); + } +} +``` + +#### Response + +```json +{ + "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" +} +``` + +## Deactivate certificates for organization + +`CertificateDeactivatePage admin().organization().certificates().deactivate(CertificateDeactivateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/organization/certificates/deactivate` + +Deactivate certificates at the organization level. + +You can atomically and idempotently deactivate up to 10 certificates at a time. + +### Parameters + +- `CertificateDeactivateParams params` + + - `List certificateIds` + +### Returns + +- `class CertificateDeactivateResponse:` + + Represents an individual certificate configured at the organization level. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `boolean active` + + Whether the certificate is currently active at the organization level. + + - `CertificateDetails certificateDetails` + + - `Optional expiresAt` + + The Unix timestamp (in seconds) of when the certificate expires. + + - `Optional validAt` + + The Unix timestamp (in seconds) of when the certificate becomes valid. + + - `long createdAt` + + The Unix timestamp (in seconds) of when the certificate was uploaded. + + - `Optional name` + + The name of the certificate. + + - `JsonValue; object_ "organization.certificate"constant` + + The object type, which is always `organization.certificate`. + + - `ORGANIZATION_CERTIFICATE("organization.certificate")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.certificates.CertificateDeactivatePage; +import com.openai.models.admin.organization.certificates.CertificateDeactivateParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + CertificateDeactivateParams params = CertificateDeactivateParams.builder() + .addCertificateId("cert_abc") + .build(); + CertificateDeactivatePage page = client.admin().organization().certificates().deactivate(params); + } +} +``` + +#### Response + +```json +{ + "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" +} +``` + +## Domain Types + +### Certificate + +- `class Certificate:` + + Represents an individual `certificate` uploaded to the organization. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `CertificateDetails certificateDetails` + + - `Optional content` + + The content of the certificate in PEM format. + + - `Optional expiresAt` + + The Unix timestamp (in seconds) of when the certificate expires. + + - `Optional validAt` + + The Unix timestamp (in seconds) of when the certificate becomes valid. + + - `long createdAt` + + The Unix timestamp (in seconds) of when the certificate was uploaded. + + - `Optional name` + + The name of the certificate. + + - `Object object_` + + 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("certificate")` + + - `ORGANIZATION_CERTIFICATE("organization.certificate")` + + - `ORGANIZATION_PROJECT_CERTIFICATE("organization.project.certificate")` + + - `Optional active` + + Whether the certificate is currently active at the specified scope. Not returned when getting details for a specific certificate. + +# Projects + +## List projects + +`ProjectListPage admin().organization().projects().list(ProjectListParamsparams = ProjectListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/projects` + +Returns a list of projects. + +### Parameters + +- `ProjectListParams params` + + - `Optional after` + + A cursor for use in pagination. `after` is 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. + + - `Optional includeArchived` + + If `true` returns all projects including those that have been `archived`. Archived projects are not included by default. + + - `Optional limit` + + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + +### Returns + +- `class Project:` + + Represents an individual project. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `long createdAt` + + The Unix timestamp (in seconds) of when the project was created. + + - `JsonValue; object_ "organization.project"constant` + + The object type, which is always `organization.project` + + - `ORGANIZATION_PROJECT("organization.project")` + + - `Optional archivedAt` + + The Unix timestamp (in seconds) of when the project was archived or `null`. + + - `Optional externalKeyId` + + The external key associated with the project. + + - `Optional name` + + The name of the project. This appears in reporting. + + - `Optional status` + + `active` or `archived` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.ProjectListPage; +import com.openai.models.admin.organization.projects.ProjectListParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ProjectListPage page = client.admin().organization().projects().list(); + } +} +``` + +#### Response + +```json +{ + "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" +} +``` + +## Create project + +`Project admin().organization().projects().create(ProjectCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/organization/projects` + +Create a new project in the organization. Projects can be created and archived, but cannot be deleted. + +### Parameters + +- `ProjectCreateParams params` + + - `String name` + + The friendly name of the project, this name appears in reports. + + - `Optional externalKeyId` + + External key ID to associate with the project. + + - `Optional geography` + + Create 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](https://platform.openai.com/docs/guides/your-data#data-residency-controls) to review the functionality and limitations of setting this field. + +### Returns + +- `class Project:` + + Represents an individual project. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `long createdAt` + + The Unix timestamp (in seconds) of when the project was created. + + - `JsonValue; object_ "organization.project"constant` + + The object type, which is always `organization.project` + + - `ORGANIZATION_PROJECT("organization.project")` + + - `Optional archivedAt` + + The Unix timestamp (in seconds) of when the project was archived or `null`. + + - `Optional externalKeyId` + + The external key associated with the project. + + - `Optional name` + + The name of the project. This appears in reporting. + + - `Optional status` + + `active` or `archived` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.Project; +import com.openai.models.admin.organization.projects.ProjectCreateParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ProjectCreateParams params = ProjectCreateParams.builder() + .name("name") + .build(); + Project project = client.admin().organization().projects().create(params); + } +} +``` + +#### Response + +```json +{ + "id": "id", + "created_at": 0, + "object": "organization.project", + "archived_at": 0, + "external_key_id": "external_key_id", + "name": "name", + "status": "status" +} +``` + +## Retrieve project + +`Project admin().organization().projects().retrieve(ProjectRetrieveParamsparams = ProjectRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/projects/{project_id}` + +Retrieves a project. + +### Parameters + +- `ProjectRetrieveParams params` + + - `Optional projectId` + +### Returns + +- `class Project:` + + Represents an individual project. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `long createdAt` + + The Unix timestamp (in seconds) of when the project was created. + + - `JsonValue; object_ "organization.project"constant` + + The object type, which is always `organization.project` + + - `ORGANIZATION_PROJECT("organization.project")` + + - `Optional archivedAt` + + The Unix timestamp (in seconds) of when the project was archived or `null`. + + - `Optional externalKeyId` + + The external key associated with the project. + + - `Optional name` + + The name of the project. This appears in reporting. + + - `Optional status` + + `active` or `archived` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.Project; +import com.openai.models.admin.organization.projects.ProjectRetrieveParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Project project = client.admin().organization().projects().retrieve("project_id"); + } +} +``` + +#### Response + +```json +{ + "id": "id", + "created_at": 0, + "object": "organization.project", + "archived_at": 0, + "external_key_id": "external_key_id", + "name": "name", + "status": "status" +} +``` + +## Modify project + +`Project admin().organization().projects().update(ProjectUpdateParamsparams = ProjectUpdateParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/organization/projects/{project_id}` + +Modifies a project in the organization. + +### Parameters + +- `ProjectUpdateParams params` + + - `Optional projectId` + + - `Optional externalKeyId` + + External key ID to associate with the project. + + - `Optional geography` + + Geography for the project. + + - `Optional name` + + The updated name of the project, this name appears in reports. + +### Returns + +- `class Project:` + + Represents an individual project. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `long createdAt` + + The Unix timestamp (in seconds) of when the project was created. + + - `JsonValue; object_ "organization.project"constant` + + The object type, which is always `organization.project` + + - `ORGANIZATION_PROJECT("organization.project")` + + - `Optional archivedAt` + + The Unix timestamp (in seconds) of when the project was archived or `null`. + + - `Optional externalKeyId` + + The external key associated with the project. + + - `Optional name` + + The name of the project. This appears in reporting. + + - `Optional status` + + `active` or `archived` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.Project; +import com.openai.models.admin.organization.projects.ProjectUpdateParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Project project = client.admin().organization().projects().update("project_id"); + } +} +``` + +#### Response + +```json +{ + "id": "id", + "created_at": 0, + "object": "organization.project", + "archived_at": 0, + "external_key_id": "external_key_id", + "name": "name", + "status": "status" +} +``` + +## Archive project + +`Project admin().organization().projects().archive(ProjectArchiveParamsparams = ProjectArchiveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/organization/projects/{project_id}/archive` + +Archives a project in the organization. Archived projects cannot be used or updated. + +### Parameters + +- `ProjectArchiveParams params` + + - `Optional projectId` + +### Returns + +- `class Project:` + + Represents an individual project. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `long createdAt` + + The Unix timestamp (in seconds) of when the project was created. + + - `JsonValue; object_ "organization.project"constant` + + The object type, which is always `organization.project` + + - `ORGANIZATION_PROJECT("organization.project")` + + - `Optional archivedAt` + + The Unix timestamp (in seconds) of when the project was archived or `null`. + + - `Optional externalKeyId` + + The external key associated with the project. + + - `Optional name` + + The name of the project. This appears in reporting. + + - `Optional status` + + `active` or `archived` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.Project; +import com.openai.models.admin.organization.projects.ProjectArchiveParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Project project = client.admin().organization().projects().archive("project_id"); + } +} +``` + +#### Response + +```json +{ + "id": "id", + "created_at": 0, + "object": "organization.project", + "archived_at": 0, + "external_key_id": "external_key_id", + "name": "name", + "status": "status" +} +``` + +## Domain Types + +### Project + +- `class Project:` + + Represents an individual project. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `long createdAt` + + The Unix timestamp (in seconds) of when the project was created. + + - `JsonValue; object_ "organization.project"constant` + + The object type, which is always `organization.project` + + - `ORGANIZATION_PROJECT("organization.project")` + + - `Optional archivedAt` + + The Unix timestamp (in seconds) of when the project was archived or `null`. + + - `Optional externalKeyId` + + The external key associated with the project. + + - `Optional name` + + The name of the project. This appears in reporting. + + - `Optional status` + + `active` or `archived` + +# Users + +## List project users + +`UserListPage admin().organization().projects().users().list(UserListParamsparams = UserListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/projects/{project_id}/users` + +Returns a list of users in the project. + +### Parameters + +- `UserListParams params` + + - `Optional projectId` + + - `Optional after` + + A cursor for use in pagination. `after` is 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. + + - `Optional limit` + + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + +### Returns + +- `class ProjectUser:` + + Represents an individual user in a project. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `long addedAt` + + The Unix timestamp (in seconds) of when the project was added. + + - `JsonValue; object_ "organization.project.user"constant` + + The object type, which is always `organization.project.user` + + - `ORGANIZATION_PROJECT_USER("organization.project.user")` + + - `String role` + + `owner` or `member` + + - `Optional email` + + The email address of the user + + - `Optional name` + + The name of the user + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.users.UserListPage; +import com.openai.models.admin.organization.projects.users.UserListParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UserListPage page = client.admin().organization().projects().users().list("project_id"); + } +} +``` + +#### Response + +```json +{ + "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" +} +``` + +## Create project user + +`ProjectUser admin().organization().projects().users().create(UserCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/organization/projects/{project_id}/users` + +Adds a user to the project. Users must already be members of the organization to be added to a project. + +### Parameters + +- `UserCreateParams params` + + - `Optional projectId` + + - `String role` + + `owner` or `member` + + - `Optional email` + + Email of the user to add. + + - `Optional userId` + + The ID of the user. + +### Returns + +- `class ProjectUser:` + + Represents an individual user in a project. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `long addedAt` + + The Unix timestamp (in seconds) of when the project was added. + + - `JsonValue; object_ "organization.project.user"constant` + + The object type, which is always `organization.project.user` + + - `ORGANIZATION_PROJECT_USER("organization.project.user")` + + - `String role` + + `owner` or `member` + + - `Optional email` + + The email address of the user + + - `Optional name` + + The name of the user + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.users.ProjectUser; +import com.openai.models.admin.organization.projects.users.UserCreateParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UserCreateParams params = UserCreateParams.builder() + .projectId("project_id") + .role("role") + .build(); + ProjectUser projectUser = client.admin().organization().projects().users().create(params); + } +} +``` + +#### Response + +```json +{ + "id": "id", + "added_at": 0, + "object": "organization.project.user", + "role": "role", + "email": "email", + "name": "name" +} +``` + +## Retrieve project user + +`ProjectUser admin().organization().projects().users().retrieve(UserRetrieveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/projects/{project_id}/users/{user_id}` + +Retrieves a user in the project. + +### Parameters + +- `UserRetrieveParams params` + + - `String projectId` + + - `Optional userId` + +### Returns + +- `class ProjectUser:` + + Represents an individual user in a project. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `long addedAt` + + The Unix timestamp (in seconds) of when the project was added. + + - `JsonValue; object_ "organization.project.user"constant` + + The object type, which is always `organization.project.user` + + - `ORGANIZATION_PROJECT_USER("organization.project.user")` + + - `String role` + + `owner` or `member` + + - `Optional email` + + The email address of the user + + - `Optional name` + + The name of the user + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.users.ProjectUser; +import com.openai.models.admin.organization.projects.users.UserRetrieveParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UserRetrieveParams params = UserRetrieveParams.builder() + .projectId("project_id") + .userId("user_id") + .build(); + ProjectUser projectUser = client.admin().organization().projects().users().retrieve(params); + } +} +``` + +#### Response + +```json +{ + "id": "id", + "added_at": 0, + "object": "organization.project.user", + "role": "role", + "email": "email", + "name": "name" +} +``` + +## Modify project user + +`ProjectUser admin().organization().projects().users().update(UserUpdateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/organization/projects/{project_id}/users/{user_id}` + +Modifies a user's role in the project. + +### Parameters + +- `UserUpdateParams params` + + - `String projectId` + + - `Optional userId` + + - `Optional role` + + `owner` or `member` + +### Returns + +- `class ProjectUser:` + + Represents an individual user in a project. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `long addedAt` + + The Unix timestamp (in seconds) of when the project was added. + + - `JsonValue; object_ "organization.project.user"constant` + + The object type, which is always `organization.project.user` + + - `ORGANIZATION_PROJECT_USER("organization.project.user")` + + - `String role` + + `owner` or `member` + + - `Optional email` + + The email address of the user + + - `Optional name` + + The name of the user + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.users.ProjectUser; +import com.openai.models.admin.organization.projects.users.UserUpdateParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UserUpdateParams params = UserUpdateParams.builder() + .projectId("project_id") + .userId("user_id") + .build(); + ProjectUser projectUser = client.admin().organization().projects().users().update(params); + } +} +``` + +#### Response + +```json +{ + "id": "id", + "added_at": 0, + "object": "organization.project.user", + "role": "role", + "email": "email", + "name": "name" +} +``` + +## Delete project user + +`UserDeleteResponse admin().organization().projects().users().delete(UserDeleteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**delete** `/organization/projects/{project_id}/users/{user_id}` + +Deletes a user from the project. + +Returns confirmation of project user deletion, or an error if the project is +archived (archived projects have no users). + +### Parameters + +- `UserDeleteParams params` + + - `String projectId` + + - `Optional userId` + +### Returns + +- `class UserDeleteResponse:` + + - `String id` + + - `boolean deleted` + + - `JsonValue; object_ "organization.project.user.deleted"constant` + + - `ORGANIZATION_PROJECT_USER_DELETED("organization.project.user.deleted")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.users.UserDeleteParams; +import com.openai.models.admin.organization.projects.users.UserDeleteResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UserDeleteParams params = UserDeleteParams.builder() + .projectId("project_id") + .userId("user_id") + .build(); + UserDeleteResponse user = client.admin().organization().projects().users().delete(params); + } +} +``` + +#### Response + +```json +{ + "id": "id", + "deleted": true, + "object": "organization.project.user.deleted" +} +``` + +## Domain Types + +### Project User + +- `class ProjectUser:` + + Represents an individual user in a project. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `long addedAt` + + The Unix timestamp (in seconds) of when the project was added. + + - `JsonValue; object_ "organization.project.user"constant` + + The object type, which is always `organization.project.user` + + - `ORGANIZATION_PROJECT_USER("organization.project.user")` + + - `String role` + + `owner` or `member` + + - `Optional email` + + The email address of the user + + - `Optional name` + + The name of the user + +# Roles + +## List project user role assignments + +`RoleListPage admin().organization().projects().users().roles().list(RoleListParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/projects/{project_id}/users/{user_id}/roles` + +Lists the project roles assigned to a user within a project. + +### Parameters + +- `RoleListParams params` + + - `String projectId` + + - `Optional userId` + + - `Optional after` + + Cursor for pagination. Provide the value from the previous response's `next` field to continue listing project roles. + + - `Optional limit` + + A limit on the number of project role assignments to return. + + - `Optional order` + + Sort order for the returned project roles. + + - `ASC("asc")` + + - `DESC("desc")` + +### Returns + +- `class RoleListResponse:` + + Detailed information about a role assignment entry returned when listing assignments. + + - `String id` + + Identifier for the role. + + - `Optional> assignmentSources` + + Principals from which the role assignment is inherited, when available. + + - `String principalId` + + - `String principalType` + + - `Optional createdAt` + + When the role was created. + + - `Optional createdBy` + + Identifier of the actor who created the role. + + - `Optional createdByUserObj` + + User details for the actor that created the role, when available. + + - `Optional description` + + Description of the role. + + - `Optional metadata` + + Arbitrary metadata stored on the role. + + - `String name` + + Name of the role. + + - `List permissions` + + Permissions associated with the role. + + - `boolean predefinedRole` + + Whether the role is predefined by OpenAI. + + - `String resourceType` + + Resource type the role applies to. + + - `Optional updatedAt` + + When the role was last updated. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.users.roles.RoleListPage; +import com.openai.models.admin.organization.projects.users.roles.RoleListParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleListParams params = RoleListParams.builder() + .projectId("project_id") + .userId("user_id") + .build(); + RoleListPage page = client.admin().organization().projects().users().roles().list(params); + } +} +``` + +#### Response + +```json +{ + "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" +} +``` + +## Assign project role to user + +`RoleCreateResponse admin().organization().projects().users().roles().create(RoleCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/projects/{project_id}/users/{user_id}/roles` + +Assigns a project role to a user within a project. + +### Parameters + +- `RoleCreateParams params` + + - `String projectId` + + - `Optional userId` + + - `String roleId` + + Identifier of the role to assign. + +### Returns + +- `class RoleCreateResponse:` + + Role assignment linking a user to a role. + + - `JsonValue; object_ "user.role"constant` + + Always `user.role`. + + - `USER_ROLE("user.role")` + + - `Role role` + + Details about a role that can be assigned through the public Roles API. + + - `String id` + + Identifier for the role. + + - `Optional description` + + Optional description of the role. + + - `String name` + + Unique name for the role. + + - `JsonValue; object_ "role"constant` + + Always `role`. + + - `ROLE("role")` + + - `List permissions` + + Permissions granted by the role. + + - `boolean predefinedRole` + + Whether the role is predefined and managed by OpenAI. + + - `String resourceType` + + Resource type the role is bound to (for example `api.organization` or `api.project`). + + - `OrganizationUser user` + + Represents an individual `user` within an organization. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `long addedAt` + + The Unix timestamp (in seconds) of when the user was added. + + - `JsonValue; object_ "organization.user"constant` + + The object type, which is always `organization.user` + + - `ORGANIZATION_USER("organization.user")` + + - `Optional apiKeyLastUsedAt` + + The Unix timestamp (in seconds) of the user's last API key usage. + + - `Optional created` + + The Unix timestamp (in seconds) of when the user was created. + + - `Optional developerPersona` + + The developer persona metadata for the user. + + - `Optional email` + + The email address of the user + + - `Optional isDefault` + + Whether this is the organization's default user. + + - `Optional isScaleTierAuthorizedPurchaser` + + Whether the user is an authorized purchaser for Scale Tier. + + - `Optional isScimManaged` + + Whether the user is managed through SCIM. + + - `Optional isServiceAccount` + + Whether the user is a service account. + + - `Optional name` + + The name of the user + + - `Optional projects` + + Projects associated with the user, if included. + + - `List data` + + - `Optional id` + + - `Optional name` + + - `Optional role` + + - `JsonValue; object_ "list"constant` + + - `LIST("list")` + + - `Optional role` + + `owner` or `reader` + + - `Optional technicalLevel` + + The technical level metadata for the user. + + - `Optional user` + + Nested user details. + + - `String id` + + - `JsonValue; object_ "user"constant` + + - `USER("user")` + + - `Optional banned` + + - `Optional bannedAt` + + - `Optional email` + + - `Optional enabled` + + - `Optional name` + + - `Optional picture` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.users.roles.RoleCreateParams; +import com.openai.models.admin.organization.projects.users.roles.RoleCreateResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleCreateParams params = RoleCreateParams.builder() + .projectId("project_id") + .userId("user_id") + .roleId("role_id") + .build(); + RoleCreateResponse role = client.admin().organization().projects().users().roles().create(params); + } +} +``` + +#### Response + +```json +{ + "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" + } + } +} +``` + +## Retrieve project user role + +`RoleRetrieveResponse admin().organization().projects().users().roles().retrieve(RoleRetrieveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/projects/{project_id}/users/{user_id}/roles/{role_id}` + +Retrieves a project role assigned to a user. + +### Parameters + +- `RoleRetrieveParams params` + + - `String projectId` + + - `String userId` + + - `Optional roleId` + +### Returns + +- `class RoleRetrieveResponse:` + + Detailed information about a role assignment entry returned when listing assignments. + + - `String id` + + Identifier for the role. + + - `Optional> assignmentSources` + + Principals from which the role assignment is inherited, when available. + + - `String principalId` + + - `String principalType` + + - `Optional createdAt` + + When the role was created. + + - `Optional createdBy` + + Identifier of the actor who created the role. + + - `Optional createdByUserObj` + + User details for the actor that created the role, when available. + + - `Optional description` + + Description of the role. + + - `Optional metadata` + + Arbitrary metadata stored on the role. + + - `String name` + + Name of the role. + + - `List permissions` + + Permissions associated with the role. + + - `boolean predefinedRole` + + Whether the role is predefined by OpenAI. + + - `String resourceType` + + Resource type the role applies to. + + - `Optional updatedAt` + + When the role was last updated. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.users.roles.RoleRetrieveParams; +import com.openai.models.admin.organization.projects.users.roles.RoleRetrieveResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleRetrieveParams params = RoleRetrieveParams.builder() + .projectId("project_id") + .userId("user_id") + .roleId("role_id") + .build(); + RoleRetrieveResponse role = client.admin().organization().projects().users().roles().retrieve(params); + } +} +``` + +#### Response + +```json +{ + "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 +} +``` + +## Unassign project role from user + +`RoleDeleteResponse admin().organization().projects().users().roles().delete(RoleDeleteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**delete** `/projects/{project_id}/users/{user_id}/roles/{role_id}` + +Unassigns a project role from a user within a project. + +### Parameters + +- `RoleDeleteParams params` + + - `String projectId` + + - `String userId` + + - `Optional roleId` + +### Returns + +- `class RoleDeleteResponse:` + + Confirmation payload returned after unassigning a role. + + - `boolean deleted` + + Whether the assignment was removed. + + - `String object_` + + Identifier for the deleted assignment, such as `group.role.deleted` or `user.role.deleted`. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.users.roles.RoleDeleteParams; +import com.openai.models.admin.organization.projects.users.roles.RoleDeleteResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleDeleteParams params = RoleDeleteParams.builder() + .projectId("project_id") + .userId("user_id") + .roleId("role_id") + .build(); + RoleDeleteResponse role = client.admin().organization().projects().users().roles().delete(params); + } +} +``` + +#### Response + +```json +{ + "deleted": true, + "object": "object" +} +``` + +# Service Accounts + +## List project service accounts + +`ServiceAccountListPage admin().organization().projects().serviceAccounts().list(ServiceAccountListParamsparams = ServiceAccountListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/projects/{project_id}/service_accounts` + +Returns a list of service accounts in the project. + +### Parameters + +- `ServiceAccountListParams params` + + - `Optional projectId` + + - `Optional after` + + A cursor for use in pagination. `after` is 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. + + - `Optional limit` + + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + +### Returns + +- `class ProjectServiceAccount:` + + Represents an individual service account in a project. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `long createdAt` + + The Unix timestamp (in seconds) of when the service account was created + + - `String name` + + The name of the service account + + - `JsonValue; object_ "organization.project.service_account"constant` + + The object type, which is always `organization.project.service_account` + + - `ORGANIZATION_PROJECT_SERVICE_ACCOUNT("organization.project.service_account")` + + - `Role role` + + `owner` or `member` + + - `OWNER("owner")` + + - `MEMBER("member")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.serviceaccounts.ServiceAccountListPage; +import com.openai.models.admin.organization.projects.serviceaccounts.ServiceAccountListParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ServiceAccountListPage page = client.admin().organization().projects().serviceAccounts().list("project_id"); + } +} +``` + +#### Response + +```json +{ + "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" +} +``` + +## Create project service account + +`ServiceAccountCreateResponse admin().organization().projects().serviceAccounts().create(ServiceAccountCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/organization/projects/{project_id}/service_accounts` + +Creates a new service account in the project. This also returns an unredacted API key for the service account. + +### Parameters + +- `ServiceAccountCreateParams params` + + - `Optional projectId` + + - `String name` + + The name of the service account being created. + +### Returns + +- `class ServiceAccountCreateResponse:` + + - `String id` + + - `Optional apiKey` + + - `String id` + + - `long createdAt` + + - `String name` + + - `JsonValue; object_ "organization.project.service_account.api_key"constant` + + The object type, which is always `organization.project.service_account.api_key` + + - `ORGANIZATION_PROJECT_SERVICE_ACCOUNT_API_KEY("organization.project.service_account.api_key")` + + - `String value` + + - `long createdAt` + + - `String name` + + - `JsonValue; object_ "organization.project.service_account"constant` + + - `ORGANIZATION_PROJECT_SERVICE_ACCOUNT("organization.project.service_account")` + + - `JsonValue; role "member"constant` + + Service accounts can only have one role of type `member` + + - `MEMBER("member")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.serviceaccounts.ServiceAccountCreateParams; +import com.openai.models.admin.organization.projects.serviceaccounts.ServiceAccountCreateResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ServiceAccountCreateParams params = ServiceAccountCreateParams.builder() + .projectId("project_id") + .name("name") + .build(); + ServiceAccountCreateResponse serviceAccount = client.admin().organization().projects().serviceAccounts().create(params); + } +} +``` + +#### Response + +```json +{ + "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" +} +``` + +## Retrieve project service account + +`ProjectServiceAccount admin().organization().projects().serviceAccounts().retrieve(ServiceAccountRetrieveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/projects/{project_id}/service_accounts/{service_account_id}` + +Retrieves a service account in the project. + +### Parameters + +- `ServiceAccountRetrieveParams params` + + - `String projectId` + + - `Optional serviceAccountId` + +### Returns + +- `class ProjectServiceAccount:` + + Represents an individual service account in a project. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `long createdAt` + + The Unix timestamp (in seconds) of when the service account was created + + - `String name` + + The name of the service account + + - `JsonValue; object_ "organization.project.service_account"constant` + + The object type, which is always `organization.project.service_account` + + - `ORGANIZATION_PROJECT_SERVICE_ACCOUNT("organization.project.service_account")` + + - `Role role` + + `owner` or `member` + + - `OWNER("owner")` + + - `MEMBER("member")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.serviceaccounts.ProjectServiceAccount; +import com.openai.models.admin.organization.projects.serviceaccounts.ServiceAccountRetrieveParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ServiceAccountRetrieveParams params = ServiceAccountRetrieveParams.builder() + .projectId("project_id") + .serviceAccountId("service_account_id") + .build(); + ProjectServiceAccount projectServiceAccount = client.admin().organization().projects().serviceAccounts().retrieve(params); + } +} +``` + +#### Response + +```json +{ + "id": "id", + "created_at": 0, + "name": "name", + "object": "organization.project.service_account", + "role": "owner" +} +``` + +## Update project service account + +`ProjectServiceAccount admin().organization().projects().serviceAccounts().update(ServiceAccountUpdateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/organization/projects/{project_id}/service_accounts/{service_account_id}` + +Updates a service account in the project. + +### Parameters + +- `ServiceAccountUpdateParams params` + + - `String projectId` + + - `Optional serviceAccountId` + + - `Optional name` + + The updated service account name. + + - `Optional role` + + The updated service account role. + + - `MEMBER("member")` + + - `OWNER("owner")` + +### Returns + +- `class ProjectServiceAccount:` + + Represents an individual service account in a project. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `long createdAt` + + The Unix timestamp (in seconds) of when the service account was created + + - `String name` + + The name of the service account + + - `JsonValue; object_ "organization.project.service_account"constant` + + The object type, which is always `organization.project.service_account` + + - `ORGANIZATION_PROJECT_SERVICE_ACCOUNT("organization.project.service_account")` + + - `Role role` + + `owner` or `member` + + - `OWNER("owner")` + + - `MEMBER("member")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.serviceaccounts.ProjectServiceAccount; +import com.openai.models.admin.organization.projects.serviceaccounts.ServiceAccountUpdateParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ServiceAccountUpdateParams params = ServiceAccountUpdateParams.builder() + .projectId("project_id") + .serviceAccountId("service_account_id") + .build(); + ProjectServiceAccount projectServiceAccount = client.admin().organization().projects().serviceAccounts().update(params); + } +} +``` + +#### Response + +```json +{ + "id": "id", + "created_at": 0, + "name": "name", + "object": "organization.project.service_account", + "role": "owner" +} +``` + +## Delete project service account + +`ServiceAccountDeleteResponse admin().organization().projects().serviceAccounts().delete(ServiceAccountDeleteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**delete** `/organization/projects/{project_id}/service_accounts/{service_account_id}` + +Deletes a service account from the project. + +Returns confirmation of service account deletion, or an error if the project +is archived (archived projects have no service accounts). + +### Parameters + +- `ServiceAccountDeleteParams params` + + - `String projectId` + + - `Optional serviceAccountId` + +### Returns + +- `class ServiceAccountDeleteResponse:` + + - `String id` + + - `boolean deleted` + + - `JsonValue; object_ "organization.project.service_account.deleted"constant` + + - `ORGANIZATION_PROJECT_SERVICE_ACCOUNT_DELETED("organization.project.service_account.deleted")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.serviceaccounts.ServiceAccountDeleteParams; +import com.openai.models.admin.organization.projects.serviceaccounts.ServiceAccountDeleteResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ServiceAccountDeleteParams params = ServiceAccountDeleteParams.builder() + .projectId("project_id") + .serviceAccountId("service_account_id") + .build(); + ServiceAccountDeleteResponse serviceAccount = client.admin().organization().projects().serviceAccounts().delete(params); + } +} +``` + +#### Response + +```json +{ + "id": "id", + "deleted": true, + "object": "organization.project.service_account.deleted" +} +``` + +## Domain Types + +### Project Service Account + +- `class ProjectServiceAccount:` + + Represents an individual service account in a project. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `long createdAt` + + The Unix timestamp (in seconds) of when the service account was created + + - `String name` + + The name of the service account + + - `JsonValue; object_ "organization.project.service_account"constant` + + The object type, which is always `organization.project.service_account` + + - `ORGANIZATION_PROJECT_SERVICE_ACCOUNT("organization.project.service_account")` + + - `Role role` + + `owner` or `member` + + - `OWNER("owner")` + + - `MEMBER("member")` + +# API Keys + +## List project API keys + +`ApiKeyListPage admin().organization().projects().apiKeys().list(ApiKeyListParamsparams = ApiKeyListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/projects/{project_id}/api_keys` + +Returns a list of API keys in the project. + +### Parameters + +- `ApiKeyListParams params` + + - `Optional projectId` + + - `Optional after` + + A cursor for use in pagination. `after` is 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. + + - `Optional limit` + + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + +### Returns + +- `class ProjectApiKey:` + + Represents an individual API key in a project. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `long createdAt` + + The Unix timestamp (in seconds) of when the API key was created + + - `Optional lastUsedAt` + + The Unix timestamp (in seconds) of when the API key was last used. + + - `String name` + + The name of the API key + + - `JsonValue; object_ "organization.project.api_key"constant` + + The object type, which is always `organization.project.api_key` + + - `ORGANIZATION_PROJECT_API_KEY("organization.project.api_key")` + + - `Owner owner` + + - `Optional serviceAccount` + + The service account that owns a project API key. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `long createdAt` + + The Unix timestamp (in seconds) of when the service account was created. + + - `String name` + + The name of the service account. + + - `String role` + + The service account's project role. + + - `Optional type` + + `user` or `service_account` + + - `USER("user")` + + - `SERVICE_ACCOUNT("service_account")` + + - `Optional user` + + The user that owns a project API key. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `long createdAt` + + The Unix timestamp (in seconds) of when the user was created. + + - `String email` + + The email address of the user. + + - `String name` + + The name of the user. + + - `String role` + + The user's project role. + + - `String redactedValue` + + The redacted value of the API key + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.apikeys.ApiKeyListPage; +import com.openai.models.admin.organization.projects.apikeys.ApiKeyListParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ApiKeyListPage page = client.admin().organization().projects().apiKeys().list("project_id"); + } +} +``` + +#### Response + +```json +{ + "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" +} +``` + +## Retrieve project API key + +`ProjectApiKey admin().organization().projects().apiKeys().retrieve(ApiKeyRetrieveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/projects/{project_id}/api_keys/{api_key_id}` + +Retrieves an API key in the project. + +### Parameters + +- `ApiKeyRetrieveParams params` + + - `String projectId` + + - `Optional apiKeyId` + +### Returns + +- `class ProjectApiKey:` + + Represents an individual API key in a project. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `long createdAt` + + The Unix timestamp (in seconds) of when the API key was created + + - `Optional lastUsedAt` + + The Unix timestamp (in seconds) of when the API key was last used. + + - `String name` + + The name of the API key + + - `JsonValue; object_ "organization.project.api_key"constant` + + The object type, which is always `organization.project.api_key` + + - `ORGANIZATION_PROJECT_API_KEY("organization.project.api_key")` + + - `Owner owner` + + - `Optional serviceAccount` + + The service account that owns a project API key. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `long createdAt` + + The Unix timestamp (in seconds) of when the service account was created. + + - `String name` + + The name of the service account. + + - `String role` + + The service account's project role. + + - `Optional type` + + `user` or `service_account` + + - `USER("user")` + + - `SERVICE_ACCOUNT("service_account")` + + - `Optional user` + + The user that owns a project API key. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `long createdAt` + + The Unix timestamp (in seconds) of when the user was created. + + - `String email` + + The email address of the user. + + - `String name` + + The name of the user. + + - `String role` + + The user's project role. + + - `String redactedValue` + + The redacted value of the API key + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.apikeys.ApiKeyRetrieveParams; +import com.openai.models.admin.organization.projects.apikeys.ProjectApiKey; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ApiKeyRetrieveParams params = ApiKeyRetrieveParams.builder() + .projectId("project_id") + .apiKeyId("api_key_id") + .build(); + ProjectApiKey projectApiKey = client.admin().organization().projects().apiKeys().retrieve(params); + } +} +``` + +#### Response + +```json +{ + "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" +} +``` + +## Delete project API key + +`ApiKeyDeleteResponse admin().organization().projects().apiKeys().delete(ApiKeyDeleteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**delete** `/organization/projects/{project_id}/api_keys/{api_key_id}` + +Deletes an API key from the project. + +Returns confirmation of the key deletion, or an error if the key belonged to +a service account. + +### Parameters + +- `ApiKeyDeleteParams params` + + - `String projectId` + + - `Optional apiKeyId` + +### Returns + +- `class ApiKeyDeleteResponse:` + + - `String id` + + - `boolean deleted` + + - `JsonValue; object_ "organization.project.api_key.deleted"constant` + + - `ORGANIZATION_PROJECT_API_KEY_DELETED("organization.project.api_key.deleted")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.apikeys.ApiKeyDeleteParams; +import com.openai.models.admin.organization.projects.apikeys.ApiKeyDeleteResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ApiKeyDeleteParams params = ApiKeyDeleteParams.builder() + .projectId("project_id") + .apiKeyId("api_key_id") + .build(); + ApiKeyDeleteResponse apiKey = client.admin().organization().projects().apiKeys().delete(params); + } +} +``` + +#### Response + +```json +{ + "id": "id", + "deleted": true, + "object": "organization.project.api_key.deleted" +} +``` + +## Domain Types + +### Project API Key + +- `class ProjectApiKey:` + + Represents an individual API key in a project. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `long createdAt` + + The Unix timestamp (in seconds) of when the API key was created + + - `Optional lastUsedAt` + + The Unix timestamp (in seconds) of when the API key was last used. + + - `String name` + + The name of the API key + + - `JsonValue; object_ "organization.project.api_key"constant` + + The object type, which is always `organization.project.api_key` + + - `ORGANIZATION_PROJECT_API_KEY("organization.project.api_key")` + + - `Owner owner` + + - `Optional serviceAccount` + + The service account that owns a project API key. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `long createdAt` + + The Unix timestamp (in seconds) of when the service account was created. + + - `String name` + + The name of the service account. + + - `String role` + + The service account's project role. + + - `Optional type` + + `user` or `service_account` + + - `USER("user")` + + - `SERVICE_ACCOUNT("service_account")` + + - `Optional user` + + The user that owns a project API key. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `long createdAt` + + The Unix timestamp (in seconds) of when the user was created. + + - `String email` + + The email address of the user. + + - `String name` + + The name of the user. + + - `String role` + + The user's project role. + + - `String redactedValue` + + The redacted value of the API key + +# Rate Limits + +## List project rate limits + +`RateLimitListRateLimitsPage admin().organization().projects().rateLimits().listRateLimits(RateLimitListRateLimitsParamsparams = RateLimitListRateLimitsParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/projects/{project_id}/rate_limits` + +Returns the rate limits per model for a project. + +### Parameters + +- `RateLimitListRateLimitsParams params` + + - `Optional projectId` + + - `Optional after` + + A cursor for use in pagination. `after` is 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. + + - `Optional before` + + A cursor for use in pagination. `before` is 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. + + - `Optional limit` + + A limit on the number of objects to be returned. The default is 100. + +### Returns + +- `class ProjectRateLimit:` + + Represents a project rate limit config. + + - `String id` + + The identifier, which can be referenced in API endpoints. + + - `long maxRequestsPer1Minute` + + The maximum requests per minute. + + - `long maxTokensPer1Minute` + + The maximum tokens per minute. + + - `String model` + + The model this rate limit applies to. + + - `JsonValue; object_ "project.rate_limit"constant` + + The object type, which is always `project.rate_limit` + + - `PROJECT_RATE_LIMIT("project.rate_limit")` + + - `Optional batch1DayMaxInputTokens` + + The maximum batch input tokens per day. Only present for relevant models. + + - `Optional maxAudioMegabytesPer1Minute` + + The maximum audio megabytes per minute. Only present for relevant models. + + - `Optional maxImagesPer1Minute` + + The maximum images per minute. Only present for relevant models. + + - `Optional maxRequestsPer1Day` + + The maximum requests per day. Only present for relevant models. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.ratelimits.RateLimitListRateLimitsPage; +import com.openai.models.admin.organization.projects.ratelimits.RateLimitListRateLimitsParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RateLimitListRateLimitsPage page = client.admin().organization().projects().rateLimits().listRateLimits("project_id"); + } +} +``` + +#### Response + +```json +{ + "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" +} +``` + +## Modify project rate limit + +`ProjectRateLimit admin().organization().projects().rateLimits().updateRateLimit(RateLimitUpdateRateLimitParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/organization/projects/{project_id}/rate_limits/{rate_limit_id}` + +Updates a project rate limit. + +### Parameters + +- `RateLimitUpdateRateLimitParams params` + + - `String projectId` + + - `Optional rateLimitId` + + - `Optional batch1DayMaxInputTokens` + + The maximum batch input tokens per day. Only relevant for certain models. + + - `Optional maxAudioMegabytesPer1Minute` + + The maximum audio megabytes per minute. Only relevant for certain models. + + - `Optional maxImagesPer1Minute` + + The maximum images per minute. Only relevant for certain models. + + - `Optional maxRequestsPer1Day` + + The maximum requests per day. Only relevant for certain models. + + - `Optional maxRequestsPer1Minute` + + The maximum requests per minute. + + - `Optional maxTokensPer1Minute` + + The maximum tokens per minute. + +### Returns + +- `class ProjectRateLimit:` + + Represents a project rate limit config. + + - `String id` + + The identifier, which can be referenced in API endpoints. + + - `long maxRequestsPer1Minute` + + The maximum requests per minute. + + - `long maxTokensPer1Minute` + + The maximum tokens per minute. + + - `String model` + + The model this rate limit applies to. + + - `JsonValue; object_ "project.rate_limit"constant` + + The object type, which is always `project.rate_limit` + + - `PROJECT_RATE_LIMIT("project.rate_limit")` + + - `Optional batch1DayMaxInputTokens` + + The maximum batch input tokens per day. Only present for relevant models. + + - `Optional maxAudioMegabytesPer1Minute` + + The maximum audio megabytes per minute. Only present for relevant models. + + - `Optional maxImagesPer1Minute` + + The maximum images per minute. Only present for relevant models. + + - `Optional maxRequestsPer1Day` + + The maximum requests per day. Only present for relevant models. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.ratelimits.ProjectRateLimit; +import com.openai.models.admin.organization.projects.ratelimits.RateLimitUpdateRateLimitParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RateLimitUpdateRateLimitParams params = RateLimitUpdateRateLimitParams.builder() + .projectId("project_id") + .rateLimitId("rate_limit_id") + .build(); + ProjectRateLimit projectRateLimit = client.admin().organization().projects().rateLimits().updateRateLimit(params); + } +} +``` + +#### Response + +```json +{ + "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 +} +``` + +## Domain Types + +### Project Rate Limit + +- `class ProjectRateLimit:` + + Represents a project rate limit config. + + - `String id` + + The identifier, which can be referenced in API endpoints. + + - `long maxRequestsPer1Minute` + + The maximum requests per minute. + + - `long maxTokensPer1Minute` + + The maximum tokens per minute. + + - `String model` + + The model this rate limit applies to. + + - `JsonValue; object_ "project.rate_limit"constant` + + The object type, which is always `project.rate_limit` + + - `PROJECT_RATE_LIMIT("project.rate_limit")` + + - `Optional batch1DayMaxInputTokens` + + The maximum batch input tokens per day. Only present for relevant models. + + - `Optional maxAudioMegabytesPer1Minute` + + The maximum audio megabytes per minute. Only present for relevant models. + + - `Optional maxImagesPer1Minute` + + The maximum images per minute. Only present for relevant models. + + - `Optional maxRequestsPer1Day` + + The maximum requests per day. Only present for relevant models. + +# Model Permissions + +## Retrieve project model permissions + +`ProjectModelPermissions admin().organization().projects().modelPermissions().retrieve(ModelPermissionRetrieveParamsparams = ModelPermissionRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/projects/{project_id}/model_permissions` + +Returns model permissions for a project. + +### Parameters + +- `ModelPermissionRetrieveParams params` + + - `Optional projectId` + +### Returns + +- `class ProjectModelPermissions:` + + Represents the model allowlist or denylist policy for a project. + + - `Mode mode` + + Whether the project uses an allowlist or a denylist. + + - `ALLOW_LIST("allow_list")` + + - `DENY_LIST("deny_list")` + + - `List modelIds` + + The model IDs included in the model permissions policy. + + - `JsonValue; object_ "project.model_permissions"constant` + + The object type, which is always `project.model_permissions`. + + - `PROJECT_MODEL_PERMISSIONS("project.model_permissions")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.modelpermissions.ModelPermissionRetrieveParams; +import com.openai.models.admin.organization.projects.modelpermissions.ProjectModelPermissions; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ProjectModelPermissions projectModelPermissions = client.admin().organization().projects().modelPermissions().retrieve("project_id"); + } +} +``` + +#### Response + +```json +{ + "mode": "allow_list", + "model_ids": [ + "string" + ], + "object": "project.model_permissions" +} +``` + +## Modify project model permissions + +`ProjectModelPermissions admin().organization().projects().modelPermissions().update(ModelPermissionUpdateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/organization/projects/{project_id}/model_permissions` + +Updates model permissions for a project. + +### Parameters + +- `ModelPermissionUpdateParams params` + + - `Optional projectId` + + - `Mode mode` + + The model permissions mode to apply. + + - `ALLOW_LIST("allow_list")` + + - `DENY_LIST("deny_list")` + + - `List modelIds` + + The model IDs included in this permissions policy. + +### Returns + +- `class ProjectModelPermissions:` + + Represents the model allowlist or denylist policy for a project. + + - `Mode mode` + + Whether the project uses an allowlist or a denylist. + + - `ALLOW_LIST("allow_list")` + + - `DENY_LIST("deny_list")` + + - `List modelIds` + + The model IDs included in the model permissions policy. + + - `JsonValue; object_ "project.model_permissions"constant` + + The object type, which is always `project.model_permissions`. + + - `PROJECT_MODEL_PERMISSIONS("project.model_permissions")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.modelpermissions.ModelPermissionUpdateParams; +import com.openai.models.admin.organization.projects.modelpermissions.ProjectModelPermissions; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ModelPermissionUpdateParams params = ModelPermissionUpdateParams.builder() + .projectId("project_id") + .mode(ModelPermissionUpdateParams.Mode.ALLOW_LIST) + .addModelId("string") + .build(); + ProjectModelPermissions projectModelPermissions = client.admin().organization().projects().modelPermissions().update(params); + } +} +``` + +#### Response + +```json +{ + "mode": "allow_list", + "model_ids": [ + "string" + ], + "object": "project.model_permissions" +} +``` + +## Delete project model permissions + +`ProjectModelPermissionsDeleted admin().organization().projects().modelPermissions().delete(ModelPermissionDeleteParamsparams = ModelPermissionDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**delete** `/organization/projects/{project_id}/model_permissions` + +Deletes model permissions for a project. + +### Parameters + +- `ModelPermissionDeleteParams params` + + - `Optional projectId` + +### Returns + +- `class ProjectModelPermissionsDeleted:` + + Confirmation payload returned after deleting project model permissions. + + - `boolean deleted` + + Whether the project model permissions were deleted. + + - `JsonValue; object_ "project.model_permissions.deleted"constant` + + The object type, which is always `project.model_permissions.deleted`. + + - `PROJECT_MODEL_PERMISSIONS_DELETED("project.model_permissions.deleted")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.modelpermissions.ModelPermissionDeleteParams; +import com.openai.models.admin.organization.projects.modelpermissions.ProjectModelPermissionsDeleted; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ProjectModelPermissionsDeleted projectModelPermissionsDeleted = client.admin().organization().projects().modelPermissions().delete("project_id"); + } +} +``` + +#### Response + +```json +{ + "deleted": true, + "object": "project.model_permissions.deleted" +} +``` + +## Domain Types + +### Project Model Permissions + +- `class ProjectModelPermissions:` + + Represents the model allowlist or denylist policy for a project. + + - `Mode mode` + + Whether the project uses an allowlist or a denylist. + + - `ALLOW_LIST("allow_list")` + + - `DENY_LIST("deny_list")` + + - `List modelIds` + + The model IDs included in the model permissions policy. + + - `JsonValue; object_ "project.model_permissions"constant` + + The object type, which is always `project.model_permissions`. + + - `PROJECT_MODEL_PERMISSIONS("project.model_permissions")` + +### Project Model Permissions Deleted + +- `class ProjectModelPermissionsDeleted:` + + Confirmation payload returned after deleting project model permissions. + + - `boolean deleted` + + Whether the project model permissions were deleted. + + - `JsonValue; object_ "project.model_permissions.deleted"constant` + + The object type, which is always `project.model_permissions.deleted`. + + - `PROJECT_MODEL_PERMISSIONS_DELETED("project.model_permissions.deleted")` + +# Hosted Tool Permissions + +## Retrieve project hosted tool permissions + +`ProjectHostedToolPermissions admin().organization().projects().hostedToolPermissions().retrieve(HostedToolPermissionRetrieveParamsparams = HostedToolPermissionRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/projects/{project_id}/hosted_tool_permissions` + +Returns hosted tool permissions for a project. + +### Parameters + +- `HostedToolPermissionRetrieveParams params` + + - `Optional projectId` + +### Returns + +- `class ProjectHostedToolPermissions:` + + Represents hosted tool permissions for a project. + + - `CodeInterpreter codeInterpreter` + + Permission state for a single hosted tool on a project. + + - `boolean enabled` + + Whether the hosted tool is enabled for the project. + + - `FileSearch fileSearch` + + Permission state for a single hosted tool on a project. + + - `boolean enabled` + + Whether the hosted tool is enabled for the project. + + - `ImageGeneration imageGeneration` + + Permission state for a single hosted tool on a project. + + - `boolean enabled` + + Whether the hosted tool is enabled for the project. + + - `Mcp mcp` + + Permission state for a single hosted tool on a project. + + - `boolean enabled` + + Whether the hosted tool is enabled for the project. + + - `WebSearch webSearch` + + Permission state for a single hosted tool on a project. + + - `boolean enabled` + + Whether the hosted tool is enabled for the project. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.hostedtoolpermissions.HostedToolPermissionRetrieveParams; +import com.openai.models.admin.organization.projects.hostedtoolpermissions.ProjectHostedToolPermissions; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ProjectHostedToolPermissions projectHostedToolPermissions = client.admin().organization().projects().hostedToolPermissions().retrieve("project_id"); + } +} +``` + +#### Response + +```json +{ + "code_interpreter": { + "enabled": true + }, + "file_search": { + "enabled": true + }, + "image_generation": { + "enabled": true + }, + "mcp": { + "enabled": true + }, + "web_search": { + "enabled": true + } +} +``` + +## Modify project hosted tool permissions + +`ProjectHostedToolPermissions admin().organization().projects().hostedToolPermissions().update(HostedToolPermissionUpdateParamsparams = HostedToolPermissionUpdateParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/organization/projects/{project_id}/hosted_tool_permissions` + +Updates hosted tool permissions for a project. + +### Parameters + +- `HostedToolPermissionUpdateParams params` + + - `Optional projectId` + + - `Optional codeInterpreter` + + The code interpreter permission update. + + - `boolean enabled` + + Whether to enable the hosted tool for the project. + + - `Optional fileSearch` + + The file search permission update. + + - `boolean enabled` + + Whether to enable the hosted tool for the project. + + - `Optional imageGeneration` + + The image generation permission update. + + - `boolean enabled` + + Whether to enable the hosted tool for the project. + + - `Optional mcp` + + The MCP permission update. + + - `boolean enabled` + + Whether to enable the hosted tool for the project. + + - `Optional webSearch` + + The web search permission update. + + - `boolean enabled` + + Whether to enable the hosted tool for the project. + +### Returns + +- `class ProjectHostedToolPermissions:` + + Represents hosted tool permissions for a project. + + - `CodeInterpreter codeInterpreter` + + Permission state for a single hosted tool on a project. + + - `boolean enabled` + + Whether the hosted tool is enabled for the project. + + - `FileSearch fileSearch` + + Permission state for a single hosted tool on a project. + + - `boolean enabled` + + Whether the hosted tool is enabled for the project. + + - `ImageGeneration imageGeneration` + + Permission state for a single hosted tool on a project. + + - `boolean enabled` + + Whether the hosted tool is enabled for the project. + + - `Mcp mcp` + + Permission state for a single hosted tool on a project. + + - `boolean enabled` + + Whether the hosted tool is enabled for the project. + + - `WebSearch webSearch` + + Permission state for a single hosted tool on a project. + + - `boolean enabled` + + Whether the hosted tool is enabled for the project. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.hostedtoolpermissions.HostedToolPermissionUpdateParams; +import com.openai.models.admin.organization.projects.hostedtoolpermissions.ProjectHostedToolPermissions; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ProjectHostedToolPermissions projectHostedToolPermissions = client.admin().organization().projects().hostedToolPermissions().update("project_id"); + } +} +``` + +#### Response + +```json +{ + "code_interpreter": { + "enabled": true + }, + "file_search": { + "enabled": true + }, + "image_generation": { + "enabled": true + }, + "mcp": { + "enabled": true + }, + "web_search": { + "enabled": true + } +} +``` + +## Domain Types + +### Project Hosted Tool Permissions + +- `class ProjectHostedToolPermissions:` + + Represents hosted tool permissions for a project. + + - `CodeInterpreter codeInterpreter` + + Permission state for a single hosted tool on a project. + + - `boolean enabled` + + Whether the hosted tool is enabled for the project. + + - `FileSearch fileSearch` + + Permission state for a single hosted tool on a project. + + - `boolean enabled` + + Whether the hosted tool is enabled for the project. + + - `ImageGeneration imageGeneration` + + Permission state for a single hosted tool on a project. + + - `boolean enabled` + + Whether the hosted tool is enabled for the project. + + - `Mcp mcp` + + Permission state for a single hosted tool on a project. + + - `boolean enabled` + + Whether the hosted tool is enabled for the project. + + - `WebSearch webSearch` + + Permission state for a single hosted tool on a project. + + - `boolean enabled` + + Whether the hosted tool is enabled for the project. + +# Groups + +## List project groups + +`GroupListPage admin().organization().projects().groups().list(GroupListParamsparams = GroupListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/projects/{project_id}/groups` + +Lists the groups that have access to a project. + +### Parameters + +- `GroupListParams params` + + - `Optional projectId` + + - `Optional after` + + Cursor for pagination. Provide the ID of the last group from the previous response to fetch the next page. + + - `Optional limit` + + A limit on the number of project groups to return. Defaults to 20. + + - `Optional order` + + Sort order for the returned groups. + + - `ASC("asc")` + + - `DESC("desc")` + +### Returns + +- `class ProjectGroup:` + + Details about a group's membership in a project. + + - `long createdAt` + + Unix timestamp (in seconds) when the group was granted project access. + + - `String groupId` + + Identifier of the group that has access to the project. + + - `String groupName` + + Display name of the group. + + - `GroupType groupType` + + The type of the group. + + - `GROUP("group")` + + - `TENANT_GROUP("tenant_group")` + + - `JsonValue; object_ "project.group"constant` + + Always `project.group`. + + - `PROJECT_GROUP("project.group")` + + - `String projectId` + + Identifier of the project. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.groups.GroupListPage; +import com.openai.models.admin.organization.projects.groups.GroupListParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + GroupListPage page = client.admin().organization().projects().groups().list("project_id"); + } +} +``` + +#### Response + +```json +{ + "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" +} +``` + +## Add project group + +`ProjectGroup admin().organization().projects().groups().create(GroupCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/organization/projects/{project_id}/groups` + +Grants a group access to a project. + +### Parameters + +- `GroupCreateParams params` + + - `Optional projectId` + + - `String groupId` + + Identifier of the group to add to the project. + + - `String role` + + Identifier of the project role to grant to the group. + +### Returns + +- `class ProjectGroup:` + + Details about a group's membership in a project. + + - `long createdAt` + + Unix timestamp (in seconds) when the group was granted project access. + + - `String groupId` + + Identifier of the group that has access to the project. + + - `String groupName` + + Display name of the group. + + - `GroupType groupType` + + The type of the group. + + - `GROUP("group")` + + - `TENANT_GROUP("tenant_group")` + + - `JsonValue; object_ "project.group"constant` + + Always `project.group`. + + - `PROJECT_GROUP("project.group")` + + - `String projectId` + + Identifier of the project. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.groups.GroupCreateParams; +import com.openai.models.admin.organization.projects.groups.ProjectGroup; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + GroupCreateParams params = GroupCreateParams.builder() + .projectId("project_id") + .groupId("group_id") + .role("role") + .build(); + ProjectGroup projectGroup = client.admin().organization().projects().groups().create(params); + } +} +``` + +#### Response + +```json +{ + "created_at": 0, + "group_id": "group_id", + "group_name": "group_name", + "group_type": "group", + "object": "project.group", + "project_id": "project_id" +} +``` + +## Retrieve project group + +`ProjectGroup admin().organization().projects().groups().retrieve(GroupRetrieveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/projects/{project_id}/groups/{group_id}` + +Retrieves a project's group. + +### Parameters + +- `GroupRetrieveParams params` + + - `String projectId` + + - `Optional groupId` + + - `Optional groupType` + + The type of group to retrieve. + + - `GROUP("group")` + + - `TENANT_GROUP("tenant_group")` + +### Returns + +- `class ProjectGroup:` + + Details about a group's membership in a project. + + - `long createdAt` + + Unix timestamp (in seconds) when the group was granted project access. + + - `String groupId` + + Identifier of the group that has access to the project. + + - `String groupName` + + Display name of the group. + + - `GroupType groupType` + + The type of the group. + + - `GROUP("group")` + + - `TENANT_GROUP("tenant_group")` + + - `JsonValue; object_ "project.group"constant` + + Always `project.group`. + + - `PROJECT_GROUP("project.group")` + + - `String projectId` + + Identifier of the project. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.groups.GroupRetrieveParams; +import com.openai.models.admin.organization.projects.groups.ProjectGroup; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + GroupRetrieveParams params = GroupRetrieveParams.builder() + .projectId("project_id") + .groupId("group_id") + .build(); + ProjectGroup projectGroup = client.admin().organization().projects().groups().retrieve(params); + } +} +``` + +#### Response + +```json +{ + "created_at": 0, + "group_id": "group_id", + "group_name": "group_name", + "group_type": "group", + "object": "project.group", + "project_id": "project_id" +} +``` + +## Remove project group + +`GroupDeleteResponse admin().organization().projects().groups().delete(GroupDeleteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**delete** `/organization/projects/{project_id}/groups/{group_id}` + +Revokes a group's access to a project. + +### Parameters + +- `GroupDeleteParams params` + + - `String projectId` + + - `Optional groupId` + +### Returns + +- `class GroupDeleteResponse:` + + Confirmation payload returned after removing a group from a project. + + - `boolean deleted` + + Whether the group membership in the project was removed. + + - `JsonValue; object_ "project.group.deleted"constant` + + Always `project.group.deleted`. + + - `PROJECT_GROUP_DELETED("project.group.deleted")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.groups.GroupDeleteParams; +import com.openai.models.admin.organization.projects.groups.GroupDeleteResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + GroupDeleteParams params = GroupDeleteParams.builder() + .projectId("project_id") + .groupId("group_id") + .build(); + GroupDeleteResponse group = client.admin().organization().projects().groups().delete(params); + } +} +``` + +#### Response + +```json +{ + "deleted": true, + "object": "project.group.deleted" +} +``` + +## Domain Types + +### Project Group + +- `class ProjectGroup:` + + Details about a group's membership in a project. + + - `long createdAt` + + Unix timestamp (in seconds) when the group was granted project access. + + - `String groupId` + + Identifier of the group that has access to the project. + + - `String groupName` + + Display name of the group. + + - `GroupType groupType` + + The type of the group. + + - `GROUP("group")` + + - `TENANT_GROUP("tenant_group")` + + - `JsonValue; object_ "project.group"constant` + + Always `project.group`. + + - `PROJECT_GROUP("project.group")` + + - `String projectId` + + Identifier of the project. + +# Roles + +## List project group role assignments + +`RoleListPage admin().organization().projects().groups().roles().list(RoleListParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/projects/{project_id}/groups/{group_id}/roles` + +Lists the project roles assigned to a group within a project. + +### Parameters + +- `RoleListParams params` + + - `String projectId` + + - `Optional groupId` + + - `Optional after` + + Cursor for pagination. Provide the value from the previous response's `next` field to continue listing project roles. + + - `Optional limit` + + A limit on the number of project role assignments to return. + + - `Optional order` + + Sort order for the returned project roles. + + - `ASC("asc")` + + - `DESC("desc")` + +### Returns + +- `class RoleListResponse:` + + Detailed information about a role assignment entry returned when listing assignments. + + - `String id` + + Identifier for the role. + + - `Optional> assignmentSources` + + Principals from which the role assignment is inherited, when available. + + - `String principalId` + + - `String principalType` + + - `Optional createdAt` + + When the role was created. + + - `Optional createdBy` + + Identifier of the actor who created the role. + + - `Optional createdByUserObj` + + User details for the actor that created the role, when available. + + - `Optional description` + + Description of the role. + + - `Optional metadata` + + Arbitrary metadata stored on the role. + + - `String name` + + Name of the role. + + - `List permissions` + + Permissions associated with the role. + + - `boolean predefinedRole` + + Whether the role is predefined by OpenAI. + + - `String resourceType` + + Resource type the role applies to. + + - `Optional updatedAt` + + When the role was last updated. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.groups.roles.RoleListPage; +import com.openai.models.admin.organization.projects.groups.roles.RoleListParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleListParams params = RoleListParams.builder() + .projectId("project_id") + .groupId("group_id") + .build(); + RoleListPage page = client.admin().organization().projects().groups().roles().list(params); + } +} +``` + +#### Response + +```json +{ + "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" +} +``` + +## Assign project role to group + +`RoleCreateResponse admin().organization().projects().groups().roles().create(RoleCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/projects/{project_id}/groups/{group_id}/roles` + +Assigns a project role to a group within a project. + +### Parameters + +- `RoleCreateParams params` + + - `String projectId` + + - `Optional groupId` + + - `String roleId` + + Identifier of the role to assign. + +### Returns + +- `class RoleCreateResponse:` + + Role assignment linking a group to a role. + + - `Group group` + + Summary information about a group returned in role assignment responses. + + - `String id` + + Identifier for the group. + + - `long createdAt` + + Unix timestamp (in seconds) when the group was created. + + - `String name` + + Display name of the group. + + - `JsonValue; object_ "group"constant` + + Always `group`. + + - `GROUP("group")` + + - `boolean scimManaged` + + Whether the group is managed through SCIM. + + - `JsonValue; object_ "group.role"constant` + + Always `group.role`. + + - `GROUP_ROLE("group.role")` + + - `Role role` + + Details about a role that can be assigned through the public Roles API. + + - `String id` + + Identifier for the role. + + - `Optional description` + + Optional description of the role. + + - `String name` + + Unique name for the role. + + - `JsonValue; object_ "role"constant` + + Always `role`. + + - `ROLE("role")` + + - `List permissions` + + Permissions granted by the role. + + - `boolean predefinedRole` + + Whether the role is predefined and managed by OpenAI. + + - `String resourceType` + + Resource type the role is bound to (for example `api.organization` or `api.project`). + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.groups.roles.RoleCreateParams; +import com.openai.models.admin.organization.projects.groups.roles.RoleCreateResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleCreateParams params = RoleCreateParams.builder() + .projectId("project_id") + .groupId("group_id") + .roleId("role_id") + .build(); + RoleCreateResponse role = client.admin().organization().projects().groups().roles().create(params); + } +} +``` + +#### Response + +```json +{ + "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" + } +} +``` + +## Retrieve project group role + +`RoleRetrieveResponse admin().organization().projects().groups().roles().retrieve(RoleRetrieveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/projects/{project_id}/groups/{group_id}/roles/{role_id}` + +Retrieves a project role assigned to a group. + +### Parameters + +- `RoleRetrieveParams params` + + - `String projectId` + + - `String groupId` + + - `Optional roleId` + +### Returns + +- `class RoleRetrieveResponse:` + + Detailed information about a role assignment entry returned when listing assignments. + + - `String id` + + Identifier for the role. + + - `Optional> assignmentSources` + + Principals from which the role assignment is inherited, when available. + + - `String principalId` + + - `String principalType` + + - `Optional createdAt` + + When the role was created. + + - `Optional createdBy` + + Identifier of the actor who created the role. + + - `Optional createdByUserObj` + + User details for the actor that created the role, when available. + + - `Optional description` + + Description of the role. + + - `Optional metadata` + + Arbitrary metadata stored on the role. + + - `String name` + + Name of the role. + + - `List permissions` + + Permissions associated with the role. + + - `boolean predefinedRole` + + Whether the role is predefined by OpenAI. + + - `String resourceType` + + Resource type the role applies to. + + - `Optional updatedAt` + + When the role was last updated. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.groups.roles.RoleRetrieveParams; +import com.openai.models.admin.organization.projects.groups.roles.RoleRetrieveResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleRetrieveParams params = RoleRetrieveParams.builder() + .projectId("project_id") + .groupId("group_id") + .roleId("role_id") + .build(); + RoleRetrieveResponse role = client.admin().organization().projects().groups().roles().retrieve(params); + } +} +``` + +#### Response + +```json +{ + "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 +} +``` + +## Unassign project role from group + +`RoleDeleteResponse admin().organization().projects().groups().roles().delete(RoleDeleteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**delete** `/projects/{project_id}/groups/{group_id}/roles/{role_id}` + +Unassigns a project role from a group within a project. + +### Parameters + +- `RoleDeleteParams params` + + - `String projectId` + + - `String groupId` + + - `Optional roleId` + +### Returns + +- `class RoleDeleteResponse:` + + Confirmation payload returned after unassigning a role. + + - `boolean deleted` + + Whether the assignment was removed. + + - `String object_` + + Identifier for the deleted assignment, such as `group.role.deleted` or `user.role.deleted`. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.groups.roles.RoleDeleteParams; +import com.openai.models.admin.organization.projects.groups.roles.RoleDeleteResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleDeleteParams params = RoleDeleteParams.builder() + .projectId("project_id") + .groupId("group_id") + .roleId("role_id") + .build(); + RoleDeleteResponse role = client.admin().organization().projects().groups().roles().delete(params); + } +} +``` + +#### Response + +```json +{ + "deleted": true, + "object": "object" +} +``` + +# Roles + +## List project roles + +`RoleListPage admin().organization().projects().roles().list(RoleListParamsparams = RoleListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/projects/{project_id}/roles` + +Lists the roles configured for a project. + +### Parameters + +- `RoleListParams params` + + - `Optional projectId` + + - `Optional after` + + Cursor for pagination. Provide the value from the previous response's `next` field to continue listing roles. + + - `Optional limit` + + A limit on the number of roles to return. Defaults to 1000. + + - `Optional order` + + Sort order for the returned roles. + + - `ASC("asc")` + + - `DESC("desc")` + +### Returns + +- `class Role:` + + Details about a role that can be assigned through the public Roles API. + + - `String id` + + Identifier for the role. + + - `Optional description` + + Optional description of the role. + + - `String name` + + Unique name for the role. + + - `JsonValue; object_ "role"constant` + + Always `role`. + + - `ROLE("role")` + + - `List permissions` + + Permissions granted by the role. + + - `boolean predefinedRole` + + Whether the role is predefined and managed by OpenAI. + + - `String resourceType` + + Resource type the role is bound to (for example `api.organization` or `api.project`). + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.roles.RoleListPage; +import com.openai.models.admin.organization.projects.roles.RoleListParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleListPage page = client.admin().organization().projects().roles().list("project_id"); + } +} +``` + +#### Response + +```json +{ + "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" +} +``` + +## Create project role + +`Role admin().organization().projects().roles().create(RoleCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/projects/{project_id}/roles` + +Creates a custom role for a project. + +### Parameters + +- `RoleCreateParams params` + + - `Optional projectId` + + - `List permissions` + + Permissions to grant to the role. + + - `String roleName` + + Unique name for the role. + + - `Optional description` + + Optional description of the role. + +### Returns + +- `class Role:` + + Details about a role that can be assigned through the public Roles API. + + - `String id` + + Identifier for the role. + + - `Optional description` + + Optional description of the role. + + - `String name` + + Unique name for the role. + + - `JsonValue; object_ "role"constant` + + Always `role`. + + - `ROLE("role")` + + - `List permissions` + + Permissions granted by the role. + + - `boolean predefinedRole` + + Whether the role is predefined and managed by OpenAI. + + - `String resourceType` + + Resource type the role is bound to (for example `api.organization` or `api.project`). + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.roles.RoleCreateParams; +import com.openai.models.admin.organization.roles.Role; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleCreateParams params = RoleCreateParams.builder() + .projectId("project_id") + .addPermission("string") + .roleName("role_name") + .build(); + Role role = client.admin().organization().projects().roles().create(params); + } +} +``` + +#### Response + +```json +{ + "id": "id", + "description": "description", + "name": "name", + "object": "role", + "permissions": [ + "string" + ], + "predefined_role": true, + "resource_type": "resource_type" +} +``` + +## Retrieve project role + +`Role admin().organization().projects().roles().retrieve(RoleRetrieveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/projects/{project_id}/roles/{role_id}` + +Retrieves a project role. + +### Parameters + +- `RoleRetrieveParams params` + + - `String projectId` + + - `Optional roleId` + +### Returns + +- `class Role:` + + Details about a role that can be assigned through the public Roles API. + + - `String id` + + Identifier for the role. + + - `Optional description` + + Optional description of the role. + + - `String name` + + Unique name for the role. + + - `JsonValue; object_ "role"constant` + + Always `role`. + + - `ROLE("role")` + + - `List permissions` + + Permissions granted by the role. + + - `boolean predefinedRole` + + Whether the role is predefined and managed by OpenAI. + + - `String resourceType` + + Resource type the role is bound to (for example `api.organization` or `api.project`). + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.roles.RoleRetrieveParams; +import com.openai.models.admin.organization.roles.Role; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleRetrieveParams params = RoleRetrieveParams.builder() + .projectId("project_id") + .roleId("role_id") + .build(); + Role role = client.admin().organization().projects().roles().retrieve(params); + } +} +``` + +#### Response + +```json +{ + "id": "id", + "description": "description", + "name": "name", + "object": "role", + "permissions": [ + "string" + ], + "predefined_role": true, + "resource_type": "resource_type" +} +``` + +## Update project role + +`Role admin().organization().projects().roles().update(RoleUpdateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/projects/{project_id}/roles/{role_id}` + +Updates an existing project role. + +### Parameters + +- `RoleUpdateParams params` + + - `String projectId` + + - `Optional roleId` + + - `Optional description` + + New description for the role. + + - `Optional> permissions` + + Updated set of permissions for the role. + + - `Optional roleName` + + New name for the role. + +### Returns + +- `class Role:` + + Details about a role that can be assigned through the public Roles API. + + - `String id` + + Identifier for the role. + + - `Optional description` + + Optional description of the role. + + - `String name` + + Unique name for the role. + + - `JsonValue; object_ "role"constant` + + Always `role`. + + - `ROLE("role")` + + - `List permissions` + + Permissions granted by the role. + + - `boolean predefinedRole` + + Whether the role is predefined and managed by OpenAI. + + - `String resourceType` + + Resource type the role is bound to (for example `api.organization` or `api.project`). + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.roles.RoleUpdateParams; +import com.openai.models.admin.organization.roles.Role; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleUpdateParams params = RoleUpdateParams.builder() + .projectId("project_id") + .roleId("role_id") + .build(); + Role role = client.admin().organization().projects().roles().update(params); + } +} +``` + +#### Response + +```json +{ + "id": "id", + "description": "description", + "name": "name", + "object": "role", + "permissions": [ + "string" + ], + "predefined_role": true, + "resource_type": "resource_type" +} +``` + +## Delete project role + +`RoleDeleteResponse admin().organization().projects().roles().delete(RoleDeleteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**delete** `/projects/{project_id}/roles/{role_id}` + +Deletes a custom role from a project. + +### Parameters + +- `RoleDeleteParams params` + + - `String projectId` + + - `Optional roleId` + +### Returns + +- `class RoleDeleteResponse:` + + Confirmation payload returned after deleting a role. + + - `String id` + + Identifier of the deleted role. + + - `boolean deleted` + + Whether the role was deleted. + + - `JsonValue; object_ "role.deleted"constant` + + Always `role.deleted`. + + - `ROLE_DELETED("role.deleted")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.roles.RoleDeleteParams; +import com.openai.models.admin.organization.projects.roles.RoleDeleteResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleDeleteParams params = RoleDeleteParams.builder() + .projectId("project_id") + .roleId("role_id") + .build(); + RoleDeleteResponse role = client.admin().organization().projects().roles().delete(params); + } +} +``` + +#### Response + +```json +{ + "id": "id", + "deleted": true, + "object": "role.deleted" +} +``` + +# Data Retention + +## Retrieve project data retention + +`ProjectDataRetention admin().organization().projects().dataRetention().retrieve(DataRetentionRetrieveParamsparams = DataRetentionRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/projects/{project_id}/data_retention` + +Retrieves project data retention controls. + +### Parameters + +- `DataRetentionRetrieveParams params` + + - `Optional projectId` + +### Returns + +- `class ProjectDataRetention:` + + Represents a project's data retention control setting. + + - `JsonValue; object_ "project.data_retention"constant` + + The object type, which is always `project.data_retention`. + + - `PROJECT_DATA_RETENTION("project.data_retention")` + + - `Type type` + + The configured project data retention type. + + - `ORGANIZATION_DEFAULT("organization_default")` + + - `NONE("none")` + + - `ZERO_DATA_RETENTION("zero_data_retention")` + + - `MODIFIED_ABUSE_MONITORING("modified_abuse_monitoring")` + + - `ENHANCED_ZERO_DATA_RETENTION("enhanced_zero_data_retention")` + + - `ENHANCED_MODIFIED_ABUSE_MONITORING("enhanced_modified_abuse_monitoring")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.dataretention.DataRetentionRetrieveParams; +import com.openai.models.admin.organization.projects.dataretention.ProjectDataRetention; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ProjectDataRetention projectDataRetention = client.admin().organization().projects().dataRetention().retrieve("project_id"); + } +} +``` + +#### Response + +```json +{ + "object": "project.data_retention", + "type": "organization_default" +} +``` + +## Update project data retention + +`ProjectDataRetention admin().organization().projects().dataRetention().update(DataRetentionUpdateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/organization/projects/{project_id}/data_retention` + +Updates project data retention controls. + +### Parameters + +- `DataRetentionUpdateParams params` + + - `Optional projectId` + + - `RetentionType retentionType` + + The desired project data retention type. + + - `ORGANIZATION_DEFAULT("organization_default")` + + - `NONE("none")` + + - `ZERO_DATA_RETENTION("zero_data_retention")` + + - `MODIFIED_ABUSE_MONITORING("modified_abuse_monitoring")` + + - `ENHANCED_ZERO_DATA_RETENTION("enhanced_zero_data_retention")` + + - `ENHANCED_MODIFIED_ABUSE_MONITORING("enhanced_modified_abuse_monitoring")` + +### Returns + +- `class ProjectDataRetention:` + + Represents a project's data retention control setting. + + - `JsonValue; object_ "project.data_retention"constant` + + The object type, which is always `project.data_retention`. + + - `PROJECT_DATA_RETENTION("project.data_retention")` + + - `Type type` + + The configured project data retention type. + + - `ORGANIZATION_DEFAULT("organization_default")` + + - `NONE("none")` + + - `ZERO_DATA_RETENTION("zero_data_retention")` + + - `MODIFIED_ABUSE_MONITORING("modified_abuse_monitoring")` + + - `ENHANCED_ZERO_DATA_RETENTION("enhanced_zero_data_retention")` + + - `ENHANCED_MODIFIED_ABUSE_MONITORING("enhanced_modified_abuse_monitoring")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.dataretention.DataRetentionUpdateParams; +import com.openai.models.admin.organization.projects.dataretention.ProjectDataRetention; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + DataRetentionUpdateParams params = DataRetentionUpdateParams.builder() + .projectId("project_id") + .retentionType(DataRetentionUpdateParams.RetentionType.ORGANIZATION_DEFAULT) + .build(); + ProjectDataRetention projectDataRetention = client.admin().organization().projects().dataRetention().update(params); + } +} +``` + +#### Response + +```json +{ + "object": "project.data_retention", + "type": "organization_default" +} +``` + +## Domain Types + +### Project Data Retention + +- `class ProjectDataRetention:` + + Represents a project's data retention control setting. + + - `JsonValue; object_ "project.data_retention"constant` + + The object type, which is always `project.data_retention`. + + - `PROJECT_DATA_RETENTION("project.data_retention")` + + - `Type type` + + The configured project data retention type. + + - `ORGANIZATION_DEFAULT("organization_default")` + + - `NONE("none")` + + - `ZERO_DATA_RETENTION("zero_data_retention")` + + - `MODIFIED_ABUSE_MONITORING("modified_abuse_monitoring")` + + - `ENHANCED_ZERO_DATA_RETENTION("enhanced_zero_data_retention")` + + - `ENHANCED_MODIFIED_ABUSE_MONITORING("enhanced_modified_abuse_monitoring")` + +# Spend Alerts + +## List project spend alerts + +`SpendAlertListPage admin().organization().projects().spendAlerts().list(SpendAlertListParamsparams = SpendAlertListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/projects/{project_id}/spend_alerts` + +Lists project spend alerts. + +### Parameters + +- `SpendAlertListParams params` + + - `Optional projectId` + + - `Optional after` + + Cursor for pagination. Provide the ID of the last spend alert from the previous response to fetch the next page. + + - `Optional before` + + Cursor for pagination. Provide the ID of the first spend alert from the previous response to fetch the previous page. + + - `Optional limit` + + A limit on the number of spend alerts to return. Defaults to 20. + + - `Optional order` + + Sort order for the returned spend alerts. + + - `ASC("asc")` + + - `DESC("desc")` + +### Returns + +- `class ProjectSpendAlert:` + + Represents a spend alert configured at the project level. + + - `String id` + + The identifier, which can be referenced in API endpoints. + + - `Currency currency` + + The currency for the threshold amount. + + - `USD("USD")` + + - `Interval interval` + + The time interval for evaluating spend against the threshold. + + - `MONTH("month")` + + - `NotificationChannel notificationChannel` + + Email notification settings for a spend alert. + + - `List recipients` + + Email addresses that receive the spend alert notification. + + - `JsonValue; type "email"constant` + + The notification channel type. Currently only `email` is supported. + + - `EMAIL("email")` + + - `Optional subjectPrefix` + + Optional subject prefix for alert emails. + + - `JsonValue; object_ "project.spend_alert"constant` + + The object type, which is always `project.spend_alert`. + + - `PROJECT_SPEND_ALERT("project.spend_alert")` + + - `long thresholdAmount` + + The alert threshold amount, in cents. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.spendalerts.SpendAlertListPage; +import com.openai.models.admin.organization.projects.spendalerts.SpendAlertListParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + SpendAlertListPage page = client.admin().organization().projects().spendAlerts().list("project_id"); + } +} +``` + +#### Response + +```json +{ + "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" +} +``` + +## Create project spend alert + +`ProjectSpendAlert admin().organization().projects().spendAlerts().create(SpendAlertCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/organization/projects/{project_id}/spend_alerts` + +Creates a project spend alert. + +### Parameters + +- `SpendAlertCreateParams params` + + - `Optional projectId` + + - `Currency currency` + + The currency for the threshold amount. + + - `USD("USD")` + + - `Interval interval` + + The time interval for evaluating spend against the threshold. + + - `MONTH("month")` + + - `NotificationChannel notificationChannel` + + Email notification settings for a spend alert. + + - `List recipients` + + Email addresses that receive the spend alert notification. + + - `JsonValue; type "email"constant` + + The notification channel type. Currently only `email` is supported. + + - `EMAIL("email")` + + - `Optional subjectPrefix` + + Optional subject prefix for alert emails. + + - `long thresholdAmount` + + The alert threshold amount, in cents. + +### Returns + +- `class ProjectSpendAlert:` + + Represents a spend alert configured at the project level. + + - `String id` + + The identifier, which can be referenced in API endpoints. + + - `Currency currency` + + The currency for the threshold amount. + + - `USD("USD")` + + - `Interval interval` + + The time interval for evaluating spend against the threshold. + + - `MONTH("month")` + + - `NotificationChannel notificationChannel` + + Email notification settings for a spend alert. + + - `List recipients` + + Email addresses that receive the spend alert notification. + + - `JsonValue; type "email"constant` + + The notification channel type. Currently only `email` is supported. + + - `EMAIL("email")` + + - `Optional subjectPrefix` + + Optional subject prefix for alert emails. + + - `JsonValue; object_ "project.spend_alert"constant` + + The object type, which is always `project.spend_alert`. + + - `PROJECT_SPEND_ALERT("project.spend_alert")` + + - `long thresholdAmount` + + The alert threshold amount, in cents. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.spendalerts.ProjectSpendAlert; +import com.openai.models.admin.organization.projects.spendalerts.SpendAlertCreateParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + SpendAlertCreateParams params = SpendAlertCreateParams.builder() + .projectId("project_id") + .currency(SpendAlertCreateParams.Currency.USD) + .interval(SpendAlertCreateParams.Interval.MONTH) + .notificationChannel(SpendAlertCreateParams.NotificationChannel.builder() + .addRecipient("string") + .build()) + .thresholdAmount(0L) + .build(); + ProjectSpendAlert projectSpendAlert = client.admin().organization().projects().spendAlerts().create(params); + } +} +``` + +#### Response + +```json +{ + "id": "id", + "currency": "USD", + "interval": "month", + "notification_channel": { + "recipients": [ + "string" + ], + "type": "email", + "subject_prefix": "subject_prefix" + }, + "object": "project.spend_alert", + "threshold_amount": 0 +} +``` + +## Update project spend alert + +`ProjectSpendAlert admin().organization().projects().spendAlerts().update(SpendAlertUpdateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/organization/projects/{project_id}/spend_alerts/{alert_id}` + +Updates a project spend alert. + +### Parameters + +- `SpendAlertUpdateParams params` + + - `String projectId` + + - `Optional alertId` + + - `Currency currency` + + The currency for the threshold amount. + + - `USD("USD")` + + - `Interval interval` + + The time interval for evaluating spend against the threshold. + + - `MONTH("month")` + + - `NotificationChannel notificationChannel` + + Email notification settings for a spend alert. + + - `List recipients` + + Email addresses that receive the spend alert notification. + + - `JsonValue; type "email"constant` + + The notification channel type. Currently only `email` is supported. + + - `EMAIL("email")` + + - `Optional subjectPrefix` + + Optional subject prefix for alert emails. + + - `long thresholdAmount` + + The alert threshold amount, in cents. + +### Returns + +- `class ProjectSpendAlert:` + + Represents a spend alert configured at the project level. + + - `String id` + + The identifier, which can be referenced in API endpoints. + + - `Currency currency` + + The currency for the threshold amount. + + - `USD("USD")` + + - `Interval interval` + + The time interval for evaluating spend against the threshold. + + - `MONTH("month")` + + - `NotificationChannel notificationChannel` + + Email notification settings for a spend alert. + + - `List recipients` + + Email addresses that receive the spend alert notification. + + - `JsonValue; type "email"constant` + + The notification channel type. Currently only `email` is supported. + + - `EMAIL("email")` + + - `Optional subjectPrefix` + + Optional subject prefix for alert emails. + + - `JsonValue; object_ "project.spend_alert"constant` + + The object type, which is always `project.spend_alert`. + + - `PROJECT_SPEND_ALERT("project.spend_alert")` + + - `long thresholdAmount` + + The alert threshold amount, in cents. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.spendalerts.ProjectSpendAlert; +import com.openai.models.admin.organization.projects.spendalerts.SpendAlertUpdateParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + SpendAlertUpdateParams params = SpendAlertUpdateParams.builder() + .projectId("project_id") + .alertId("alert_id") + .currency(SpendAlertUpdateParams.Currency.USD) + .interval(SpendAlertUpdateParams.Interval.MONTH) + .notificationChannel(SpendAlertUpdateParams.NotificationChannel.builder() + .addRecipient("string") + .build()) + .thresholdAmount(0L) + .build(); + ProjectSpendAlert projectSpendAlert = client.admin().organization().projects().spendAlerts().update(params); + } +} +``` + +#### Response + +```json +{ + "id": "id", + "currency": "USD", + "interval": "month", + "notification_channel": { + "recipients": [ + "string" + ], + "type": "email", + "subject_prefix": "subject_prefix" + }, + "object": "project.spend_alert", + "threshold_amount": 0 +} +``` + +## Delete project spend alert + +`ProjectSpendAlertDeleted admin().organization().projects().spendAlerts().delete(SpendAlertDeleteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**delete** `/organization/projects/{project_id}/spend_alerts/{alert_id}` + +Deletes a project spend alert. + +### Parameters + +- `SpendAlertDeleteParams params` + + - `String projectId` + + - `Optional alertId` + +### Returns + +- `class ProjectSpendAlertDeleted:` + + Confirmation payload returned after deleting a project spend alert. + + - `String id` + + The deleted spend alert ID. + + - `boolean deleted` + + Whether the spend alert was deleted. + + - `JsonValue; object_ "project.spend_alert.deleted"constant` + + Always `project.spend_alert.deleted`. + + - `PROJECT_SPEND_ALERT_DELETED("project.spend_alert.deleted")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.spendalerts.ProjectSpendAlertDeleted; +import com.openai.models.admin.organization.projects.spendalerts.SpendAlertDeleteParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + SpendAlertDeleteParams params = SpendAlertDeleteParams.builder() + .projectId("project_id") + .alertId("alert_id") + .build(); + ProjectSpendAlertDeleted projectSpendAlertDeleted = client.admin().organization().projects().spendAlerts().delete(params); + } +} +``` + +#### Response + +```json +{ + "id": "id", + "deleted": true, + "object": "project.spend_alert.deleted" +} +``` + +## Domain Types + +### Project Spend Alert + +- `class ProjectSpendAlert:` + + Represents a spend alert configured at the project level. + + - `String id` + + The identifier, which can be referenced in API endpoints. + + - `Currency currency` + + The currency for the threshold amount. + + - `USD("USD")` + + - `Interval interval` + + The time interval for evaluating spend against the threshold. + + - `MONTH("month")` + + - `NotificationChannel notificationChannel` + + Email notification settings for a spend alert. + + - `List recipients` + + Email addresses that receive the spend alert notification. + + - `JsonValue; type "email"constant` + + The notification channel type. Currently only `email` is supported. + + - `EMAIL("email")` + + - `Optional subjectPrefix` + + Optional subject prefix for alert emails. + + - `JsonValue; object_ "project.spend_alert"constant` + + The object type, which is always `project.spend_alert`. + + - `PROJECT_SPEND_ALERT("project.spend_alert")` + + - `long thresholdAmount` + + The alert threshold amount, in cents. + +### Project Spend Alert Deleted + +- `class ProjectSpendAlertDeleted:` + + Confirmation payload returned after deleting a project spend alert. + + - `String id` + + The deleted spend alert ID. + + - `boolean deleted` + + Whether the spend alert was deleted. + + - `JsonValue; object_ "project.spend_alert.deleted"constant` + + Always `project.spend_alert.deleted`. + + - `PROJECT_SPEND_ALERT_DELETED("project.spend_alert.deleted")` + +# Certificates + +## List project certificates + +`CertificateListPage admin().organization().projects().certificates().list(CertificateListParamsparams = CertificateListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/organization/projects/{project_id}/certificates` + +List certificates for this project. + +### Parameters + +- `CertificateListParams params` + + - `Optional projectId` + + - `Optional after` + + A cursor for use in pagination. `after` is 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. + + - `Optional limit` + + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + + - `Optional order` + + Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. + + - `ASC("asc")` + + - `DESC("desc")` + +### Returns + +- `class CertificateListResponse:` + + Represents an individual certificate configured at the project level. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `boolean active` + + Whether the certificate is currently active at the project level. + + - `CertificateDetails certificateDetails` + + - `Optional expiresAt` + + The Unix timestamp (in seconds) of when the certificate expires. + + - `Optional validAt` + + The Unix timestamp (in seconds) of when the certificate becomes valid. + + - `long createdAt` + + The Unix timestamp (in seconds) of when the certificate was uploaded. + + - `Optional name` + + The name of the certificate. + + - `JsonValue; object_ "organization.project.certificate"constant` + + The object type, which is always `organization.project.certificate`. + + - `ORGANIZATION_PROJECT_CERTIFICATE("organization.project.certificate")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.certificates.CertificateListPage; +import com.openai.models.admin.organization.projects.certificates.CertificateListParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + CertificateListPage page = client.admin().organization().projects().certificates().list("project_id"); + } +} +``` + +#### Response + +```json +{ + "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" +} +``` + +## Activate certificates for project + +`CertificateActivatePage admin().organization().projects().certificates().activate(CertificateActivateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/organization/projects/{project_id}/certificates/activate` + +Activate certificates at the project level. + +You can atomically and idempotently activate up to 10 certificates at a time. + +### Parameters + +- `CertificateActivateParams params` + + - `Optional projectId` + + - `List certificateIds` + +### Returns + +- `class CertificateActivateResponse:` + + Represents an individual certificate configured at the project level. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `boolean active` + + Whether the certificate is currently active at the project level. + + - `CertificateDetails certificateDetails` + + - `Optional expiresAt` + + The Unix timestamp (in seconds) of when the certificate expires. + + - `Optional validAt` + + The Unix timestamp (in seconds) of when the certificate becomes valid. + + - `long createdAt` + + The Unix timestamp (in seconds) of when the certificate was uploaded. + + - `Optional name` + + The name of the certificate. + + - `JsonValue; object_ "organization.project.certificate"constant` + + The object type, which is always `organization.project.certificate`. + + - `ORGANIZATION_PROJECT_CERTIFICATE("organization.project.certificate")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.certificates.CertificateActivatePage; +import com.openai.models.admin.organization.projects.certificates.CertificateActivateParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + CertificateActivateParams params = CertificateActivateParams.builder() + .projectId("project_id") + .addCertificateId("cert_abc") + .build(); + CertificateActivatePage page = client.admin().organization().projects().certificates().activate(params); + } +} +``` + +#### Response + +```json +{ + "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" +} +``` + +## Deactivate certificates for project + +`CertificateDeactivatePage admin().organization().projects().certificates().deactivate(CertificateDeactivateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/organization/projects/{project_id}/certificates/deactivate` + +Deactivate certificates at the project level. You can atomically and +idempotently deactivate up to 10 certificates at a time. + +### Parameters + +- `CertificateDeactivateParams params` + + - `Optional projectId` + + - `List certificateIds` + +### Returns + +- `class CertificateDeactivateResponse:` + + Represents an individual certificate configured at the project level. + + - `String id` + + The identifier, which can be referenced in API endpoints + + - `boolean active` + + Whether the certificate is currently active at the project level. + + - `CertificateDetails certificateDetails` + + - `Optional expiresAt` + + The Unix timestamp (in seconds) of when the certificate expires. + + - `Optional validAt` + + The Unix timestamp (in seconds) of when the certificate becomes valid. + + - `long createdAt` + + The Unix timestamp (in seconds) of when the certificate was uploaded. + + - `Optional name` + + The name of the certificate. + + - `JsonValue; object_ "organization.project.certificate"constant` + + The object type, which is always `organization.project.certificate`. + + - `ORGANIZATION_PROJECT_CERTIFICATE("organization.project.certificate")` + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.admin.organization.projects.certificates.CertificateDeactivatePage; +import com.openai.models.admin.organization.projects.certificates.CertificateDeactivateParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + CertificateDeactivateParams params = CertificateDeactivateParams.builder() + .projectId("project_id") + .addCertificateId("cert_abc") + .build(); + CertificateDeactivatePage page = client.admin().organization().projects().certificates().deactivate(params); + } +} +``` + +#### Response + +```json +{ + "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" +} +```