Admin
Organization
Audit Logs
List audit logs
client.Admin.Organization.AuditLogs.List(ctx, query) (*ConversationCursorPage[AdminOrganizationAuditLogListResponse], error)
get /organization/audit_logs
List user actions and configuration changes within this organization.
Parameters
-
query AdminOrganizationAuditLogListParams-
ActorEmails param.Field[[]string]Return only events performed by users with these emails.
-
ActorIDs param.Field[[]string]Return only events performed by these actors. Can be a user ID, a service account ID, or an api key tracking ID.
-
After param.Field[string]A cursor for use in pagination.
afteris an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. -
Before param.Field[string]A cursor for use in pagination.
beforeis an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. -
EffectiveAt param.Field[AdminOrganizationAuditLogListParamsEffectiveAt]Return only events whose
effective_at(Unix seconds) is in this range.-
Gt int64Return only events whose
effective_at(Unix seconds) is greater than this value. -
Gte int64Return only events whose
effective_at(Unix seconds) is greater than or equal to this value. -
Lt int64Return only events whose
effective_at(Unix seconds) is less than this value. -
Lte int64Return only events whose
effective_at(Unix seconds) is less than or equal to this value.
-
-
EventTypes param.Field[[]string]Return only events with a
typein one of these values. For example,project.created. For all options, see the documentation for the audit log object.-
const AdminOrganizationAuditLogListParamsEventTypeAPIKeyCreated AdminOrganizationAuditLogListParamsEventType = "api_key.created" -
const AdminOrganizationAuditLogListParamsEventTypeAPIKeyUpdated AdminOrganizationAuditLogListParamsEventType = "api_key.updated" -
const AdminOrganizationAuditLogListParamsEventTypeAPIKeyDeleted AdminOrganizationAuditLogListParamsEventType = "api_key.deleted" -
const AdminOrganizationAuditLogListParamsEventTypeCertificateCreated AdminOrganizationAuditLogListParamsEventType = "certificate.created" -
const AdminOrganizationAuditLogListParamsEventTypeCertificateUpdated AdminOrganizationAuditLogListParamsEventType = "certificate.updated" -
const AdminOrganizationAuditLogListParamsEventTypeCertificateDeleted AdminOrganizationAuditLogListParamsEventType = "certificate.deleted" -
const AdminOrganizationAuditLogListParamsEventTypeCertificatesActivated AdminOrganizationAuditLogListParamsEventType = "certificates.activated" -
const AdminOrganizationAuditLogListParamsEventTypeCertificatesDeactivated AdminOrganizationAuditLogListParamsEventType = "certificates.deactivated" -
const AdminOrganizationAuditLogListParamsEventTypeCheckpointPermissionCreated AdminOrganizationAuditLogListParamsEventType = "checkpoint.permission.created" -
const AdminOrganizationAuditLogListParamsEventTypeCheckpointPermissionDeleted AdminOrganizationAuditLogListParamsEventType = "checkpoint.permission.deleted" -
const AdminOrganizationAuditLogListParamsEventTypeExternalKeyRegistered AdminOrganizationAuditLogListParamsEventType = "external_key.registered" -
const AdminOrganizationAuditLogListParamsEventTypeExternalKeyRemoved AdminOrganizationAuditLogListParamsEventType = "external_key.removed" -
const AdminOrganizationAuditLogListParamsEventTypeGroupCreated AdminOrganizationAuditLogListParamsEventType = "group.created" -
const AdminOrganizationAuditLogListParamsEventTypeGroupUpdated AdminOrganizationAuditLogListParamsEventType = "group.updated" -
const AdminOrganizationAuditLogListParamsEventTypeGroupDeleted AdminOrganizationAuditLogListParamsEventType = "group.deleted" -
const AdminOrganizationAuditLogListParamsEventTypeInviteSent AdminOrganizationAuditLogListParamsEventType = "invite.sent" -
const AdminOrganizationAuditLogListParamsEventTypeInviteAccepted AdminOrganizationAuditLogListParamsEventType = "invite.accepted" -
const AdminOrganizationAuditLogListParamsEventTypeInviteDeleted AdminOrganizationAuditLogListParamsEventType = "invite.deleted" -
const AdminOrganizationAuditLogListParamsEventTypeIPAllowlistCreated AdminOrganizationAuditLogListParamsEventType = "ip_allowlist.created" -
const AdminOrganizationAuditLogListParamsEventTypeIPAllowlistUpdated AdminOrganizationAuditLogListParamsEventType = "ip_allowlist.updated" -
const AdminOrganizationAuditLogListParamsEventTypeIPAllowlistDeleted AdminOrganizationAuditLogListParamsEventType = "ip_allowlist.deleted" -
const AdminOrganizationAuditLogListParamsEventTypeIPAllowlistConfigActivated AdminOrganizationAuditLogListParamsEventType = "ip_allowlist.config.activated" -
const AdminOrganizationAuditLogListParamsEventTypeIPAllowlistConfigDeactivated AdminOrganizationAuditLogListParamsEventType = "ip_allowlist.config.deactivated" -
const AdminOrganizationAuditLogListParamsEventTypeLoginSucceeded AdminOrganizationAuditLogListParamsEventType = "login.succeeded" -
const AdminOrganizationAuditLogListParamsEventTypeLoginFailed AdminOrganizationAuditLogListParamsEventType = "login.failed" -
const AdminOrganizationAuditLogListParamsEventTypeLogoutSucceeded AdminOrganizationAuditLogListParamsEventType = "logout.succeeded" -
const AdminOrganizationAuditLogListParamsEventTypeLogoutFailed AdminOrganizationAuditLogListParamsEventType = "logout.failed" -
const AdminOrganizationAuditLogListParamsEventTypeOrganizationUpdated AdminOrganizationAuditLogListParamsEventType = "organization.updated" -
const AdminOrganizationAuditLogListParamsEventTypeProjectCreated AdminOrganizationAuditLogListParamsEventType = "project.created" -
const AdminOrganizationAuditLogListParamsEventTypeProjectUpdated AdminOrganizationAuditLogListParamsEventType = "project.updated" -
const AdminOrganizationAuditLogListParamsEventTypeProjectArchived AdminOrganizationAuditLogListParamsEventType = "project.archived" -
const AdminOrganizationAuditLogListParamsEventTypeProjectDeleted AdminOrganizationAuditLogListParamsEventType = "project.deleted" -
const AdminOrganizationAuditLogListParamsEventTypeRateLimitUpdated AdminOrganizationAuditLogListParamsEventType = "rate_limit.updated" -
const AdminOrganizationAuditLogListParamsEventTypeRateLimitDeleted AdminOrganizationAuditLogListParamsEventType = "rate_limit.deleted" -
const AdminOrganizationAuditLogListParamsEventTypeResourceDeleted AdminOrganizationAuditLogListParamsEventType = "resource.deleted" -
const AdminOrganizationAuditLogListParamsEventTypeTunnelCreated AdminOrganizationAuditLogListParamsEventType = "tunnel.created" -
const AdminOrganizationAuditLogListParamsEventTypeTunnelUpdated AdminOrganizationAuditLogListParamsEventType = "tunnel.updated" -
const AdminOrganizationAuditLogListParamsEventTypeTunnelDeleted AdminOrganizationAuditLogListParamsEventType = "tunnel.deleted" -
const AdminOrganizationAuditLogListParamsEventTypeWorkloadIdentityProviderCreated AdminOrganizationAuditLogListParamsEventType = "workload_identity_provider.created" -
const AdminOrganizationAuditLogListParamsEventTypeWorkloadIdentityProviderUpdated AdminOrganizationAuditLogListParamsEventType = "workload_identity_provider.updated" -
const AdminOrganizationAuditLogListParamsEventTypeWorkloadIdentityProviderDeleted AdminOrganizationAuditLogListParamsEventType = "workload_identity_provider.deleted" -
const AdminOrganizationAuditLogListParamsEventTypeWorkloadIdentityProviderMappingCreated AdminOrganizationAuditLogListParamsEventType = "workload_identity_provider_mapping.created" -
const AdminOrganizationAuditLogListParamsEventTypeWorkloadIdentityProviderMappingUpdated AdminOrganizationAuditLogListParamsEventType = "workload_identity_provider_mapping.updated" -
const AdminOrganizationAuditLogListParamsEventTypeWorkloadIdentityProviderMappingDeleted AdminOrganizationAuditLogListParamsEventType = "workload_identity_provider_mapping.deleted" -
const AdminOrganizationAuditLogListParamsEventTypeRoleCreated AdminOrganizationAuditLogListParamsEventType = "role.created" -
const AdminOrganizationAuditLogListParamsEventTypeRoleUpdated AdminOrganizationAuditLogListParamsEventType = "role.updated" -
const AdminOrganizationAuditLogListParamsEventTypeRoleDeleted AdminOrganizationAuditLogListParamsEventType = "role.deleted" -
const AdminOrganizationAuditLogListParamsEventTypeRoleAssignmentCreated AdminOrganizationAuditLogListParamsEventType = "role.assignment.created" -
const AdminOrganizationAuditLogListParamsEventTypeRoleAssignmentDeleted AdminOrganizationAuditLogListParamsEventType = "role.assignment.deleted" -
const AdminOrganizationAuditLogListParamsEventTypeRoleBoundToResource AdminOrganizationAuditLogListParamsEventType = "role.bound_to_resource" -
const AdminOrganizationAuditLogListParamsEventTypeRoleUnboundFromResource AdminOrganizationAuditLogListParamsEventType = "role.unbound_from_resource" -
const AdminOrganizationAuditLogListParamsEventTypeScimEnabled AdminOrganizationAuditLogListParamsEventType = "scim.enabled" -
const AdminOrganizationAuditLogListParamsEventTypeScimDisabled AdminOrganizationAuditLogListParamsEventType = "scim.disabled" -
const AdminOrganizationAuditLogListParamsEventTypeServiceAccountCreated AdminOrganizationAuditLogListParamsEventType = "service_account.created" -
const AdminOrganizationAuditLogListParamsEventTypeServiceAccountUpdated AdminOrganizationAuditLogListParamsEventType = "service_account.updated" -
const AdminOrganizationAuditLogListParamsEventTypeServiceAccountDeleted AdminOrganizationAuditLogListParamsEventType = "service_account.deleted" -
const AdminOrganizationAuditLogListParamsEventTypeUserAdded AdminOrganizationAuditLogListParamsEventType = "user.added" -
const AdminOrganizationAuditLogListParamsEventTypeUserUpdated AdminOrganizationAuditLogListParamsEventType = "user.updated" -
const AdminOrganizationAuditLogListParamsEventTypeUserDeleted AdminOrganizationAuditLogListParamsEventType = "user.deleted"
-
-
Limit param.Field[int64]A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
-
ProjectIDs param.Field[[]string]Return only events for these projects.
-
ResourceIDs param.Field[[]string]Return only events performed on these targets. For example, a project ID updated. For ChatGPT connector role events, use the workspace connector resource ID shown in
details.id, such as<workspace_id>__<connector_id>. -
TenantOnly param.Field[bool]Return only tenant-scoped events associated with this organization. Required for tenant-scoped events such as
role.bound_to_resourceandrole.unbound_from_resource. Whentrue, all supplied event types must be tenant-scoped.
-
Returns
-
type AdminOrganizationAuditLogListResponse struct{…}A log of a user action or configuration change within this organization.
-
ID stringThe ID of this log.
-
EffectiveAt int64The Unix timestamp (in seconds) of the event.
-
Type AdminOrganizationAuditLogListResponseTypeThe event type.
-
const AdminOrganizationAuditLogListResponseTypeAPIKeyCreated AdminOrganizationAuditLogListResponseType = "api_key.created" -
const AdminOrganizationAuditLogListResponseTypeAPIKeyUpdated AdminOrganizationAuditLogListResponseType = "api_key.updated" -
const AdminOrganizationAuditLogListResponseTypeAPIKeyDeleted AdminOrganizationAuditLogListResponseType = "api_key.deleted" -
const AdminOrganizationAuditLogListResponseTypeCertificateCreated AdminOrganizationAuditLogListResponseType = "certificate.created" -
const AdminOrganizationAuditLogListResponseTypeCertificateUpdated AdminOrganizationAuditLogListResponseType = "certificate.updated" -
const AdminOrganizationAuditLogListResponseTypeCertificateDeleted AdminOrganizationAuditLogListResponseType = "certificate.deleted" -
const AdminOrganizationAuditLogListResponseTypeCertificatesActivated AdminOrganizationAuditLogListResponseType = "certificates.activated" -
const AdminOrganizationAuditLogListResponseTypeCertificatesDeactivated AdminOrganizationAuditLogListResponseType = "certificates.deactivated" -
const AdminOrganizationAuditLogListResponseTypeCheckpointPermissionCreated AdminOrganizationAuditLogListResponseType = "checkpoint.permission.created" -
const AdminOrganizationAuditLogListResponseTypeCheckpointPermissionDeleted AdminOrganizationAuditLogListResponseType = "checkpoint.permission.deleted" -
const AdminOrganizationAuditLogListResponseTypeExternalKeyRegistered AdminOrganizationAuditLogListResponseType = "external_key.registered" -
const AdminOrganizationAuditLogListResponseTypeExternalKeyRemoved AdminOrganizationAuditLogListResponseType = "external_key.removed" -
const AdminOrganizationAuditLogListResponseTypeGroupCreated AdminOrganizationAuditLogListResponseType = "group.created" -
const AdminOrganizationAuditLogListResponseTypeGroupUpdated AdminOrganizationAuditLogListResponseType = "group.updated" -
const AdminOrganizationAuditLogListResponseTypeGroupDeleted AdminOrganizationAuditLogListResponseType = "group.deleted" -
const AdminOrganizationAuditLogListResponseTypeInviteSent AdminOrganizationAuditLogListResponseType = "invite.sent" -
const AdminOrganizationAuditLogListResponseTypeInviteAccepted AdminOrganizationAuditLogListResponseType = "invite.accepted" -
const AdminOrganizationAuditLogListResponseTypeInviteDeleted AdminOrganizationAuditLogListResponseType = "invite.deleted" -
const AdminOrganizationAuditLogListResponseTypeIPAllowlistCreated AdminOrganizationAuditLogListResponseType = "ip_allowlist.created" -
const AdminOrganizationAuditLogListResponseTypeIPAllowlistUpdated AdminOrganizationAuditLogListResponseType = "ip_allowlist.updated" -
const AdminOrganizationAuditLogListResponseTypeIPAllowlistDeleted AdminOrganizationAuditLogListResponseType = "ip_allowlist.deleted" -
const AdminOrganizationAuditLogListResponseTypeIPAllowlistConfigActivated AdminOrganizationAuditLogListResponseType = "ip_allowlist.config.activated" -
const AdminOrganizationAuditLogListResponseTypeIPAllowlistConfigDeactivated AdminOrganizationAuditLogListResponseType = "ip_allowlist.config.deactivated" -
const AdminOrganizationAuditLogListResponseTypeLoginSucceeded AdminOrganizationAuditLogListResponseType = "login.succeeded" -
const AdminOrganizationAuditLogListResponseTypeLoginFailed AdminOrganizationAuditLogListResponseType = "login.failed" -
const AdminOrganizationAuditLogListResponseTypeLogoutSucceeded AdminOrganizationAuditLogListResponseType = "logout.succeeded" -
const AdminOrganizationAuditLogListResponseTypeLogoutFailed AdminOrganizationAuditLogListResponseType = "logout.failed" -
const AdminOrganizationAuditLogListResponseTypeOrganizationUpdated AdminOrganizationAuditLogListResponseType = "organization.updated" -
const AdminOrganizationAuditLogListResponseTypeProjectCreated AdminOrganizationAuditLogListResponseType = "project.created" -
const AdminOrganizationAuditLogListResponseTypeProjectUpdated AdminOrganizationAuditLogListResponseType = "project.updated" -
const AdminOrganizationAuditLogListResponseTypeProjectArchived AdminOrganizationAuditLogListResponseType = "project.archived" -
const AdminOrganizationAuditLogListResponseTypeProjectDeleted AdminOrganizationAuditLogListResponseType = "project.deleted" -
const AdminOrganizationAuditLogListResponseTypeRateLimitUpdated AdminOrganizationAuditLogListResponseType = "rate_limit.updated" -
const AdminOrganizationAuditLogListResponseTypeRateLimitDeleted AdminOrganizationAuditLogListResponseType = "rate_limit.deleted" -
const AdminOrganizationAuditLogListResponseTypeResourceDeleted AdminOrganizationAuditLogListResponseType = "resource.deleted" -
const AdminOrganizationAuditLogListResponseTypeTunnelCreated AdminOrganizationAuditLogListResponseType = "tunnel.created" -
const AdminOrganizationAuditLogListResponseTypeTunnelUpdated AdminOrganizationAuditLogListResponseType = "tunnel.updated" -
const AdminOrganizationAuditLogListResponseTypeTunnelDeleted AdminOrganizationAuditLogListResponseType = "tunnel.deleted" -
const AdminOrganizationAuditLogListResponseTypeWorkloadIdentityProviderCreated AdminOrganizationAuditLogListResponseType = "workload_identity_provider.created" -
const AdminOrganizationAuditLogListResponseTypeWorkloadIdentityProviderUpdated AdminOrganizationAuditLogListResponseType = "workload_identity_provider.updated" -
const AdminOrganizationAuditLogListResponseTypeWorkloadIdentityProviderDeleted AdminOrganizationAuditLogListResponseType = "workload_identity_provider.deleted" -
const AdminOrganizationAuditLogListResponseTypeWorkloadIdentityProviderMappingCreated AdminOrganizationAuditLogListResponseType = "workload_identity_provider_mapping.created" -
const AdminOrganizationAuditLogListResponseTypeWorkloadIdentityProviderMappingUpdated AdminOrganizationAuditLogListResponseType = "workload_identity_provider_mapping.updated" -
const AdminOrganizationAuditLogListResponseTypeWorkloadIdentityProviderMappingDeleted AdminOrganizationAuditLogListResponseType = "workload_identity_provider_mapping.deleted" -
const AdminOrganizationAuditLogListResponseTypeRoleCreated AdminOrganizationAuditLogListResponseType = "role.created" -
const AdminOrganizationAuditLogListResponseTypeRoleUpdated AdminOrganizationAuditLogListResponseType = "role.updated" -
const AdminOrganizationAuditLogListResponseTypeRoleDeleted AdminOrganizationAuditLogListResponseType = "role.deleted" -
const AdminOrganizationAuditLogListResponseTypeRoleAssignmentCreated AdminOrganizationAuditLogListResponseType = "role.assignment.created" -
const AdminOrganizationAuditLogListResponseTypeRoleAssignmentDeleted AdminOrganizationAuditLogListResponseType = "role.assignment.deleted" -
const AdminOrganizationAuditLogListResponseTypeRoleBoundToResource AdminOrganizationAuditLogListResponseType = "role.bound_to_resource" -
const AdminOrganizationAuditLogListResponseTypeRoleUnboundFromResource AdminOrganizationAuditLogListResponseType = "role.unbound_from_resource" -
const AdminOrganizationAuditLogListResponseTypeScimEnabled AdminOrganizationAuditLogListResponseType = "scim.enabled" -
const AdminOrganizationAuditLogListResponseTypeScimDisabled AdminOrganizationAuditLogListResponseType = "scim.disabled" -
const AdminOrganizationAuditLogListResponseTypeServiceAccountCreated AdminOrganizationAuditLogListResponseType = "service_account.created" -
const AdminOrganizationAuditLogListResponseTypeServiceAccountUpdated AdminOrganizationAuditLogListResponseType = "service_account.updated" -
const AdminOrganizationAuditLogListResponseTypeServiceAccountDeleted AdminOrganizationAuditLogListResponseType = "service_account.deleted" -
const AdminOrganizationAuditLogListResponseTypeUserAdded AdminOrganizationAuditLogListResponseType = "user.added" -
const AdminOrganizationAuditLogListResponseTypeUserUpdated AdminOrganizationAuditLogListResponseType = "user.updated" -
const AdminOrganizationAuditLogListResponseTypeUserDeleted AdminOrganizationAuditLogListResponseType = "user.deleted"
-
-
Actor AdminOrganizationAuditLogListResponseActorThe actor who performed the audit logged action.
-
APIKey AdminOrganizationAuditLogListResponseActorAPIKeyThe API Key used to perform the audit logged action.
-
ID stringThe tracking id of the API key.
-
ServiceAccount AdminOrganizationAuditLogListResponseActorAPIKeyServiceAccountThe service account that performed the audit logged action.
-
ID stringThe service account id.
-
-
Type stringThe type of API key. Can be either
userorservice_account.-
const AdminOrganizationAuditLogListResponseActorAPIKeyTypeUser AdminOrganizationAuditLogListResponseActorAPIKeyType = "user" -
const AdminOrganizationAuditLogListResponseActorAPIKeyTypeServiceAccount AdminOrganizationAuditLogListResponseActorAPIKeyType = "service_account"
-
-
User AdminOrganizationAuditLogListResponseActorAPIKeyUserThe user who performed the audit logged action.
-
ID stringThe user id.
-
Email stringThe user email.
-
-
-
Session AdminOrganizationAuditLogListResponseActorSessionThe session in which the audit logged action was performed.
-
IPAddress stringThe IP address from which the action was performed.
-
User AdminOrganizationAuditLogListResponseActorSessionUserThe user who performed the audit logged action.
-
ID stringThe user id.
-
Email stringThe user email.
-
-
-
Type stringThe type of actor. Is either
sessionorapi_key.-
const AdminOrganizationAuditLogListResponseActorTypeSession AdminOrganizationAuditLogListResponseActorType = "session" -
const AdminOrganizationAuditLogListResponseActorTypeAPIKey AdminOrganizationAuditLogListResponseActorType = "api_key"
-
-
-
APIKeyCreated AdminOrganizationAuditLogListResponseAPIKeyCreatedThe details for events with this
type.-
ID stringThe tracking ID of the API key.
-
Data AdminOrganizationAuditLogListResponseAPIKeyCreatedDataThe payload used to create the API key.
-
Scopes []stringA list of scopes allowed for the API key, e.g.
["api.model.request"]
-
-
-
APIKeyDeleted AdminOrganizationAuditLogListResponseAPIKeyDeletedThe details for events with this
type.-
ID stringThe tracking ID of the API key.
-
-
APIKeyUpdated AdminOrganizationAuditLogListResponseAPIKeyUpdatedThe details for events with this
type.-
ID stringThe tracking ID of the API key.
-
ChangesRequested AdminOrganizationAuditLogListResponseAPIKeyUpdatedChangesRequestedThe payload used to update the API key.
-
Scopes []stringA list of scopes allowed for the API key, e.g.
["api.model.request"]
-
-
-
CertificateCreated AdminOrganizationAuditLogListResponseCertificateCreatedThe details for events with this
type.-
ID stringThe certificate ID.
-
Name stringThe name of the certificate.
-
-
CertificateDeleted AdminOrganizationAuditLogListResponseCertificateDeletedThe details for events with this
type.-
ID stringThe certificate ID.
-
Certificate stringThe certificate content in PEM format.
-
Name stringThe name of the certificate.
-
-
CertificateUpdated AdminOrganizationAuditLogListResponseCertificateUpdatedThe details for events with this
type.-
ID stringThe certificate ID.
-
Name stringThe name of the certificate.
-
-
CertificatesActivated AdminOrganizationAuditLogListResponseCertificatesActivatedThe details for events with this
type.-
Certificates []AdminOrganizationAuditLogListResponseCertificatesActivatedCertificate-
ID stringThe certificate ID.
-
Name stringThe name of the certificate.
-
-
-
CertificatesDeactivated AdminOrganizationAuditLogListResponseCertificatesDeactivatedThe details for events with this
type.-
Certificates []AdminOrganizationAuditLogListResponseCertificatesDeactivatedCertificate-
ID stringThe certificate ID.
-
Name stringThe name of the certificate.
-
-
-
CheckpointPermissionCreated AdminOrganizationAuditLogListResponseCheckpointPermissionCreatedThe project and fine-tuned model checkpoint that the checkpoint permission was created for.
-
ID stringThe ID of the checkpoint permission.
-
Data AdminOrganizationAuditLogListResponseCheckpointPermissionCreatedDataThe payload used to create the checkpoint permission.
-
FineTunedModelCheckpoint stringThe ID of the fine-tuned model checkpoint.
-
ProjectID stringThe ID of the project that the checkpoint permission was created for.
-
-
-
CheckpointPermissionDeleted AdminOrganizationAuditLogListResponseCheckpointPermissionDeletedThe details for events with this
type.-
ID stringThe ID of the checkpoint permission.
-
-
ExternalKeyRegistered AdminOrganizationAuditLogListResponseExternalKeyRegisteredThe details for events with this
type.-
ID stringThe ID of the external key configuration.
-
Data anyThe configuration for the external key.
-
-
ExternalKeyRemoved AdminOrganizationAuditLogListResponseExternalKeyRemovedThe details for events with this
type.-
ID stringThe ID of the external key configuration.
-
-
GroupCreated AdminOrganizationAuditLogListResponseGroupCreatedThe details for events with this
type.-
ID stringThe ID of the group.
-
Data AdminOrganizationAuditLogListResponseGroupCreatedDataInformation about the created group.
-
GroupName stringThe group name.
-
-
-
GroupDeleted AdminOrganizationAuditLogListResponseGroupDeletedThe details for events with this
type.-
ID stringThe ID of the group.
-
-
GroupUpdated AdminOrganizationAuditLogListResponseGroupUpdatedThe details for events with this
type.-
ID stringThe ID of the group.
-
ChangesRequested AdminOrganizationAuditLogListResponseGroupUpdatedChangesRequestedThe payload used to update the group.
-
GroupName stringThe updated group name.
-
-
-
InviteAccepted AdminOrganizationAuditLogListResponseInviteAcceptedThe details for events with this
type.-
ID stringThe ID of the invite.
-
-
InviteDeleted AdminOrganizationAuditLogListResponseInviteDeletedThe details for events with this
type.-
ID stringThe ID of the invite.
-
-
InviteSent AdminOrganizationAuditLogListResponseInviteSentThe details for events with this
type.-
ID stringThe ID of the invite.
-
Data AdminOrganizationAuditLogListResponseInviteSentDataThe payload used to create the invite.
-
Email stringThe email invited to the organization.
-
Role stringThe role the email was invited to be. Is either
ownerormember.
-
-
-
IPAllowlistConfigActivated AdminOrganizationAuditLogListResponseIPAllowlistConfigActivatedThe details for events with this
type.-
Configs []AdminOrganizationAuditLogListResponseIPAllowlistConfigActivatedConfigThe configurations that were activated.
-
ID stringThe ID of the IP allowlist configuration.
-
Name stringThe name of the IP allowlist configuration.
-
-
-
IPAllowlistConfigDeactivated AdminOrganizationAuditLogListResponseIPAllowlistConfigDeactivatedThe details for events with this
type.-
Configs []AdminOrganizationAuditLogListResponseIPAllowlistConfigDeactivatedConfigThe configurations that were deactivated.
-
ID stringThe ID of the IP allowlist configuration.
-
Name stringThe name of the IP allowlist configuration.
-
-
-
IPAllowlistCreated AdminOrganizationAuditLogListResponseIPAllowlistCreatedThe details for events with this
type.-
ID stringThe ID of the IP allowlist configuration.
-
AllowedIPs []stringThe IP addresses or CIDR ranges included in the configuration.
-
Name stringThe name of the IP allowlist configuration.
-
-
IPAllowlistDeleted AdminOrganizationAuditLogListResponseIPAllowlistDeletedThe details for events with this
type.-
ID stringThe ID of the IP allowlist configuration.
-
AllowedIPs []stringThe IP addresses or CIDR ranges that were in the configuration.
-
Name stringThe name of the IP allowlist configuration.
-
-
IPAllowlistUpdated AdminOrganizationAuditLogListResponseIPAllowlistUpdatedThe details for events with this
type.-
ID stringThe ID of the IP allowlist configuration.
-
AllowedIPs []stringThe updated set of IP addresses or CIDR ranges in the configuration.
-
-
LoginFailed AdminOrganizationAuditLogListResponseLoginFailedThe details for events with this
type.-
ErrorCode stringThe error code of the failure.
-
ErrorMessage stringThe error message of the failure.
-
-
LoginSucceeded anyThis event has no additional fields beyond the standard audit log attributes.
-
LogoutFailed AdminOrganizationAuditLogListResponseLogoutFailedThe details for events with this
type.-
ErrorCode stringThe error code of the failure.
-
ErrorMessage stringThe error message of the failure.
-
-
LogoutSucceeded anyThis event has no additional fields beyond the standard audit log attributes.
-
OrganizationUpdated AdminOrganizationAuditLogListResponseOrganizationUpdatedThe details for events with this
type.-
ID stringThe organization ID.
-
ChangesRequested AdminOrganizationAuditLogListResponseOrganizationUpdatedChangesRequestedThe payload used to update the organization settings.
-
APICallLogging stringHow your organization logs data from supported API calls. One of
disabled,enabled_per_call,enabled_for_all_projects, orenabled_for_selected_projects -
APICallLoggingProjectIDs stringThe list of project ids if api_call_logging is set to
enabled_for_selected_projects -
Description stringThe organization description.
-
Name stringThe organization name.
-
ThreadsUiVisibility stringVisibility of the threads page which shows messages created with the Assistants API and Playground. One of
ANY_ROLE,OWNERS, orNONE. -
Title stringThe organization title.
-
UsageDashboardVisibility stringVisibility of the usage dashboard which shows activity and costs for your organization. One of
ANY_ROLEorOWNERS.
-
-
-
Project AdminOrganizationAuditLogListResponseProjectThe project that the action was scoped to. Absent for actions not scoped to projects. Note that any admin actions taken via Admin API keys are associated with the default project.
-
ID stringThe project ID.
-
Name stringThe project title.
-
-
ProjectArchived AdminOrganizationAuditLogListResponseProjectArchivedThe details for events with this
type.-
ID stringThe project ID.
-
-
ProjectCreated AdminOrganizationAuditLogListResponseProjectCreatedThe details for events with this
type.-
ID stringThe project ID.
-
Data AdminOrganizationAuditLogListResponseProjectCreatedDataThe payload used to create the project.
-
Name stringThe project name.
-
Title stringThe title of the project as seen on the dashboard.
-
-
-
ProjectDeleted AdminOrganizationAuditLogListResponseProjectDeletedThe details for events with this
type.-
ID stringThe project ID.
-
-
ProjectUpdated AdminOrganizationAuditLogListResponseProjectUpdatedThe details for events with this
type.-
ID stringThe project ID.
-
ChangesRequested AdminOrganizationAuditLogListResponseProjectUpdatedChangesRequestedThe payload used to update the project.
-
Title stringThe title of the project as seen on the dashboard.
-
-
-
RateLimitDeleted AdminOrganizationAuditLogListResponseRateLimitDeletedThe details for events with this
type.-
ID stringThe rate limit ID
-
-
RateLimitUpdated AdminOrganizationAuditLogListResponseRateLimitUpdatedThe details for events with this
type.-
ID stringThe rate limit ID
-
ChangesRequested AdminOrganizationAuditLogListResponseRateLimitUpdatedChangesRequestedThe payload used to update the rate limits.
-
Batch1DayMaxInputTokens int64The maximum batch input tokens per day. Only relevant for certain models.
-
MaxAudioMegabytesPer1Minute int64The maximum audio megabytes per minute. Only relevant for certain models.
-
MaxImagesPer1Minute int64The maximum images per minute. Only relevant for certain models.
-
MaxRequestsPer1Day int64The maximum requests per day. Only relevant for certain models.
-
MaxRequestsPer1Minute int64The maximum requests per minute.
-
MaxTokensPer1Minute int64The maximum tokens per minute.
-
-
-
RoleAssignmentCreated AdminOrganizationAuditLogListResponseRoleAssignmentCreatedThe details for events with this
type.-
ID stringThe identifier of the role assignment.
-
PrincipalID stringThe principal (user or group) that received the role.
-
PrincipalType stringThe type of principal (user or group) that received the role.
-
ResourceID stringThe resource the role assignment is scoped to.
-
ResourceType stringThe type of resource the role assignment is scoped to.
-
-
RoleAssignmentDeleted AdminOrganizationAuditLogListResponseRoleAssignmentDeletedThe details for events with this
type.-
ID stringThe identifier of the role assignment.
-
PrincipalID stringThe principal (user or group) that had the role removed.
-
PrincipalType stringThe type of principal (user or group) that had the role removed.
-
ResourceID stringThe resource the role assignment was scoped to.
-
ResourceType stringThe type of resource the role assignment was scoped to.
-
-
RoleBoundToResource AdminOrganizationAuditLogListResponseRoleBoundToResourceThe details for events with this
type.-
ID stringThe ID of the resource the role was bound to. ChatGPT workspace connector resources use
<workspace_id>__<connector_id>. -
ConnectorID stringThe connector ID for a ChatGPT workspace connector resource.
-
ConnectorName stringThe connector display name for a ChatGPT workspace connector resource, or the connector ID when the display name could not be resolved.
-
Enabled boolWhether the connector is enabled for the role.
-
Permissions []stringThe permissions granted to the role for the resource.
-
ResourceID stringThe ID of the resource the role was bound to.
-
ResourceType stringThe type of resource the role was bound to.
-
RoleID stringThe ID of the role that was bound to the resource.
-
Source stringThe connector role mutation path that produced the event.
-
const AdminOrganizationAuditLogListResponseRoleBoundToResourceSourceRoleToggle AdminOrganizationAuditLogListResponseRoleBoundToResourceSource = "role_toggle" -
const AdminOrganizationAuditLogListResponseRoleBoundToResourceSourceRoleConnectorUpdate AdminOrganizationAuditLogListResponseRoleBoundToResourceSource = "role_connector_update" -
const AdminOrganizationAuditLogListResponseRoleBoundToResourceSourceRoleDelete AdminOrganizationAuditLogListResponseRoleBoundToResourceSource = "role_delete" -
const AdminOrganizationAuditLogListResponseRoleBoundToResourceSourceWorkspacePermissions AdminOrganizationAuditLogListResponseRoleBoundToResourceSource = "workspace_permissions" -
const AdminOrganizationAuditLogListResponseRoleBoundToResourceSourceConnectorPublish AdminOrganizationAuditLogListResponseRoleBoundToResourceSource = "connector_publish"
-
-
WorkspaceID stringThe workspace ID for a ChatGPT workspace connector resource.
-
-
RoleCreated AdminOrganizationAuditLogListResponseRoleCreatedThe details for events with this
type.-
ID stringThe role ID.
-
Permissions []stringThe permissions granted by the role.
-
ResourceID stringThe resource the role is scoped to.
-
ResourceType stringThe type of resource the role belongs to.
-
RoleName stringThe name of the role.
-
-
RoleDeleted AdminOrganizationAuditLogListResponseRoleDeletedThe details for events with this
type.-
ID stringThe role ID.
-
-
RoleUnboundFromResource AdminOrganizationAuditLogListResponseRoleUnboundFromResourceThe details for events with this
type.-
ID stringThe ID of the resource the role was unbound from. ChatGPT workspace connector resources use
<workspace_id>__<connector_id>. -
ConnectorID stringThe connector ID for a ChatGPT workspace connector resource.
-
ConnectorName stringThe connector display name for a ChatGPT workspace connector resource, or the connector ID when the display name could not be resolved.
-
Enabled boolWhether the connector is enabled for the role.
-
Permissions []stringThe permissions remaining for the role after the change.
-
ResourceID stringThe ID of the resource the role was unbound from.
-
ResourceType stringThe type of resource the role was unbound from.
-
RoleID stringThe ID of the role that was unbound from the resource.
-
Source stringThe connector role mutation path that produced the event.
-
const AdminOrganizationAuditLogListResponseRoleUnboundFromResourceSourceRoleToggle AdminOrganizationAuditLogListResponseRoleUnboundFromResourceSource = "role_toggle" -
const AdminOrganizationAuditLogListResponseRoleUnboundFromResourceSourceRoleConnectorUpdate AdminOrganizationAuditLogListResponseRoleUnboundFromResourceSource = "role_connector_update" -
const AdminOrganizationAuditLogListResponseRoleUnboundFromResourceSourceRoleDelete AdminOrganizationAuditLogListResponseRoleUnboundFromResourceSource = "role_delete" -
const AdminOrganizationAuditLogListResponseRoleUnboundFromResourceSourceWorkspacePermissions AdminOrganizationAuditLogListResponseRoleUnboundFromResourceSource = "workspace_permissions" -
const AdminOrganizationAuditLogListResponseRoleUnboundFromResourceSourceConnectorPublish AdminOrganizationAuditLogListResponseRoleUnboundFromResourceSource = "connector_publish"
-
-
WorkspaceID stringThe workspace ID for a ChatGPT workspace connector resource.
-
-
RoleUpdated AdminOrganizationAuditLogListResponseRoleUpdatedThe details for events with this
type.-
ID stringThe role ID.
-
ChangesRequested AdminOrganizationAuditLogListResponseRoleUpdatedChangesRequestedThe payload used to update the role.
-
Description stringThe updated role description, when provided.
-
Metadata anyAdditional metadata stored on the role.
-
PermissionsAdded []stringThe permissions added to the role.
-
PermissionsRemoved []stringThe permissions removed from the role.
-
ResourceID stringThe resource the role is scoped to.
-
ResourceType stringThe type of resource the role belongs to.
-
RoleName stringThe updated role name, when provided.
-
-
-
ScimDisabled AdminOrganizationAuditLogListResponseScimDisabledThe details for events with this
type.-
ID stringThe ID of the SCIM was disabled for.
-
-
ScimEnabled AdminOrganizationAuditLogListResponseScimEnabledThe details for events with this
type.-
ID stringThe ID of the SCIM was enabled for.
-
-
ServiceAccountCreated AdminOrganizationAuditLogListResponseServiceAccountCreatedThe details for events with this
type.-
ID stringThe service account ID.
-
Data AdminOrganizationAuditLogListResponseServiceAccountCreatedDataThe payload used to create the service account.
-
Role stringThe role of the service account. Is either
ownerormember.
-
-
-
ServiceAccountDeleted AdminOrganizationAuditLogListResponseServiceAccountDeletedThe details for events with this
type.-
ID stringThe service account ID.
-
-
ServiceAccountUpdated AdminOrganizationAuditLogListResponseServiceAccountUpdatedThe details for events with this
type.-
ID stringThe service account ID.
-
ChangesRequested AdminOrganizationAuditLogListResponseServiceAccountUpdatedChangesRequestedThe payload used to updated the service account.
-
Role stringThe role of the service account. Is either
ownerormember.
-
-
-
UserAdded AdminOrganizationAuditLogListResponseUserAddedThe details for events with this
type.-
ID stringThe user ID.
-
Data AdminOrganizationAuditLogListResponseUserAddedDataThe payload used to add the user to the project.
-
Role stringThe role of the user. Is either
ownerormember.
-
-
-
UserDeleted AdminOrganizationAuditLogListResponseUserDeletedThe details for events with this
type.-
ID stringThe user ID.
-
-
UserUpdated AdminOrganizationAuditLogListResponseUserUpdatedThe details for events with this
type.-
ID stringThe project ID.
-
ChangesRequested AdminOrganizationAuditLogListResponseUserUpdatedChangesRequestedThe payload used to update the user.
-
Role stringThe role of the user. Is either
ownerormember.
-
-
-
WorkloadIdentityProviderMappingCreated AdminOrganizationAuditLogListResponseWorkloadIdentityProviderMappingCreatedThe details for events with this
type.-
ID stringThe workload identity provider mapping ID.
-
Data anyThe payload used to create the workload identity provider mapping.
-
IdentityProviderID stringThe workload identity provider ID.
-
-
WorkloadIdentityProviderMappingDeleted AdminOrganizationAuditLogListResponseWorkloadIdentityProviderMappingDeletedThe details for events with this
type.-
ID stringThe workload identity provider mapping ID.
-
IdentityProviderID stringThe workload identity provider ID.
-
ProjectID stringThe project ID.
-
ServiceAccountID stringThe mapped service account ID.
-
-
WorkloadIdentityProviderMappingUpdated AdminOrganizationAuditLogListResponseWorkloadIdentityProviderMappingUpdatedThe details for events with this
type.-
ID stringThe workload identity provider mapping ID.
-
ChangesRequested anyThe payload used to update the workload identity provider mapping.
-
IdentityProviderID stringThe workload identity provider ID.
-
-
WorkloadIdentityProviderCreated AdminOrganizationAuditLogListResponseWorkloadIdentityProviderCreatedThe details for events with this
type.-
ID stringThe workload identity provider ID.
-
Data anyThe payload used to create the workload identity provider.
-
-
WorkloadIdentityProviderDeleted AdminOrganizationAuditLogListResponseWorkloadIdentityProviderDeletedThe details for events with this
type.-
ID stringThe workload identity provider ID.
-
Name stringThe workload identity provider name.
-
-
WorkloadIdentityProviderUpdated AdminOrganizationAuditLogListResponseWorkloadIdentityProviderUpdatedThe details for events with this
type.-
ID stringThe workload identity provider ID.
-
ChangesRequested anyThe payload used to update the workload identity provider.
-
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
page, err := client.Admin.Organization.AuditLogs.List(context.TODO(), openai.AdminOrganizationAuditLogListParams{
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
Response
{
"data": [
{
"id": "id",
"effective_at": 0,
"type": "api_key.created",
"actor": {
"api_key": {
"id": "id",
"service_account": {
"id": "id"
},
"type": "user",
"user": {
"id": "id",
"email": "email"
}
},
"session": {
"ip_address": "ip_address",
"user": {
"id": "id",
"email": "email"
}
},
"type": "session"
},
"api_key.created": {
"id": "id",
"data": {
"scopes": [
"string"
]
}
},
"api_key.deleted": {
"id": "id"
},
"api_key.updated": {
"id": "id",
"changes_requested": {
"scopes": [
"string"
]
}
},
"certificate.created": {
"id": "id",
"name": "name"
},
"certificate.deleted": {
"id": "id",
"certificate": "certificate",
"name": "name"
},
"certificate.updated": {
"id": "id",
"name": "name"
},
"certificates.activated": {
"certificates": [
{
"id": "id",
"name": "name"
}
]
},
"certificates.deactivated": {
"certificates": [
{
"id": "id",
"name": "name"
}
]
},
"checkpoint.permission.created": {
"id": "id",
"data": {
"fine_tuned_model_checkpoint": "fine_tuned_model_checkpoint",
"project_id": "project_id"
}
},
"checkpoint.permission.deleted": {
"id": "id"
},
"external_key.registered": {
"id": "id",
"data": {}
},
"external_key.removed": {
"id": "id"
},
"group.created": {
"id": "id",
"data": {
"group_name": "group_name"
}
},
"group.deleted": {
"id": "id"
},
"group.updated": {
"id": "id",
"changes_requested": {
"group_name": "group_name"
}
},
"invite.accepted": {
"id": "id"
},
"invite.deleted": {
"id": "id"
},
"invite.sent": {
"id": "id",
"data": {
"email": "email",
"role": "role"
}
},
"ip_allowlist.config.activated": {
"configs": [
{
"id": "id",
"name": "name"
}
]
},
"ip_allowlist.config.deactivated": {
"configs": [
{
"id": "id",
"name": "name"
}
]
},
"ip_allowlist.created": {
"id": "id",
"allowed_ips": [
"string"
],
"name": "name"
},
"ip_allowlist.deleted": {
"id": "id",
"allowed_ips": [
"string"
],
"name": "name"
},
"ip_allowlist.updated": {
"id": "id",
"allowed_ips": [
"string"
]
},
"login.failed": {
"error_code": "error_code",
"error_message": "error_message"
},
"login.succeeded": {},
"logout.failed": {
"error_code": "error_code",
"error_message": "error_message"
},
"logout.succeeded": {},
"organization.updated": {
"id": "id",
"changes_requested": {
"api_call_logging": "api_call_logging",
"api_call_logging_project_ids": "api_call_logging_project_ids",
"description": "description",
"name": "name",
"threads_ui_visibility": "threads_ui_visibility",
"title": "title",
"usage_dashboard_visibility": "usage_dashboard_visibility"
}
},
"project": {
"id": "id",
"name": "name"
},
"project.archived": {
"id": "id"
},
"project.created": {
"id": "id",
"data": {
"name": "name",
"title": "title"
}
},
"project.deleted": {
"id": "id"
},
"project.updated": {
"id": "id",
"changes_requested": {
"title": "title"
}
},
"rate_limit.deleted": {
"id": "id"
},
"rate_limit.updated": {
"id": "id",
"changes_requested": {
"batch_1_day_max_input_tokens": 0,
"max_audio_megabytes_per_1_minute": 0,
"max_images_per_1_minute": 0,
"max_requests_per_1_day": 0,
"max_requests_per_1_minute": 0,
"max_tokens_per_1_minute": 0
}
},
"role.assignment.created": {
"id": "id",
"principal_id": "principal_id",
"principal_type": "principal_type",
"resource_id": "resource_id",
"resource_type": "resource_type"
},
"role.assignment.deleted": {
"id": "id",
"principal_id": "principal_id",
"principal_type": "principal_type",
"resource_id": "resource_id",
"resource_type": "resource_type"
},
"role.bound_to_resource": {
"id": "id",
"connector_id": "connector_id",
"connector_name": "connector_name",
"enabled": true,
"permissions": [
"string"
],
"resource_id": "resource_id",
"resource_type": "resource_type",
"role_id": "role_id",
"source": "role_toggle",
"workspace_id": "workspace_id"
},
"role.created": {
"id": "id",
"permissions": [
"string"
],
"resource_id": "resource_id",
"resource_type": "resource_type",
"role_name": "role_name"
},
"role.deleted": {
"id": "id"
},
"role.unbound_from_resource": {
"id": "id",
"connector_id": "connector_id",
"connector_name": "connector_name",
"enabled": true,
"permissions": [
"string"
],
"resource_id": "resource_id",
"resource_type": "resource_type",
"role_id": "role_id",
"source": "role_toggle",
"workspace_id": "workspace_id"
},
"role.updated": {
"id": "id",
"changes_requested": {
"description": "description",
"metadata": {},
"permissions_added": [
"string"
],
"permissions_removed": [
"string"
],
"resource_id": "resource_id",
"resource_type": "resource_type",
"role_name": "role_name"
}
},
"scim.disabled": {
"id": "id"
},
"scim.enabled": {
"id": "id"
},
"service_account.created": {
"id": "id",
"data": {
"role": "role"
}
},
"service_account.deleted": {
"id": "id"
},
"service_account.updated": {
"id": "id",
"changes_requested": {
"role": "role"
}
},
"user.added": {
"id": "id",
"data": {
"role": "role"
}
},
"user.deleted": {
"id": "id"
},
"user.updated": {
"id": "id",
"changes_requested": {
"role": "role"
}
},
"workload_identity_provider_mapping.created": {
"id": "id",
"data": {},
"identity_provider_id": "identity_provider_id"
},
"workload_identity_provider_mapping.deleted": {
"id": "id",
"identity_provider_id": "identity_provider_id",
"project_id": "project_id",
"service_account_id": "service_account_id"
},
"workload_identity_provider_mapping.updated": {
"id": "id",
"changes_requested": {},
"identity_provider_id": "identity_provider_id"
},
"workload_identity_provider.created": {
"id": "id",
"data": {}
},
"workload_identity_provider.deleted": {
"id": "id",
"name": "name"
},
"workload_identity_provider.updated": {
"id": "id",
"changes_requested": {}
}
}
],
"has_more": true,
"object": "list",
"first_id": "audit_log-defb456h8dks",
"last_id": "audit_log-hnbkd8s93s"
}
Admin API Keys
List all organization and project API keys.
client.Admin.Organization.AdminAPIKeys.List(ctx, query) (*CursorPage[AdminAPIKey], error)
get /organization/admin_api_keys
List organization API keys
Parameters
-
query AdminOrganizationAdminAPIKeyListParams-
After param.Field[string]Return keys with IDs that come after this ID in the pagination order.
-
Limit param.Field[int64]Maximum number of keys to return.
-
Order param.Field[AdminOrganizationAdminAPIKeyListParamsOrder]Order results by creation time, ascending or descending.
-
const AdminOrganizationAdminAPIKeyListParamsOrderAsc AdminOrganizationAdminAPIKeyListParamsOrder = "asc" -
const AdminOrganizationAdminAPIKeyListParamsOrderDesc AdminOrganizationAdminAPIKeyListParamsOrder = "desc"
-
-
Returns
-
type AdminAPIKey struct{…}Represents an individual Admin API key in an org.
-
ID stringThe identifier, which can be referenced in API endpoints
-
CreatedAt int64The Unix timestamp (in seconds) of when the API key was created
-
ExpiresAt int64The Unix timestamp (in seconds) of when the API key expires
-
Object OrganizationAdminAPIKeyThe object type, which is always
organization.admin_api_keyconst OrganizationAdminAPIKeyOrganizationAdminAPIKey OrganizationAdminAPIKey = "organization.admin_api_key"
-
Owner AdminAPIKeyOwner-
ID stringThe identifier, which can be referenced in API endpoints
-
CreatedAt int64The Unix timestamp (in seconds) of when the user was created
-
Name stringThe name of the user
-
Object stringThe object type, which is always organization.user
-
Role stringAlways
owner -
Type stringAlways
user
-
-
RedactedValue stringThe redacted value of the API key
-
LastUsedAt int64The Unix timestamp (in seconds) of when the API key was last used
-
Name stringThe name of the API key
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
page, err := client.Admin.Organization.AdminAPIKeys.List(context.TODO(), openai.AdminOrganizationAdminAPIKeyListParams{
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
Response
{
"data": [
{
"id": "key_abc",
"created_at": 1711471533,
"expires_at": 1714063533,
"object": "organization.admin_api_key",
"owner": {
"id": "sa_456",
"created_at": 1711471533,
"name": "My Service Account",
"object": "organization.user",
"role": "owner",
"type": "user"
},
"redacted_value": "sk-admin...def",
"last_used_at": 1711471534,
"name": "Administration Key"
}
],
"has_more": false,
"object": "list",
"first_id": "key_abc",
"last_id": "key_xyz"
}
Create admin API key
client.Admin.Organization.AdminAPIKeys.New(ctx, body) (*AdminOrganizationAdminAPIKeyNewResponse, error)
post /organization/admin_api_keys
Create an organization admin API key
Parameters
-
body AdminOrganizationAdminAPIKeyNewParams-
Name param.Field[string] -
ExpiresInSeconds param.Field[int64]The number of seconds until the API key expires. Omit this field for a key that does not expire.
-
Returns
-
type AdminOrganizationAdminAPIKeyNewResponse struct{…}Represents an individual Admin API key in an org.
-
Value stringThe value of the API key. Only shown on create.
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
adminAPIKey, err := client.Admin.Organization.AdminAPIKeys.New(context.TODO(), openai.AdminOrganizationAdminAPIKeyNewParams{
Name: "New Admin Key",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", adminAPIKey)
}
Response
{
"id": "key_abc",
"created_at": 1711471533,
"expires_at": 1714063533,
"object": "organization.admin_api_key",
"owner": {
"id": "sa_456",
"created_at": 1711471533,
"name": "My Service Account",
"object": "organization.user",
"role": "owner",
"type": "user"
},
"redacted_value": "sk-admin...def",
"last_used_at": 1711471534,
"name": "Administration Key",
"value": "sk-admin-1234abcd"
}
Retrieve admin API key
client.Admin.Organization.AdminAPIKeys.Get(ctx, keyID) (*AdminAPIKey, error)
get /organization/admin_api_keys/{key_id}
Retrieve a single organization API key
Parameters
-
keyID stringThe ID of the API key.
Returns
-
type AdminAPIKey struct{…}Represents an individual Admin API key in an org.
-
ID stringThe identifier, which can be referenced in API endpoints
-
CreatedAt int64The Unix timestamp (in seconds) of when the API key was created
-
ExpiresAt int64The Unix timestamp (in seconds) of when the API key expires
-
Object OrganizationAdminAPIKeyThe object type, which is always
organization.admin_api_keyconst OrganizationAdminAPIKeyOrganizationAdminAPIKey OrganizationAdminAPIKey = "organization.admin_api_key"
-
Owner AdminAPIKeyOwner-
ID stringThe identifier, which can be referenced in API endpoints
-
CreatedAt int64The Unix timestamp (in seconds) of when the user was created
-
Name stringThe name of the user
-
Object stringThe object type, which is always organization.user
-
Role stringAlways
owner -
Type stringAlways
user
-
-
RedactedValue stringThe redacted value of the API key
-
LastUsedAt int64The Unix timestamp (in seconds) of when the API key was last used
-
Name stringThe name of the API key
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
adminAPIKey, err := client.Admin.Organization.AdminAPIKeys.Get(context.TODO(), "key_id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", adminAPIKey.ID)
}
Response
{
"id": "key_abc",
"created_at": 1711471533,
"expires_at": 1714063533,
"object": "organization.admin_api_key",
"owner": {
"id": "sa_456",
"created_at": 1711471533,
"name": "My Service Account",
"object": "organization.user",
"role": "owner",
"type": "user"
},
"redacted_value": "sk-admin...def",
"last_used_at": 1711471534,
"name": "Administration Key"
}
Delete admin API key
client.Admin.Organization.AdminAPIKeys.Delete(ctx, keyID) (*AdminOrganizationAdminAPIKeyDeleteResponse, error)
delete /organization/admin_api_keys/{key_id}
Delete an organization admin API key
Parameters
-
keyID stringThe ID of the API key to be deleted.
Returns
-
type AdminOrganizationAdminAPIKeyDeleteResponse struct{…}-
ID string -
Deleted bool -
Object OrganizationAdminAPIKeyDeletedconst OrganizationAdminAPIKeyDeletedOrganizationAdminAPIKeyDeleted OrganizationAdminAPIKeyDeleted = "organization.admin_api_key.deleted"
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
adminAPIKey, err := client.Admin.Organization.AdminAPIKeys.Delete(context.TODO(), "key_id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", adminAPIKey.ID)
}
Response
{
"id": "key_abc",
"deleted": true,
"object": "organization.admin_api_key.deleted"
}
Domain Types
Admin API Key
-
type AdminAPIKey struct{…}Represents an individual Admin API key in an org.
-
ID stringThe identifier, which can be referenced in API endpoints
-
CreatedAt int64The Unix timestamp (in seconds) of when the API key was created
-
ExpiresAt int64The Unix timestamp (in seconds) of when the API key expires
-
Object OrganizationAdminAPIKeyThe object type, which is always
organization.admin_api_keyconst OrganizationAdminAPIKeyOrganizationAdminAPIKey OrganizationAdminAPIKey = "organization.admin_api_key"
-
Owner AdminAPIKeyOwner-
ID stringThe identifier, which can be referenced in API endpoints
-
CreatedAt int64The Unix timestamp (in seconds) of when the user was created
-
Name stringThe name of the user
-
Object stringThe object type, which is always organization.user
-
Role stringAlways
owner -
Type stringAlways
user
-
-
RedactedValue stringThe redacted value of the API key
-
LastUsedAt int64The Unix timestamp (in seconds) of when the API key was last used
-
Name stringThe name of the API key
-
Usage
Audio speeches
client.Admin.Organization.Usage.AudioSpeeches(ctx, query) (*AdminOrganizationUsageAudioSpeechesResponse, error)
get /organization/usage/audio_speeches
Get audio speeches usage details for the organization.
Parameters
-
query AdminOrganizationUsageAudioSpeechesParams-
StartTime param.Field[int64]Start time (Unix seconds) of the query time range, inclusive.
-
APIKeyIDs param.Field[[]string]Return only usage for these API keys.
-
BucketWidth param.Field[AdminOrganizationUsageAudioSpeechesParamsBucketWidth]Width of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
const AdminOrganizationUsageAudioSpeechesParamsBucketWidth1m AdminOrganizationUsageAudioSpeechesParamsBucketWidth = "1m" -
const AdminOrganizationUsageAudioSpeechesParamsBucketWidth1h AdminOrganizationUsageAudioSpeechesParamsBucketWidth = "1h" -
const AdminOrganizationUsageAudioSpeechesParamsBucketWidth1d AdminOrganizationUsageAudioSpeechesParamsBucketWidth = "1d"
-
-
EndTime param.Field[int64]End time (Unix seconds) of the query time range, exclusive.
-
GroupBy param.Field[[]string]Group the usage data by the specified fields. Support fields include
project_id,user_id,api_key_id,modelor any combination of them.-
const AdminOrganizationUsageAudioSpeechesParamsGroupByProjectID AdminOrganizationUsageAudioSpeechesParamsGroupBy = "project_id" -
const AdminOrganizationUsageAudioSpeechesParamsGroupByUserID AdminOrganizationUsageAudioSpeechesParamsGroupBy = "user_id" -
const AdminOrganizationUsageAudioSpeechesParamsGroupByAPIKeyID AdminOrganizationUsageAudioSpeechesParamsGroupBy = "api_key_id" -
const AdminOrganizationUsageAudioSpeechesParamsGroupByModel AdminOrganizationUsageAudioSpeechesParamsGroupBy = "model"
-
-
Limit param.Field[int64]Specifies the number of buckets to return.
bucket_width=1d: default: 7, max: 31bucket_width=1h: default: 24, max: 168bucket_width=1m: default: 60, max: 1440
-
Models param.Field[[]string]Return only usage for these models.
-
Page param.Field[string]A cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
ProjectIDs param.Field[[]string]Return only usage for these projects.
-
UserIDs param.Field[[]string]Return only usage for these users.
-
Returns
-
type AdminOrganizationUsageAudioSpeechesResponse struct{…}-
Data []AdminOrganizationUsageAudioSpeechesResponseData-
EndTime int64 -
Object Bucketconst BucketBucket Bucket = "bucket"
-
Results []AdminOrganizationUsageAudioSpeechesResponseDataResultUnion-
type AdminOrganizationUsageAudioSpeechesResponseDataResultOrganizationUsageCompletionsResult struct{…}The aggregated completions usage details of the specific time bucket.
-
InputTokens int64The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageCompletionsResultconst OrganizationUsageCompletionsResultOrganizationUsageCompletionsResult OrganizationUsageCompletionsResult = "organization.usage.completions.result"
-
OutputTokens int64The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Batch boolWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
InputAudioTokens int64The aggregated number of audio input tokens used, including cached tokens.
-
InputCachedTokens int64The aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
OutputAudioTokens int64The aggregated number of audio output tokens used.
-
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
ServiceTier stringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageAudioSpeechesResponseDataResultOrganizationUsageEmbeddingsResult struct{…}The aggregated embeddings usage details of the specific time bucket.
-
InputTokens int64The aggregated number of input tokens used.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageEmbeddingsResultconst OrganizationUsageEmbeddingsResultOrganizationUsageEmbeddingsResult OrganizationUsageEmbeddingsResult = "organization.usage.embeddings.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageAudioSpeechesResponseDataResultOrganizationUsageModerationsResult struct{…}The aggregated moderations usage details of the specific time bucket.
-
InputTokens int64The aggregated number of input tokens used.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageModerationsResultconst OrganizationUsageModerationsResultOrganizationUsageModerationsResult OrganizationUsageModerationsResult = "organization.usage.moderations.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageAudioSpeechesResponseDataResultOrganizationUsageImagesResult struct{…}The aggregated images usage details of the specific time bucket.
-
Images int64The number of images processed.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageImagesResultconst OrganizationUsageImagesResultOrganizationUsageImagesResult OrganizationUsageImagesResult = "organization.usage.images.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Size stringWhen
group_by=size, this field provides the image size of the grouped usage result. -
Source stringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageAudioSpeechesResponseDataResultOrganizationUsageAudioSpeechesResult struct{…}The aggregated audio speeches usage details of the specific time bucket.
-
Characters int64The number of characters processed.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageAudioSpeechesResultconst OrganizationUsageAudioSpeechesResultOrganizationUsageAudioSpeechesResult OrganizationUsageAudioSpeechesResult = "organization.usage.audio_speeches.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageAudioSpeechesResponseDataResultOrganizationUsageAudioTranscriptionsResult struct{…}The aggregated audio transcriptions usage details of the specific time bucket.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageAudioTranscriptionsResultconst OrganizationUsageAudioTranscriptionsResultOrganizationUsageAudioTranscriptionsResult OrganizationUsageAudioTranscriptionsResult = "organization.usage.audio_transcriptions.result"
-
Seconds int64The number of seconds processed.
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageAudioSpeechesResponseDataResultOrganizationUsageVectorStoresResult struct{…}The aggregated vector stores usage details of the specific time bucket.
-
Object OrganizationUsageVectorStoresResultconst OrganizationUsageVectorStoresResultOrganizationUsageVectorStoresResult OrganizationUsageVectorStoresResult = "organization.usage.vector_stores.result"
-
UsageBytes int64The vector stores usage in bytes.
-
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
type AdminOrganizationUsageAudioSpeechesResponseDataResultOrganizationUsageCodeInterpreterSessionsResult struct{…}The aggregated code interpreter sessions usage details of the specific time bucket.
-
NumSessions int64The number of code interpreter sessions.
-
Object OrganizationUsageCodeInterpreterSessionsResultconst OrganizationUsageCodeInterpreterSessionsResultOrganizationUsageCodeInterpreterSessionsResult OrganizationUsageCodeInterpreterSessionsResult = "organization.usage.code_interpreter_sessions.result"
-
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
type AdminOrganizationUsageAudioSpeechesResponseDataResultOrganizationUsageFileSearchesResult struct{…}The aggregated file search calls usage details of the specific time bucket.
-
NumRequests int64The count of file search calls.
-
Object OrganizationUsageFileSearchesResultconst OrganizationUsageFileSearchesResultOrganizationUsageFileSearchesResult OrganizationUsageFileSearchesResult = "organization.usage.file_searches.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
VectorStoreID stringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
type AdminOrganizationUsageAudioSpeechesResponseDataResultOrganizationUsageWebSearchesResult struct{…}The aggregated web search calls usage details of the specific time bucket.
-
NumModelRequests int64The count of model requests.
-
NumRequests int64The count of web search calls.
-
Object OrganizationUsageWebSearchesResultconst OrganizationUsageWebSearchesResultOrganizationUsageWebSearchesResult OrganizationUsageWebSearchesResult = "organization.usage.web_searches.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
ContextLevel stringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageAudioSpeechesResponseDataResultOrganizationCostsResult struct{…}The aggregated costs details of the specific time bucket.
-
Object OrganizationCostsResultconst OrganizationCostsResultOrganizationCostsResult OrganizationCostsResult = "organization.costs.result"
-
Amount AdminOrganizationUsageAudioSpeechesResponseDataResultOrganizationCostsResultAmountThe monetary value in its associated currency.
-
Currency stringLowercase ISO-4217 currency e.g. "usd"
-
Value float64The numeric value of the cost.
-
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
LineItem stringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
Quantity float64When
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
StartTime int64
-
-
HasMore bool -
NextPage string -
Object Pageconst PagePage Page = "page"
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
response, err := client.Admin.Organization.Usage.AudioSpeeches(context.TODO(), openai.AdminOrganizationUsageAudioSpeechesParams{
StartTime: 0,
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
Response
{
"data": [
{
"end_time": 0,
"object": "bucket",
"results": [
{
"input_tokens": 0,
"num_model_requests": 0,
"object": "organization.usage.completions.result",
"output_tokens": 0,
"api_key_id": "api_key_id",
"batch": true,
"input_audio_tokens": 0,
"input_cached_tokens": 0,
"model": "model",
"output_audio_tokens": 0,
"project_id": "project_id",
"service_tier": "service_tier",
"user_id": "user_id"
}
],
"start_time": 0
}
],
"has_more": true,
"next_page": "next_page",
"object": "page"
}
Audio transcriptions
client.Admin.Organization.Usage.AudioTranscriptions(ctx, query) (*AdminOrganizationUsageAudioTranscriptionsResponse, error)
get /organization/usage/audio_transcriptions
Get audio transcriptions usage details for the organization.
Parameters
-
query AdminOrganizationUsageAudioTranscriptionsParams-
StartTime param.Field[int64]Start time (Unix seconds) of the query time range, inclusive.
-
APIKeyIDs param.Field[[]string]Return only usage for these API keys.
-
BucketWidth param.Field[AdminOrganizationUsageAudioTranscriptionsParamsBucketWidth]Width of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
const AdminOrganizationUsageAudioTranscriptionsParamsBucketWidth1m AdminOrganizationUsageAudioTranscriptionsParamsBucketWidth = "1m" -
const AdminOrganizationUsageAudioTranscriptionsParamsBucketWidth1h AdminOrganizationUsageAudioTranscriptionsParamsBucketWidth = "1h" -
const AdminOrganizationUsageAudioTranscriptionsParamsBucketWidth1d AdminOrganizationUsageAudioTranscriptionsParamsBucketWidth = "1d"
-
-
EndTime param.Field[int64]End time (Unix seconds) of the query time range, exclusive.
-
GroupBy param.Field[[]string]Group the usage data by the specified fields. Support fields include
project_id,user_id,api_key_id,modelor any combination of them.-
const AdminOrganizationUsageAudioTranscriptionsParamsGroupByProjectID AdminOrganizationUsageAudioTranscriptionsParamsGroupBy = "project_id" -
const AdminOrganizationUsageAudioTranscriptionsParamsGroupByUserID AdminOrganizationUsageAudioTranscriptionsParamsGroupBy = "user_id" -
const AdminOrganizationUsageAudioTranscriptionsParamsGroupByAPIKeyID AdminOrganizationUsageAudioTranscriptionsParamsGroupBy = "api_key_id" -
const AdminOrganizationUsageAudioTranscriptionsParamsGroupByModel AdminOrganizationUsageAudioTranscriptionsParamsGroupBy = "model"
-
-
Limit param.Field[int64]Specifies the number of buckets to return.
bucket_width=1d: default: 7, max: 31bucket_width=1h: default: 24, max: 168bucket_width=1m: default: 60, max: 1440
-
Models param.Field[[]string]Return only usage for these models.
-
Page param.Field[string]A cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
ProjectIDs param.Field[[]string]Return only usage for these projects.
-
UserIDs param.Field[[]string]Return only usage for these users.
-
Returns
-
type AdminOrganizationUsageAudioTranscriptionsResponse struct{…}-
Data []AdminOrganizationUsageAudioTranscriptionsResponseData-
EndTime int64 -
Object Bucketconst BucketBucket Bucket = "bucket"
-
Results []AdminOrganizationUsageAudioTranscriptionsResponseDataResultUnion-
type AdminOrganizationUsageAudioTranscriptionsResponseDataResultOrganizationUsageCompletionsResult struct{…}The aggregated completions usage details of the specific time bucket.
-
InputTokens int64The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageCompletionsResultconst OrganizationUsageCompletionsResultOrganizationUsageCompletionsResult OrganizationUsageCompletionsResult = "organization.usage.completions.result"
-
OutputTokens int64The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Batch boolWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
InputAudioTokens int64The aggregated number of audio input tokens used, including cached tokens.
-
InputCachedTokens int64The aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
OutputAudioTokens int64The aggregated number of audio output tokens used.
-
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
ServiceTier stringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageAudioTranscriptionsResponseDataResultOrganizationUsageEmbeddingsResult struct{…}The aggregated embeddings usage details of the specific time bucket.
-
InputTokens int64The aggregated number of input tokens used.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageEmbeddingsResultconst OrganizationUsageEmbeddingsResultOrganizationUsageEmbeddingsResult OrganizationUsageEmbeddingsResult = "organization.usage.embeddings.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageAudioTranscriptionsResponseDataResultOrganizationUsageModerationsResult struct{…}The aggregated moderations usage details of the specific time bucket.
-
InputTokens int64The aggregated number of input tokens used.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageModerationsResultconst OrganizationUsageModerationsResultOrganizationUsageModerationsResult OrganizationUsageModerationsResult = "organization.usage.moderations.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageAudioTranscriptionsResponseDataResultOrganizationUsageImagesResult struct{…}The aggregated images usage details of the specific time bucket.
-
Images int64The number of images processed.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageImagesResultconst OrganizationUsageImagesResultOrganizationUsageImagesResult OrganizationUsageImagesResult = "organization.usage.images.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Size stringWhen
group_by=size, this field provides the image size of the grouped usage result. -
Source stringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageAudioTranscriptionsResponseDataResultOrganizationUsageAudioSpeechesResult struct{…}The aggregated audio speeches usage details of the specific time bucket.
-
Characters int64The number of characters processed.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageAudioSpeechesResultconst OrganizationUsageAudioSpeechesResultOrganizationUsageAudioSpeechesResult OrganizationUsageAudioSpeechesResult = "organization.usage.audio_speeches.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageAudioTranscriptionsResponseDataResultOrganizationUsageAudioTranscriptionsResult struct{…}The aggregated audio transcriptions usage details of the specific time bucket.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageAudioTranscriptionsResultconst OrganizationUsageAudioTranscriptionsResultOrganizationUsageAudioTranscriptionsResult OrganizationUsageAudioTranscriptionsResult = "organization.usage.audio_transcriptions.result"
-
Seconds int64The number of seconds processed.
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageAudioTranscriptionsResponseDataResultOrganizationUsageVectorStoresResult struct{…}The aggregated vector stores usage details of the specific time bucket.
-
Object OrganizationUsageVectorStoresResultconst OrganizationUsageVectorStoresResultOrganizationUsageVectorStoresResult OrganizationUsageVectorStoresResult = "organization.usage.vector_stores.result"
-
UsageBytes int64The vector stores usage in bytes.
-
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
type AdminOrganizationUsageAudioTranscriptionsResponseDataResultOrganizationUsageCodeInterpreterSessionsResult struct{…}The aggregated code interpreter sessions usage details of the specific time bucket.
-
NumSessions int64The number of code interpreter sessions.
-
Object OrganizationUsageCodeInterpreterSessionsResultconst OrganizationUsageCodeInterpreterSessionsResultOrganizationUsageCodeInterpreterSessionsResult OrganizationUsageCodeInterpreterSessionsResult = "organization.usage.code_interpreter_sessions.result"
-
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
type AdminOrganizationUsageAudioTranscriptionsResponseDataResultOrganizationUsageFileSearchesResult struct{…}The aggregated file search calls usage details of the specific time bucket.
-
NumRequests int64The count of file search calls.
-
Object OrganizationUsageFileSearchesResultconst OrganizationUsageFileSearchesResultOrganizationUsageFileSearchesResult OrganizationUsageFileSearchesResult = "organization.usage.file_searches.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
VectorStoreID stringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
type AdminOrganizationUsageAudioTranscriptionsResponseDataResultOrganizationUsageWebSearchesResult struct{…}The aggregated web search calls usage details of the specific time bucket.
-
NumModelRequests int64The count of model requests.
-
NumRequests int64The count of web search calls.
-
Object OrganizationUsageWebSearchesResultconst OrganizationUsageWebSearchesResultOrganizationUsageWebSearchesResult OrganizationUsageWebSearchesResult = "organization.usage.web_searches.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
ContextLevel stringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageAudioTranscriptionsResponseDataResultOrganizationCostsResult struct{…}The aggregated costs details of the specific time bucket.
-
Object OrganizationCostsResultconst OrganizationCostsResultOrganizationCostsResult OrganizationCostsResult = "organization.costs.result"
-
Amount AdminOrganizationUsageAudioTranscriptionsResponseDataResultOrganizationCostsResultAmountThe monetary value in its associated currency.
-
Currency stringLowercase ISO-4217 currency e.g. "usd"
-
Value float64The numeric value of the cost.
-
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
LineItem stringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
Quantity float64When
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
StartTime int64
-
-
HasMore bool -
NextPage string -
Object Pageconst PagePage Page = "page"
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
response, err := client.Admin.Organization.Usage.AudioTranscriptions(context.TODO(), openai.AdminOrganizationUsageAudioTranscriptionsParams{
StartTime: 0,
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
Response
{
"data": [
{
"end_time": 0,
"object": "bucket",
"results": [
{
"input_tokens": 0,
"num_model_requests": 0,
"object": "organization.usage.completions.result",
"output_tokens": 0,
"api_key_id": "api_key_id",
"batch": true,
"input_audio_tokens": 0,
"input_cached_tokens": 0,
"model": "model",
"output_audio_tokens": 0,
"project_id": "project_id",
"service_tier": "service_tier",
"user_id": "user_id"
}
],
"start_time": 0
}
],
"has_more": true,
"next_page": "next_page",
"object": "page"
}
Code interpreter sessions
client.Admin.Organization.Usage.CodeInterpreterSessions(ctx, query) (*AdminOrganizationUsageCodeInterpreterSessionsResponse, error)
get /organization/usage/code_interpreter_sessions
Get code interpreter sessions usage details for the organization.
Parameters
-
query AdminOrganizationUsageCodeInterpreterSessionsParams-
StartTime param.Field[int64]Start time (Unix seconds) of the query time range, inclusive.
-
BucketWidth param.Field[AdminOrganizationUsageCodeInterpreterSessionsParamsBucketWidth]Width of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
const AdminOrganizationUsageCodeInterpreterSessionsParamsBucketWidth1m AdminOrganizationUsageCodeInterpreterSessionsParamsBucketWidth = "1m" -
const AdminOrganizationUsageCodeInterpreterSessionsParamsBucketWidth1h AdminOrganizationUsageCodeInterpreterSessionsParamsBucketWidth = "1h" -
const AdminOrganizationUsageCodeInterpreterSessionsParamsBucketWidth1d AdminOrganizationUsageCodeInterpreterSessionsParamsBucketWidth = "1d"
-
-
EndTime param.Field[int64]End time (Unix seconds) of the query time range, exclusive.
-
GroupBy param.Field[[]string]Group the usage data by the specified fields. Support fields include
project_id.const AdminOrganizationUsageCodeInterpreterSessionsParamsGroupByProjectID AdminOrganizationUsageCodeInterpreterSessionsParamsGroupBy = "project_id"
-
Limit param.Field[int64]Specifies the number of buckets to return.
bucket_width=1d: default: 7, max: 31bucket_width=1h: default: 24, max: 168bucket_width=1m: default: 60, max: 1440
-
Page param.Field[string]A cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
ProjectIDs param.Field[[]string]Return only usage for these projects.
-
Returns
-
type AdminOrganizationUsageCodeInterpreterSessionsResponse struct{…}-
Data []AdminOrganizationUsageCodeInterpreterSessionsResponseData-
EndTime int64 -
Object Bucketconst BucketBucket Bucket = "bucket"
-
Results []AdminOrganizationUsageCodeInterpreterSessionsResponseDataResultUnion-
type AdminOrganizationUsageCodeInterpreterSessionsResponseDataResultOrganizationUsageCompletionsResult struct{…}The aggregated completions usage details of the specific time bucket.
-
InputTokens int64The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageCompletionsResultconst OrganizationUsageCompletionsResultOrganizationUsageCompletionsResult OrganizationUsageCompletionsResult = "organization.usage.completions.result"
-
OutputTokens int64The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Batch boolWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
InputAudioTokens int64The aggregated number of audio input tokens used, including cached tokens.
-
InputCachedTokens int64The aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
OutputAudioTokens int64The aggregated number of audio output tokens used.
-
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
ServiceTier stringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageCodeInterpreterSessionsResponseDataResultOrganizationUsageEmbeddingsResult struct{…}The aggregated embeddings usage details of the specific time bucket.
-
InputTokens int64The aggregated number of input tokens used.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageEmbeddingsResultconst OrganizationUsageEmbeddingsResultOrganizationUsageEmbeddingsResult OrganizationUsageEmbeddingsResult = "organization.usage.embeddings.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageCodeInterpreterSessionsResponseDataResultOrganizationUsageModerationsResult struct{…}The aggregated moderations usage details of the specific time bucket.
-
InputTokens int64The aggregated number of input tokens used.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageModerationsResultconst OrganizationUsageModerationsResultOrganizationUsageModerationsResult OrganizationUsageModerationsResult = "organization.usage.moderations.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageCodeInterpreterSessionsResponseDataResultOrganizationUsageImagesResult struct{…}The aggregated images usage details of the specific time bucket.
-
Images int64The number of images processed.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageImagesResultconst OrganizationUsageImagesResultOrganizationUsageImagesResult OrganizationUsageImagesResult = "organization.usage.images.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Size stringWhen
group_by=size, this field provides the image size of the grouped usage result. -
Source stringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageCodeInterpreterSessionsResponseDataResultOrganizationUsageAudioSpeechesResult struct{…}The aggregated audio speeches usage details of the specific time bucket.
-
Characters int64The number of characters processed.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageAudioSpeechesResultconst OrganizationUsageAudioSpeechesResultOrganizationUsageAudioSpeechesResult OrganizationUsageAudioSpeechesResult = "organization.usage.audio_speeches.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageCodeInterpreterSessionsResponseDataResultOrganizationUsageAudioTranscriptionsResult struct{…}The aggregated audio transcriptions usage details of the specific time bucket.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageAudioTranscriptionsResultconst OrganizationUsageAudioTranscriptionsResultOrganizationUsageAudioTranscriptionsResult OrganizationUsageAudioTranscriptionsResult = "organization.usage.audio_transcriptions.result"
-
Seconds int64The number of seconds processed.
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageCodeInterpreterSessionsResponseDataResultOrganizationUsageVectorStoresResult struct{…}The aggregated vector stores usage details of the specific time bucket.
-
Object OrganizationUsageVectorStoresResultconst OrganizationUsageVectorStoresResultOrganizationUsageVectorStoresResult OrganizationUsageVectorStoresResult = "organization.usage.vector_stores.result"
-
UsageBytes int64The vector stores usage in bytes.
-
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
type AdminOrganizationUsageCodeInterpreterSessionsResponseDataResultOrganizationUsageCodeInterpreterSessionsResult struct{…}The aggregated code interpreter sessions usage details of the specific time bucket.
-
NumSessions int64The number of code interpreter sessions.
-
Object OrganizationUsageCodeInterpreterSessionsResultconst OrganizationUsageCodeInterpreterSessionsResultOrganizationUsageCodeInterpreterSessionsResult OrganizationUsageCodeInterpreterSessionsResult = "organization.usage.code_interpreter_sessions.result"
-
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
type AdminOrganizationUsageCodeInterpreterSessionsResponseDataResultOrganizationUsageFileSearchesResult struct{…}The aggregated file search calls usage details of the specific time bucket.
-
NumRequests int64The count of file search calls.
-
Object OrganizationUsageFileSearchesResultconst OrganizationUsageFileSearchesResultOrganizationUsageFileSearchesResult OrganizationUsageFileSearchesResult = "organization.usage.file_searches.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
VectorStoreID stringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
type AdminOrganizationUsageCodeInterpreterSessionsResponseDataResultOrganizationUsageWebSearchesResult struct{…}The aggregated web search calls usage details of the specific time bucket.
-
NumModelRequests int64The count of model requests.
-
NumRequests int64The count of web search calls.
-
Object OrganizationUsageWebSearchesResultconst OrganizationUsageWebSearchesResultOrganizationUsageWebSearchesResult OrganizationUsageWebSearchesResult = "organization.usage.web_searches.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
ContextLevel stringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageCodeInterpreterSessionsResponseDataResultOrganizationCostsResult struct{…}The aggregated costs details of the specific time bucket.
-
Object OrganizationCostsResultconst OrganizationCostsResultOrganizationCostsResult OrganizationCostsResult = "organization.costs.result"
-
Amount AdminOrganizationUsageCodeInterpreterSessionsResponseDataResultOrganizationCostsResultAmountThe monetary value in its associated currency.
-
Currency stringLowercase ISO-4217 currency e.g. "usd"
-
Value float64The numeric value of the cost.
-
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
LineItem stringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
Quantity float64When
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
StartTime int64
-
-
HasMore bool -
NextPage string -
Object Pageconst PagePage Page = "page"
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
response, err := client.Admin.Organization.Usage.CodeInterpreterSessions(context.TODO(), openai.AdminOrganizationUsageCodeInterpreterSessionsParams{
StartTime: 0,
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
Response
{
"data": [
{
"end_time": 0,
"object": "bucket",
"results": [
{
"input_tokens": 0,
"num_model_requests": 0,
"object": "organization.usage.completions.result",
"output_tokens": 0,
"api_key_id": "api_key_id",
"batch": true,
"input_audio_tokens": 0,
"input_cached_tokens": 0,
"model": "model",
"output_audio_tokens": 0,
"project_id": "project_id",
"service_tier": "service_tier",
"user_id": "user_id"
}
],
"start_time": 0
}
],
"has_more": true,
"next_page": "next_page",
"object": "page"
}
Completions
client.Admin.Organization.Usage.Completions(ctx, query) (*AdminOrganizationUsageCompletionsResponse, error)
get /organization/usage/completions
Get completions usage details for the organization.
Parameters
-
query AdminOrganizationUsageCompletionsParams-
StartTime param.Field[int64]Start time (Unix seconds) of the query time range, inclusive.
-
APIKeyIDs param.Field[[]string]Return only usage for these API keys.
-
Batch param.Field[bool]If
true, return batch jobs only. Iffalse, return non-batch jobs only. By default, return both. -
BucketWidth param.Field[AdminOrganizationUsageCompletionsParamsBucketWidth]Width of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
const AdminOrganizationUsageCompletionsParamsBucketWidth1m AdminOrganizationUsageCompletionsParamsBucketWidth = "1m" -
const AdminOrganizationUsageCompletionsParamsBucketWidth1h AdminOrganizationUsageCompletionsParamsBucketWidth = "1h" -
const AdminOrganizationUsageCompletionsParamsBucketWidth1d AdminOrganizationUsageCompletionsParamsBucketWidth = "1d"
-
-
EndTime param.Field[int64]End time (Unix seconds) of the query time range, exclusive.
-
GroupBy param.Field[[]string]Group the usage data by the specified fields. Support fields include
project_id,user_id,api_key_id,model,batch,service_tieror any combination of them.-
const AdminOrganizationUsageCompletionsParamsGroupByProjectID AdminOrganizationUsageCompletionsParamsGroupBy = "project_id" -
const AdminOrganizationUsageCompletionsParamsGroupByUserID AdminOrganizationUsageCompletionsParamsGroupBy = "user_id" -
const AdminOrganizationUsageCompletionsParamsGroupByAPIKeyID AdminOrganizationUsageCompletionsParamsGroupBy = "api_key_id" -
const AdminOrganizationUsageCompletionsParamsGroupByModel AdminOrganizationUsageCompletionsParamsGroupBy = "model" -
const AdminOrganizationUsageCompletionsParamsGroupByBatch AdminOrganizationUsageCompletionsParamsGroupBy = "batch" -
const AdminOrganizationUsageCompletionsParamsGroupByServiceTier AdminOrganizationUsageCompletionsParamsGroupBy = "service_tier"
-
-
Limit param.Field[int64]Specifies the number of buckets to return.
bucket_width=1d: default: 7, max: 31bucket_width=1h: default: 24, max: 168bucket_width=1m: default: 60, max: 1440
-
Models param.Field[[]string]Return only usage for these models.
-
Page param.Field[string]A cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
ProjectIDs param.Field[[]string]Return only usage for these projects.
-
UserIDs param.Field[[]string]Return only usage for these users.
-
Returns
-
type AdminOrganizationUsageCompletionsResponse struct{…}-
Data []AdminOrganizationUsageCompletionsResponseData-
EndTime int64 -
Object Bucketconst BucketBucket Bucket = "bucket"
-
Results []AdminOrganizationUsageCompletionsResponseDataResultUnion-
type AdminOrganizationUsageCompletionsResponseDataResultOrganizationUsageCompletionsResult struct{…}The aggregated completions usage details of the specific time bucket.
-
InputTokens int64The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageCompletionsResultconst OrganizationUsageCompletionsResultOrganizationUsageCompletionsResult OrganizationUsageCompletionsResult = "organization.usage.completions.result"
-
OutputTokens int64The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Batch boolWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
InputAudioTokens int64The aggregated number of audio input tokens used, including cached tokens.
-
InputCachedTokens int64The aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
OutputAudioTokens int64The aggregated number of audio output tokens used.
-
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
ServiceTier stringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageCompletionsResponseDataResultOrganizationUsageEmbeddingsResult struct{…}The aggregated embeddings usage details of the specific time bucket.
-
InputTokens int64The aggregated number of input tokens used.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageEmbeddingsResultconst OrganizationUsageEmbeddingsResultOrganizationUsageEmbeddingsResult OrganizationUsageEmbeddingsResult = "organization.usage.embeddings.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageCompletionsResponseDataResultOrganizationUsageModerationsResult struct{…}The aggregated moderations usage details of the specific time bucket.
-
InputTokens int64The aggregated number of input tokens used.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageModerationsResultconst OrganizationUsageModerationsResultOrganizationUsageModerationsResult OrganizationUsageModerationsResult = "organization.usage.moderations.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageCompletionsResponseDataResultOrganizationUsageImagesResult struct{…}The aggregated images usage details of the specific time bucket.
-
Images int64The number of images processed.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageImagesResultconst OrganizationUsageImagesResultOrganizationUsageImagesResult OrganizationUsageImagesResult = "organization.usage.images.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Size stringWhen
group_by=size, this field provides the image size of the grouped usage result. -
Source stringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageCompletionsResponseDataResultOrganizationUsageAudioSpeechesResult struct{…}The aggregated audio speeches usage details of the specific time bucket.
-
Characters int64The number of characters processed.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageAudioSpeechesResultconst OrganizationUsageAudioSpeechesResultOrganizationUsageAudioSpeechesResult OrganizationUsageAudioSpeechesResult = "organization.usage.audio_speeches.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageCompletionsResponseDataResultOrganizationUsageAudioTranscriptionsResult struct{…}The aggregated audio transcriptions usage details of the specific time bucket.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageAudioTranscriptionsResultconst OrganizationUsageAudioTranscriptionsResultOrganizationUsageAudioTranscriptionsResult OrganizationUsageAudioTranscriptionsResult = "organization.usage.audio_transcriptions.result"
-
Seconds int64The number of seconds processed.
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageCompletionsResponseDataResultOrganizationUsageVectorStoresResult struct{…}The aggregated vector stores usage details of the specific time bucket.
-
Object OrganizationUsageVectorStoresResultconst OrganizationUsageVectorStoresResultOrganizationUsageVectorStoresResult OrganizationUsageVectorStoresResult = "organization.usage.vector_stores.result"
-
UsageBytes int64The vector stores usage in bytes.
-
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
type AdminOrganizationUsageCompletionsResponseDataResultOrganizationUsageCodeInterpreterSessionsResult struct{…}The aggregated code interpreter sessions usage details of the specific time bucket.
-
NumSessions int64The number of code interpreter sessions.
-
Object OrganizationUsageCodeInterpreterSessionsResultconst OrganizationUsageCodeInterpreterSessionsResultOrganizationUsageCodeInterpreterSessionsResult OrganizationUsageCodeInterpreterSessionsResult = "organization.usage.code_interpreter_sessions.result"
-
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
type AdminOrganizationUsageCompletionsResponseDataResultOrganizationUsageFileSearchesResult struct{…}The aggregated file search calls usage details of the specific time bucket.
-
NumRequests int64The count of file search calls.
-
Object OrganizationUsageFileSearchesResultconst OrganizationUsageFileSearchesResultOrganizationUsageFileSearchesResult OrganizationUsageFileSearchesResult = "organization.usage.file_searches.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
VectorStoreID stringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
type AdminOrganizationUsageCompletionsResponseDataResultOrganizationUsageWebSearchesResult struct{…}The aggregated web search calls usage details of the specific time bucket.
-
NumModelRequests int64The count of model requests.
-
NumRequests int64The count of web search calls.
-
Object OrganizationUsageWebSearchesResultconst OrganizationUsageWebSearchesResultOrganizationUsageWebSearchesResult OrganizationUsageWebSearchesResult = "organization.usage.web_searches.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
ContextLevel stringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageCompletionsResponseDataResultOrganizationCostsResult struct{…}The aggregated costs details of the specific time bucket.
-
Object OrganizationCostsResultconst OrganizationCostsResultOrganizationCostsResult OrganizationCostsResult = "organization.costs.result"
-
Amount AdminOrganizationUsageCompletionsResponseDataResultOrganizationCostsResultAmountThe monetary value in its associated currency.
-
Currency stringLowercase ISO-4217 currency e.g. "usd"
-
Value float64The numeric value of the cost.
-
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
LineItem stringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
Quantity float64When
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
StartTime int64
-
-
HasMore bool -
NextPage string -
Object Pageconst PagePage Page = "page"
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
response, err := client.Admin.Organization.Usage.Completions(context.TODO(), openai.AdminOrganizationUsageCompletionsParams{
StartTime: 0,
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
Response
{
"data": [
{
"end_time": 0,
"object": "bucket",
"results": [
{
"input_tokens": 0,
"num_model_requests": 0,
"object": "organization.usage.completions.result",
"output_tokens": 0,
"api_key_id": "api_key_id",
"batch": true,
"input_audio_tokens": 0,
"input_cached_tokens": 0,
"model": "model",
"output_audio_tokens": 0,
"project_id": "project_id",
"service_tier": "service_tier",
"user_id": "user_id"
}
],
"start_time": 0
}
],
"has_more": true,
"next_page": "next_page",
"object": "page"
}
Embeddings
client.Admin.Organization.Usage.Embeddings(ctx, query) (*AdminOrganizationUsageEmbeddingsResponse, error)
get /organization/usage/embeddings
Get embeddings usage details for the organization.
Parameters
-
query AdminOrganizationUsageEmbeddingsParams-
StartTime param.Field[int64]Start time (Unix seconds) of the query time range, inclusive.
-
APIKeyIDs param.Field[[]string]Return only usage for these API keys.
-
BucketWidth param.Field[AdminOrganizationUsageEmbeddingsParamsBucketWidth]Width of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
const AdminOrganizationUsageEmbeddingsParamsBucketWidth1m AdminOrganizationUsageEmbeddingsParamsBucketWidth = "1m" -
const AdminOrganizationUsageEmbeddingsParamsBucketWidth1h AdminOrganizationUsageEmbeddingsParamsBucketWidth = "1h" -
const AdminOrganizationUsageEmbeddingsParamsBucketWidth1d AdminOrganizationUsageEmbeddingsParamsBucketWidth = "1d"
-
-
EndTime param.Field[int64]End time (Unix seconds) of the query time range, exclusive.
-
GroupBy param.Field[[]string]Group the usage data by the specified fields. Support fields include
project_id,user_id,api_key_id,modelor any combination of them.-
const AdminOrganizationUsageEmbeddingsParamsGroupByProjectID AdminOrganizationUsageEmbeddingsParamsGroupBy = "project_id" -
const AdminOrganizationUsageEmbeddingsParamsGroupByUserID AdminOrganizationUsageEmbeddingsParamsGroupBy = "user_id" -
const AdminOrganizationUsageEmbeddingsParamsGroupByAPIKeyID AdminOrganizationUsageEmbeddingsParamsGroupBy = "api_key_id" -
const AdminOrganizationUsageEmbeddingsParamsGroupByModel AdminOrganizationUsageEmbeddingsParamsGroupBy = "model"
-
-
Limit param.Field[int64]Specifies the number of buckets to return.
bucket_width=1d: default: 7, max: 31bucket_width=1h: default: 24, max: 168bucket_width=1m: default: 60, max: 1440
-
Models param.Field[[]string]Return only usage for these models.
-
Page param.Field[string]A cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
ProjectIDs param.Field[[]string]Return only usage for these projects.
-
UserIDs param.Field[[]string]Return only usage for these users.
-
Returns
-
type AdminOrganizationUsageEmbeddingsResponse struct{…}-
Data []AdminOrganizationUsageEmbeddingsResponseData-
EndTime int64 -
Object Bucketconst BucketBucket Bucket = "bucket"
-
Results []AdminOrganizationUsageEmbeddingsResponseDataResultUnion-
type AdminOrganizationUsageEmbeddingsResponseDataResultOrganizationUsageCompletionsResult struct{…}The aggregated completions usage details of the specific time bucket.
-
InputTokens int64The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageCompletionsResultconst OrganizationUsageCompletionsResultOrganizationUsageCompletionsResult OrganizationUsageCompletionsResult = "organization.usage.completions.result"
-
OutputTokens int64The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Batch boolWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
InputAudioTokens int64The aggregated number of audio input tokens used, including cached tokens.
-
InputCachedTokens int64The aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
OutputAudioTokens int64The aggregated number of audio output tokens used.
-
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
ServiceTier stringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageEmbeddingsResponseDataResultOrganizationUsageEmbeddingsResult struct{…}The aggregated embeddings usage details of the specific time bucket.
-
InputTokens int64The aggregated number of input tokens used.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageEmbeddingsResultconst OrganizationUsageEmbeddingsResultOrganizationUsageEmbeddingsResult OrganizationUsageEmbeddingsResult = "organization.usage.embeddings.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageEmbeddingsResponseDataResultOrganizationUsageModerationsResult struct{…}The aggregated moderations usage details of the specific time bucket.
-
InputTokens int64The aggregated number of input tokens used.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageModerationsResultconst OrganizationUsageModerationsResultOrganizationUsageModerationsResult OrganizationUsageModerationsResult = "organization.usage.moderations.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageEmbeddingsResponseDataResultOrganizationUsageImagesResult struct{…}The aggregated images usage details of the specific time bucket.
-
Images int64The number of images processed.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageImagesResultconst OrganizationUsageImagesResultOrganizationUsageImagesResult OrganizationUsageImagesResult = "organization.usage.images.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Size stringWhen
group_by=size, this field provides the image size of the grouped usage result. -
Source stringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageEmbeddingsResponseDataResultOrganizationUsageAudioSpeechesResult struct{…}The aggregated audio speeches usage details of the specific time bucket.
-
Characters int64The number of characters processed.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageAudioSpeechesResultconst OrganizationUsageAudioSpeechesResultOrganizationUsageAudioSpeechesResult OrganizationUsageAudioSpeechesResult = "organization.usage.audio_speeches.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageEmbeddingsResponseDataResultOrganizationUsageAudioTranscriptionsResult struct{…}The aggregated audio transcriptions usage details of the specific time bucket.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageAudioTranscriptionsResultconst OrganizationUsageAudioTranscriptionsResultOrganizationUsageAudioTranscriptionsResult OrganizationUsageAudioTranscriptionsResult = "organization.usage.audio_transcriptions.result"
-
Seconds int64The number of seconds processed.
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageEmbeddingsResponseDataResultOrganizationUsageVectorStoresResult struct{…}The aggregated vector stores usage details of the specific time bucket.
-
Object OrganizationUsageVectorStoresResultconst OrganizationUsageVectorStoresResultOrganizationUsageVectorStoresResult OrganizationUsageVectorStoresResult = "organization.usage.vector_stores.result"
-
UsageBytes int64The vector stores usage in bytes.
-
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
type AdminOrganizationUsageEmbeddingsResponseDataResultOrganizationUsageCodeInterpreterSessionsResult struct{…}The aggregated code interpreter sessions usage details of the specific time bucket.
-
NumSessions int64The number of code interpreter sessions.
-
Object OrganizationUsageCodeInterpreterSessionsResultconst OrganizationUsageCodeInterpreterSessionsResultOrganizationUsageCodeInterpreterSessionsResult OrganizationUsageCodeInterpreterSessionsResult = "organization.usage.code_interpreter_sessions.result"
-
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
type AdminOrganizationUsageEmbeddingsResponseDataResultOrganizationUsageFileSearchesResult struct{…}The aggregated file search calls usage details of the specific time bucket.
-
NumRequests int64The count of file search calls.
-
Object OrganizationUsageFileSearchesResultconst OrganizationUsageFileSearchesResultOrganizationUsageFileSearchesResult OrganizationUsageFileSearchesResult = "organization.usage.file_searches.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
VectorStoreID stringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
type AdminOrganizationUsageEmbeddingsResponseDataResultOrganizationUsageWebSearchesResult struct{…}The aggregated web search calls usage details of the specific time bucket.
-
NumModelRequests int64The count of model requests.
-
NumRequests int64The count of web search calls.
-
Object OrganizationUsageWebSearchesResultconst OrganizationUsageWebSearchesResultOrganizationUsageWebSearchesResult OrganizationUsageWebSearchesResult = "organization.usage.web_searches.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
ContextLevel stringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageEmbeddingsResponseDataResultOrganizationCostsResult struct{…}The aggregated costs details of the specific time bucket.
-
Object OrganizationCostsResultconst OrganizationCostsResultOrganizationCostsResult OrganizationCostsResult = "organization.costs.result"
-
Amount AdminOrganizationUsageEmbeddingsResponseDataResultOrganizationCostsResultAmountThe monetary value in its associated currency.
-
Currency stringLowercase ISO-4217 currency e.g. "usd"
-
Value float64The numeric value of the cost.
-
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
LineItem stringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
Quantity float64When
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
StartTime int64
-
-
HasMore bool -
NextPage string -
Object Pageconst PagePage Page = "page"
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
response, err := client.Admin.Organization.Usage.Embeddings(context.TODO(), openai.AdminOrganizationUsageEmbeddingsParams{
StartTime: 0,
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
Response
{
"data": [
{
"end_time": 0,
"object": "bucket",
"results": [
{
"input_tokens": 0,
"num_model_requests": 0,
"object": "organization.usage.completions.result",
"output_tokens": 0,
"api_key_id": "api_key_id",
"batch": true,
"input_audio_tokens": 0,
"input_cached_tokens": 0,
"model": "model",
"output_audio_tokens": 0,
"project_id": "project_id",
"service_tier": "service_tier",
"user_id": "user_id"
}
],
"start_time": 0
}
],
"has_more": true,
"next_page": "next_page",
"object": "page"
}
Images
client.Admin.Organization.Usage.Images(ctx, query) (*AdminOrganizationUsageImagesResponse, error)
get /organization/usage/images
Get images usage details for the organization.
Parameters
-
query AdminOrganizationUsageImagesParams-
StartTime param.Field[int64]Start time (Unix seconds) of the query time range, inclusive.
-
APIKeyIDs param.Field[[]string]Return only usage for these API keys.
-
BucketWidth param.Field[AdminOrganizationUsageImagesParamsBucketWidth]Width of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
const AdminOrganizationUsageImagesParamsBucketWidth1m AdminOrganizationUsageImagesParamsBucketWidth = "1m" -
const AdminOrganizationUsageImagesParamsBucketWidth1h AdminOrganizationUsageImagesParamsBucketWidth = "1h" -
const AdminOrganizationUsageImagesParamsBucketWidth1d AdminOrganizationUsageImagesParamsBucketWidth = "1d"
-
-
EndTime param.Field[int64]End time (Unix seconds) of the query time range, exclusive.
-
GroupBy param.Field[[]string]Group the usage data by the specified fields. Support fields include
project_id,user_id,api_key_id,model,size,sourceor any combination of them.-
const AdminOrganizationUsageImagesParamsGroupByProjectID AdminOrganizationUsageImagesParamsGroupBy = "project_id" -
const AdminOrganizationUsageImagesParamsGroupByUserID AdminOrganizationUsageImagesParamsGroupBy = "user_id" -
const AdminOrganizationUsageImagesParamsGroupByAPIKeyID AdminOrganizationUsageImagesParamsGroupBy = "api_key_id" -
const AdminOrganizationUsageImagesParamsGroupByModel AdminOrganizationUsageImagesParamsGroupBy = "model" -
const AdminOrganizationUsageImagesParamsGroupBySize AdminOrganizationUsageImagesParamsGroupBy = "size" -
const AdminOrganizationUsageImagesParamsGroupBySource AdminOrganizationUsageImagesParamsGroupBy = "source"
-
-
Limit param.Field[int64]Specifies the number of buckets to return.
bucket_width=1d: default: 7, max: 31bucket_width=1h: default: 24, max: 168bucket_width=1m: default: 60, max: 1440
-
Models param.Field[[]string]Return only usage for these models.
-
Page param.Field[string]A cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
ProjectIDs param.Field[[]string]Return only usage for these projects.
-
Sizes param.Field[[]string]Return only usages for these image sizes. Possible values are
256x256,512x512,1024x1024,1792x1792,1024x1792or any combination of them.-
const AdminOrganizationUsageImagesParamsSize256x256 AdminOrganizationUsageImagesParamsSize = "256x256" -
const AdminOrganizationUsageImagesParamsSize512x512 AdminOrganizationUsageImagesParamsSize = "512x512" -
const AdminOrganizationUsageImagesParamsSize1024x1024 AdminOrganizationUsageImagesParamsSize = "1024x1024" -
const AdminOrganizationUsageImagesParamsSize1792x1792 AdminOrganizationUsageImagesParamsSize = "1792x1792" -
const AdminOrganizationUsageImagesParamsSize1024x1792 AdminOrganizationUsageImagesParamsSize = "1024x1792"
-
-
Sources param.Field[[]string]Return only usages for these sources. Possible values are
image.generation,image.edit,image.variationor any combination of them.-
const AdminOrganizationUsageImagesParamsSourceImageGeneration AdminOrganizationUsageImagesParamsSource = "image.generation" -
const AdminOrganizationUsageImagesParamsSourceImageEdit AdminOrganizationUsageImagesParamsSource = "image.edit" -
const AdminOrganizationUsageImagesParamsSourceImageVariation AdminOrganizationUsageImagesParamsSource = "image.variation"
-
-
UserIDs param.Field[[]string]Return only usage for these users.
-
Returns
-
type AdminOrganizationUsageImagesResponse struct{…}-
Data []AdminOrganizationUsageImagesResponseData-
EndTime int64 -
Object Bucketconst BucketBucket Bucket = "bucket"
-
Results []AdminOrganizationUsageImagesResponseDataResultUnion-
type AdminOrganizationUsageImagesResponseDataResultOrganizationUsageCompletionsResult struct{…}The aggregated completions usage details of the specific time bucket.
-
InputTokens int64The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageCompletionsResultconst OrganizationUsageCompletionsResultOrganizationUsageCompletionsResult OrganizationUsageCompletionsResult = "organization.usage.completions.result"
-
OutputTokens int64The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Batch boolWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
InputAudioTokens int64The aggregated number of audio input tokens used, including cached tokens.
-
InputCachedTokens int64The aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
OutputAudioTokens int64The aggregated number of audio output tokens used.
-
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
ServiceTier stringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageImagesResponseDataResultOrganizationUsageEmbeddingsResult struct{…}The aggregated embeddings usage details of the specific time bucket.
-
InputTokens int64The aggregated number of input tokens used.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageEmbeddingsResultconst OrganizationUsageEmbeddingsResultOrganizationUsageEmbeddingsResult OrganizationUsageEmbeddingsResult = "organization.usage.embeddings.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageImagesResponseDataResultOrganizationUsageModerationsResult struct{…}The aggregated moderations usage details of the specific time bucket.
-
InputTokens int64The aggregated number of input tokens used.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageModerationsResultconst OrganizationUsageModerationsResultOrganizationUsageModerationsResult OrganizationUsageModerationsResult = "organization.usage.moderations.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageImagesResponseDataResultOrganizationUsageImagesResult struct{…}The aggregated images usage details of the specific time bucket.
-
Images int64The number of images processed.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageImagesResultconst OrganizationUsageImagesResultOrganizationUsageImagesResult OrganizationUsageImagesResult = "organization.usage.images.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Size stringWhen
group_by=size, this field provides the image size of the grouped usage result. -
Source stringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageImagesResponseDataResultOrganizationUsageAudioSpeechesResult struct{…}The aggregated audio speeches usage details of the specific time bucket.
-
Characters int64The number of characters processed.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageAudioSpeechesResultconst OrganizationUsageAudioSpeechesResultOrganizationUsageAudioSpeechesResult OrganizationUsageAudioSpeechesResult = "organization.usage.audio_speeches.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageImagesResponseDataResultOrganizationUsageAudioTranscriptionsResult struct{…}The aggregated audio transcriptions usage details of the specific time bucket.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageAudioTranscriptionsResultconst OrganizationUsageAudioTranscriptionsResultOrganizationUsageAudioTranscriptionsResult OrganizationUsageAudioTranscriptionsResult = "organization.usage.audio_transcriptions.result"
-
Seconds int64The number of seconds processed.
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageImagesResponseDataResultOrganizationUsageVectorStoresResult struct{…}The aggregated vector stores usage details of the specific time bucket.
-
Object OrganizationUsageVectorStoresResultconst OrganizationUsageVectorStoresResultOrganizationUsageVectorStoresResult OrganizationUsageVectorStoresResult = "organization.usage.vector_stores.result"
-
UsageBytes int64The vector stores usage in bytes.
-
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
type AdminOrganizationUsageImagesResponseDataResultOrganizationUsageCodeInterpreterSessionsResult struct{…}The aggregated code interpreter sessions usage details of the specific time bucket.
-
NumSessions int64The number of code interpreter sessions.
-
Object OrganizationUsageCodeInterpreterSessionsResultconst OrganizationUsageCodeInterpreterSessionsResultOrganizationUsageCodeInterpreterSessionsResult OrganizationUsageCodeInterpreterSessionsResult = "organization.usage.code_interpreter_sessions.result"
-
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
type AdminOrganizationUsageImagesResponseDataResultOrganizationUsageFileSearchesResult struct{…}The aggregated file search calls usage details of the specific time bucket.
-
NumRequests int64The count of file search calls.
-
Object OrganizationUsageFileSearchesResultconst OrganizationUsageFileSearchesResultOrganizationUsageFileSearchesResult OrganizationUsageFileSearchesResult = "organization.usage.file_searches.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
VectorStoreID stringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
type AdminOrganizationUsageImagesResponseDataResultOrganizationUsageWebSearchesResult struct{…}The aggregated web search calls usage details of the specific time bucket.
-
NumModelRequests int64The count of model requests.
-
NumRequests int64The count of web search calls.
-
Object OrganizationUsageWebSearchesResultconst OrganizationUsageWebSearchesResultOrganizationUsageWebSearchesResult OrganizationUsageWebSearchesResult = "organization.usage.web_searches.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
ContextLevel stringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageImagesResponseDataResultOrganizationCostsResult struct{…}The aggregated costs details of the specific time bucket.
-
Object OrganizationCostsResultconst OrganizationCostsResultOrganizationCostsResult OrganizationCostsResult = "organization.costs.result"
-
Amount AdminOrganizationUsageImagesResponseDataResultOrganizationCostsResultAmountThe monetary value in its associated currency.
-
Currency stringLowercase ISO-4217 currency e.g. "usd"
-
Value float64The numeric value of the cost.
-
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
LineItem stringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
Quantity float64When
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
StartTime int64
-
-
HasMore bool -
NextPage string -
Object Pageconst PagePage Page = "page"
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
response, err := client.Admin.Organization.Usage.Images(context.TODO(), openai.AdminOrganizationUsageImagesParams{
StartTime: 0,
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
Response
{
"data": [
{
"end_time": 0,
"object": "bucket",
"results": [
{
"input_tokens": 0,
"num_model_requests": 0,
"object": "organization.usage.completions.result",
"output_tokens": 0,
"api_key_id": "api_key_id",
"batch": true,
"input_audio_tokens": 0,
"input_cached_tokens": 0,
"model": "model",
"output_audio_tokens": 0,
"project_id": "project_id",
"service_tier": "service_tier",
"user_id": "user_id"
}
],
"start_time": 0
}
],
"has_more": true,
"next_page": "next_page",
"object": "page"
}
Moderations
client.Admin.Organization.Usage.Moderations(ctx, query) (*AdminOrganizationUsageModerationsResponse, error)
get /organization/usage/moderations
Get moderations usage details for the organization.
Parameters
-
query AdminOrganizationUsageModerationsParams-
StartTime param.Field[int64]Start time (Unix seconds) of the query time range, inclusive.
-
APIKeyIDs param.Field[[]string]Return only usage for these API keys.
-
BucketWidth param.Field[AdminOrganizationUsageModerationsParamsBucketWidth]Width of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
const AdminOrganizationUsageModerationsParamsBucketWidth1m AdminOrganizationUsageModerationsParamsBucketWidth = "1m" -
const AdminOrganizationUsageModerationsParamsBucketWidth1h AdminOrganizationUsageModerationsParamsBucketWidth = "1h" -
const AdminOrganizationUsageModerationsParamsBucketWidth1d AdminOrganizationUsageModerationsParamsBucketWidth = "1d"
-
-
EndTime param.Field[int64]End time (Unix seconds) of the query time range, exclusive.
-
GroupBy param.Field[[]string]Group the usage data by the specified fields. Support fields include
project_id,user_id,api_key_id,modelor any combination of them.-
const AdminOrganizationUsageModerationsParamsGroupByProjectID AdminOrganizationUsageModerationsParamsGroupBy = "project_id" -
const AdminOrganizationUsageModerationsParamsGroupByUserID AdminOrganizationUsageModerationsParamsGroupBy = "user_id" -
const AdminOrganizationUsageModerationsParamsGroupByAPIKeyID AdminOrganizationUsageModerationsParamsGroupBy = "api_key_id" -
const AdminOrganizationUsageModerationsParamsGroupByModel AdminOrganizationUsageModerationsParamsGroupBy = "model"
-
-
Limit param.Field[int64]Specifies the number of buckets to return.
bucket_width=1d: default: 7, max: 31bucket_width=1h: default: 24, max: 168bucket_width=1m: default: 60, max: 1440
-
Models param.Field[[]string]Return only usage for these models.
-
Page param.Field[string]A cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
ProjectIDs param.Field[[]string]Return only usage for these projects.
-
UserIDs param.Field[[]string]Return only usage for these users.
-
Returns
-
type AdminOrganizationUsageModerationsResponse struct{…}-
Data []AdminOrganizationUsageModerationsResponseData-
EndTime int64 -
Object Bucketconst BucketBucket Bucket = "bucket"
-
Results []AdminOrganizationUsageModerationsResponseDataResultUnion-
type AdminOrganizationUsageModerationsResponseDataResultOrganizationUsageCompletionsResult struct{…}The aggregated completions usage details of the specific time bucket.
-
InputTokens int64The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageCompletionsResultconst OrganizationUsageCompletionsResultOrganizationUsageCompletionsResult OrganizationUsageCompletionsResult = "organization.usage.completions.result"
-
OutputTokens int64The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Batch boolWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
InputAudioTokens int64The aggregated number of audio input tokens used, including cached tokens.
-
InputCachedTokens int64The aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
OutputAudioTokens int64The aggregated number of audio output tokens used.
-
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
ServiceTier stringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageModerationsResponseDataResultOrganizationUsageEmbeddingsResult struct{…}The aggregated embeddings usage details of the specific time bucket.
-
InputTokens int64The aggregated number of input tokens used.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageEmbeddingsResultconst OrganizationUsageEmbeddingsResultOrganizationUsageEmbeddingsResult OrganizationUsageEmbeddingsResult = "organization.usage.embeddings.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageModerationsResponseDataResultOrganizationUsageModerationsResult struct{…}The aggregated moderations usage details of the specific time bucket.
-
InputTokens int64The aggregated number of input tokens used.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageModerationsResultconst OrganizationUsageModerationsResultOrganizationUsageModerationsResult OrganizationUsageModerationsResult = "organization.usage.moderations.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageModerationsResponseDataResultOrganizationUsageImagesResult struct{…}The aggregated images usage details of the specific time bucket.
-
Images int64The number of images processed.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageImagesResultconst OrganizationUsageImagesResultOrganizationUsageImagesResult OrganizationUsageImagesResult = "organization.usage.images.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Size stringWhen
group_by=size, this field provides the image size of the grouped usage result. -
Source stringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageModerationsResponseDataResultOrganizationUsageAudioSpeechesResult struct{…}The aggregated audio speeches usage details of the specific time bucket.
-
Characters int64The number of characters processed.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageAudioSpeechesResultconst OrganizationUsageAudioSpeechesResultOrganizationUsageAudioSpeechesResult OrganizationUsageAudioSpeechesResult = "organization.usage.audio_speeches.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageModerationsResponseDataResultOrganizationUsageAudioTranscriptionsResult struct{…}The aggregated audio transcriptions usage details of the specific time bucket.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageAudioTranscriptionsResultconst OrganizationUsageAudioTranscriptionsResultOrganizationUsageAudioTranscriptionsResult OrganizationUsageAudioTranscriptionsResult = "organization.usage.audio_transcriptions.result"
-
Seconds int64The number of seconds processed.
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageModerationsResponseDataResultOrganizationUsageVectorStoresResult struct{…}The aggregated vector stores usage details of the specific time bucket.
-
Object OrganizationUsageVectorStoresResultconst OrganizationUsageVectorStoresResultOrganizationUsageVectorStoresResult OrganizationUsageVectorStoresResult = "organization.usage.vector_stores.result"
-
UsageBytes int64The vector stores usage in bytes.
-
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
type AdminOrganizationUsageModerationsResponseDataResultOrganizationUsageCodeInterpreterSessionsResult struct{…}The aggregated code interpreter sessions usage details of the specific time bucket.
-
NumSessions int64The number of code interpreter sessions.
-
Object OrganizationUsageCodeInterpreterSessionsResultconst OrganizationUsageCodeInterpreterSessionsResultOrganizationUsageCodeInterpreterSessionsResult OrganizationUsageCodeInterpreterSessionsResult = "organization.usage.code_interpreter_sessions.result"
-
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
type AdminOrganizationUsageModerationsResponseDataResultOrganizationUsageFileSearchesResult struct{…}The aggregated file search calls usage details of the specific time bucket.
-
NumRequests int64The count of file search calls.
-
Object OrganizationUsageFileSearchesResultconst OrganizationUsageFileSearchesResultOrganizationUsageFileSearchesResult OrganizationUsageFileSearchesResult = "organization.usage.file_searches.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
VectorStoreID stringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
type AdminOrganizationUsageModerationsResponseDataResultOrganizationUsageWebSearchesResult struct{…}The aggregated web search calls usage details of the specific time bucket.
-
NumModelRequests int64The count of model requests.
-
NumRequests int64The count of web search calls.
-
Object OrganizationUsageWebSearchesResultconst OrganizationUsageWebSearchesResultOrganizationUsageWebSearchesResult OrganizationUsageWebSearchesResult = "organization.usage.web_searches.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
ContextLevel stringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageModerationsResponseDataResultOrganizationCostsResult struct{…}The aggregated costs details of the specific time bucket.
-
Object OrganizationCostsResultconst OrganizationCostsResultOrganizationCostsResult OrganizationCostsResult = "organization.costs.result"
-
Amount AdminOrganizationUsageModerationsResponseDataResultOrganizationCostsResultAmountThe monetary value in its associated currency.
-
Currency stringLowercase ISO-4217 currency e.g. "usd"
-
Value float64The numeric value of the cost.
-
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
LineItem stringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
Quantity float64When
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
StartTime int64
-
-
HasMore bool -
NextPage string -
Object Pageconst PagePage Page = "page"
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
response, err := client.Admin.Organization.Usage.Moderations(context.TODO(), openai.AdminOrganizationUsageModerationsParams{
StartTime: 0,
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
Response
{
"data": [
{
"end_time": 0,
"object": "bucket",
"results": [
{
"input_tokens": 0,
"num_model_requests": 0,
"object": "organization.usage.completions.result",
"output_tokens": 0,
"api_key_id": "api_key_id",
"batch": true,
"input_audio_tokens": 0,
"input_cached_tokens": 0,
"model": "model",
"output_audio_tokens": 0,
"project_id": "project_id",
"service_tier": "service_tier",
"user_id": "user_id"
}
],
"start_time": 0
}
],
"has_more": true,
"next_page": "next_page",
"object": "page"
}
Vector stores
client.Admin.Organization.Usage.VectorStores(ctx, query) (*AdminOrganizationUsageVectorStoresResponse, error)
get /organization/usage/vector_stores
Get vector stores usage details for the organization.
Parameters
-
query AdminOrganizationUsageVectorStoresParams-
StartTime param.Field[int64]Start time (Unix seconds) of the query time range, inclusive.
-
BucketWidth param.Field[AdminOrganizationUsageVectorStoresParamsBucketWidth]Width of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
const AdminOrganizationUsageVectorStoresParamsBucketWidth1m AdminOrganizationUsageVectorStoresParamsBucketWidth = "1m" -
const AdminOrganizationUsageVectorStoresParamsBucketWidth1h AdminOrganizationUsageVectorStoresParamsBucketWidth = "1h" -
const AdminOrganizationUsageVectorStoresParamsBucketWidth1d AdminOrganizationUsageVectorStoresParamsBucketWidth = "1d"
-
-
EndTime param.Field[int64]End time (Unix seconds) of the query time range, exclusive.
-
GroupBy param.Field[[]string]Group the usage data by the specified fields. Support fields include
project_id.const AdminOrganizationUsageVectorStoresParamsGroupByProjectID AdminOrganizationUsageVectorStoresParamsGroupBy = "project_id"
-
Limit param.Field[int64]Specifies the number of buckets to return.
bucket_width=1d: default: 7, max: 31bucket_width=1h: default: 24, max: 168bucket_width=1m: default: 60, max: 1440
-
Page param.Field[string]A cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
ProjectIDs param.Field[[]string]Return only usage for these projects.
-
Returns
-
type AdminOrganizationUsageVectorStoresResponse struct{…}-
Data []AdminOrganizationUsageVectorStoresResponseData-
EndTime int64 -
Object Bucketconst BucketBucket Bucket = "bucket"
-
Results []AdminOrganizationUsageVectorStoresResponseDataResultUnion-
type AdminOrganizationUsageVectorStoresResponseDataResultOrganizationUsageCompletionsResult struct{…}The aggregated completions usage details of the specific time bucket.
-
InputTokens int64The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageCompletionsResultconst OrganizationUsageCompletionsResultOrganizationUsageCompletionsResult OrganizationUsageCompletionsResult = "organization.usage.completions.result"
-
OutputTokens int64The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Batch boolWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
InputAudioTokens int64The aggregated number of audio input tokens used, including cached tokens.
-
InputCachedTokens int64The aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
OutputAudioTokens int64The aggregated number of audio output tokens used.
-
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
ServiceTier stringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageVectorStoresResponseDataResultOrganizationUsageEmbeddingsResult struct{…}The aggregated embeddings usage details of the specific time bucket.
-
InputTokens int64The aggregated number of input tokens used.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageEmbeddingsResultconst OrganizationUsageEmbeddingsResultOrganizationUsageEmbeddingsResult OrganizationUsageEmbeddingsResult = "organization.usage.embeddings.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageVectorStoresResponseDataResultOrganizationUsageModerationsResult struct{…}The aggregated moderations usage details of the specific time bucket.
-
InputTokens int64The aggregated number of input tokens used.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageModerationsResultconst OrganizationUsageModerationsResultOrganizationUsageModerationsResult OrganizationUsageModerationsResult = "organization.usage.moderations.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageVectorStoresResponseDataResultOrganizationUsageImagesResult struct{…}The aggregated images usage details of the specific time bucket.
-
Images int64The number of images processed.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageImagesResultconst OrganizationUsageImagesResultOrganizationUsageImagesResult OrganizationUsageImagesResult = "organization.usage.images.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Size stringWhen
group_by=size, this field provides the image size of the grouped usage result. -
Source stringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageVectorStoresResponseDataResultOrganizationUsageAudioSpeechesResult struct{…}The aggregated audio speeches usage details of the specific time bucket.
-
Characters int64The number of characters processed.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageAudioSpeechesResultconst OrganizationUsageAudioSpeechesResultOrganizationUsageAudioSpeechesResult OrganizationUsageAudioSpeechesResult = "organization.usage.audio_speeches.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageVectorStoresResponseDataResultOrganizationUsageAudioTranscriptionsResult struct{…}The aggregated audio transcriptions usage details of the specific time bucket.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageAudioTranscriptionsResultconst OrganizationUsageAudioTranscriptionsResultOrganizationUsageAudioTranscriptionsResult OrganizationUsageAudioTranscriptionsResult = "organization.usage.audio_transcriptions.result"
-
Seconds int64The number of seconds processed.
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageVectorStoresResponseDataResultOrganizationUsageVectorStoresResult struct{…}The aggregated vector stores usage details of the specific time bucket.
-
Object OrganizationUsageVectorStoresResultconst OrganizationUsageVectorStoresResultOrganizationUsageVectorStoresResult OrganizationUsageVectorStoresResult = "organization.usage.vector_stores.result"
-
UsageBytes int64The vector stores usage in bytes.
-
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
type AdminOrganizationUsageVectorStoresResponseDataResultOrganizationUsageCodeInterpreterSessionsResult struct{…}The aggregated code interpreter sessions usage details of the specific time bucket.
-
NumSessions int64The number of code interpreter sessions.
-
Object OrganizationUsageCodeInterpreterSessionsResultconst OrganizationUsageCodeInterpreterSessionsResultOrganizationUsageCodeInterpreterSessionsResult OrganizationUsageCodeInterpreterSessionsResult = "organization.usage.code_interpreter_sessions.result"
-
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
type AdminOrganizationUsageVectorStoresResponseDataResultOrganizationUsageFileSearchesResult struct{…}The aggregated file search calls usage details of the specific time bucket.
-
NumRequests int64The count of file search calls.
-
Object OrganizationUsageFileSearchesResultconst OrganizationUsageFileSearchesResultOrganizationUsageFileSearchesResult OrganizationUsageFileSearchesResult = "organization.usage.file_searches.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
VectorStoreID stringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
type AdminOrganizationUsageVectorStoresResponseDataResultOrganizationUsageWebSearchesResult struct{…}The aggregated web search calls usage details of the specific time bucket.
-
NumModelRequests int64The count of model requests.
-
NumRequests int64The count of web search calls.
-
Object OrganizationUsageWebSearchesResultconst OrganizationUsageWebSearchesResultOrganizationUsageWebSearchesResult OrganizationUsageWebSearchesResult = "organization.usage.web_searches.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
ContextLevel stringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageVectorStoresResponseDataResultOrganizationCostsResult struct{…}The aggregated costs details of the specific time bucket.
-
Object OrganizationCostsResultconst OrganizationCostsResultOrganizationCostsResult OrganizationCostsResult = "organization.costs.result"
-
Amount AdminOrganizationUsageVectorStoresResponseDataResultOrganizationCostsResultAmountThe monetary value in its associated currency.
-
Currency stringLowercase ISO-4217 currency e.g. "usd"
-
Value float64The numeric value of the cost.
-
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
LineItem stringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
Quantity float64When
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
StartTime int64
-
-
HasMore bool -
NextPage string -
Object Pageconst PagePage Page = "page"
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
response, err := client.Admin.Organization.Usage.VectorStores(context.TODO(), openai.AdminOrganizationUsageVectorStoresParams{
StartTime: 0,
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
Response
{
"data": [
{
"end_time": 0,
"object": "bucket",
"results": [
{
"input_tokens": 0,
"num_model_requests": 0,
"object": "organization.usage.completions.result",
"output_tokens": 0,
"api_key_id": "api_key_id",
"batch": true,
"input_audio_tokens": 0,
"input_cached_tokens": 0,
"model": "model",
"output_audio_tokens": 0,
"project_id": "project_id",
"service_tier": "service_tier",
"user_id": "user_id"
}
],
"start_time": 0
}
],
"has_more": true,
"next_page": "next_page",
"object": "page"
}
File search calls
client.Admin.Organization.Usage.FileSearchCalls(ctx, query) (*AdminOrganizationUsageFileSearchCallsResponse, error)
get /organization/usage/file_search_calls
Get file search calls usage details for the organization.
Parameters
-
query AdminOrganizationUsageFileSearchCallsParams-
StartTime param.Field[int64]Start time (Unix seconds) of the query time range, inclusive.
-
APIKeyIDs param.Field[[]string]Return only usage for these API keys.
-
BucketWidth param.Field[AdminOrganizationUsageFileSearchCallsParamsBucketWidth]Width of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
const AdminOrganizationUsageFileSearchCallsParamsBucketWidth1m AdminOrganizationUsageFileSearchCallsParamsBucketWidth = "1m" -
const AdminOrganizationUsageFileSearchCallsParamsBucketWidth1h AdminOrganizationUsageFileSearchCallsParamsBucketWidth = "1h" -
const AdminOrganizationUsageFileSearchCallsParamsBucketWidth1d AdminOrganizationUsageFileSearchCallsParamsBucketWidth = "1d"
-
-
EndTime param.Field[int64]End time (Unix seconds) of the query time range, exclusive.
-
GroupBy param.Field[[]string]Group the usage data by the specified fields. Support fields include
project_id,user_id,api_key_id,vector_store_idor any combination of them.-
const AdminOrganizationUsageFileSearchCallsParamsGroupByProjectID AdminOrganizationUsageFileSearchCallsParamsGroupBy = "project_id" -
const AdminOrganizationUsageFileSearchCallsParamsGroupByUserID AdminOrganizationUsageFileSearchCallsParamsGroupBy = "user_id" -
const AdminOrganizationUsageFileSearchCallsParamsGroupByAPIKeyID AdminOrganizationUsageFileSearchCallsParamsGroupBy = "api_key_id" -
const AdminOrganizationUsageFileSearchCallsParamsGroupByVectorStoreID AdminOrganizationUsageFileSearchCallsParamsGroupBy = "vector_store_id"
-
-
Limit param.Field[int64]Specifies the number of buckets to return.
bucket_width=1d: default: 7, max: 31bucket_width=1h: default: 24, max: 168bucket_width=1m: default: 60, max: 1440
-
Page param.Field[string]A cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
ProjectIDs param.Field[[]string]Return only usage for these projects.
-
UserIDs param.Field[[]string]Return only usage for these users.
-
VectorStoreIDs param.Field[[]string]Return only usage for these vector stores.
-
Returns
-
type AdminOrganizationUsageFileSearchCallsResponse struct{…}-
Data []AdminOrganizationUsageFileSearchCallsResponseData-
EndTime int64 -
Object Bucketconst BucketBucket Bucket = "bucket"
-
Results []AdminOrganizationUsageFileSearchCallsResponseDataResultUnion-
type AdminOrganizationUsageFileSearchCallsResponseDataResultOrganizationUsageCompletionsResult struct{…}The aggregated completions usage details of the specific time bucket.
-
InputTokens int64The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageCompletionsResultconst OrganizationUsageCompletionsResultOrganizationUsageCompletionsResult OrganizationUsageCompletionsResult = "organization.usage.completions.result"
-
OutputTokens int64The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Batch boolWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
InputAudioTokens int64The aggregated number of audio input tokens used, including cached tokens.
-
InputCachedTokens int64The aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
OutputAudioTokens int64The aggregated number of audio output tokens used.
-
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
ServiceTier stringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageFileSearchCallsResponseDataResultOrganizationUsageEmbeddingsResult struct{…}The aggregated embeddings usage details of the specific time bucket.
-
InputTokens int64The aggregated number of input tokens used.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageEmbeddingsResultconst OrganizationUsageEmbeddingsResultOrganizationUsageEmbeddingsResult OrganizationUsageEmbeddingsResult = "organization.usage.embeddings.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageFileSearchCallsResponseDataResultOrganizationUsageModerationsResult struct{…}The aggregated moderations usage details of the specific time bucket.
-
InputTokens int64The aggregated number of input tokens used.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageModerationsResultconst OrganizationUsageModerationsResultOrganizationUsageModerationsResult OrganizationUsageModerationsResult = "organization.usage.moderations.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageFileSearchCallsResponseDataResultOrganizationUsageImagesResult struct{…}The aggregated images usage details of the specific time bucket.
-
Images int64The number of images processed.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageImagesResultconst OrganizationUsageImagesResultOrganizationUsageImagesResult OrganizationUsageImagesResult = "organization.usage.images.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Size stringWhen
group_by=size, this field provides the image size of the grouped usage result. -
Source stringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageFileSearchCallsResponseDataResultOrganizationUsageAudioSpeechesResult struct{…}The aggregated audio speeches usage details of the specific time bucket.
-
Characters int64The number of characters processed.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageAudioSpeechesResultconst OrganizationUsageAudioSpeechesResultOrganizationUsageAudioSpeechesResult OrganizationUsageAudioSpeechesResult = "organization.usage.audio_speeches.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageFileSearchCallsResponseDataResultOrganizationUsageAudioTranscriptionsResult struct{…}The aggregated audio transcriptions usage details of the specific time bucket.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageAudioTranscriptionsResultconst OrganizationUsageAudioTranscriptionsResultOrganizationUsageAudioTranscriptionsResult OrganizationUsageAudioTranscriptionsResult = "organization.usage.audio_transcriptions.result"
-
Seconds int64The number of seconds processed.
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageFileSearchCallsResponseDataResultOrganizationUsageVectorStoresResult struct{…}The aggregated vector stores usage details of the specific time bucket.
-
Object OrganizationUsageVectorStoresResultconst OrganizationUsageVectorStoresResultOrganizationUsageVectorStoresResult OrganizationUsageVectorStoresResult = "organization.usage.vector_stores.result"
-
UsageBytes int64The vector stores usage in bytes.
-
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
type AdminOrganizationUsageFileSearchCallsResponseDataResultOrganizationUsageCodeInterpreterSessionsResult struct{…}The aggregated code interpreter sessions usage details of the specific time bucket.
-
NumSessions int64The number of code interpreter sessions.
-
Object OrganizationUsageCodeInterpreterSessionsResultconst OrganizationUsageCodeInterpreterSessionsResultOrganizationUsageCodeInterpreterSessionsResult OrganizationUsageCodeInterpreterSessionsResult = "organization.usage.code_interpreter_sessions.result"
-
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
type AdminOrganizationUsageFileSearchCallsResponseDataResultOrganizationUsageFileSearchesResult struct{…}The aggregated file search calls usage details of the specific time bucket.
-
NumRequests int64The count of file search calls.
-
Object OrganizationUsageFileSearchesResultconst OrganizationUsageFileSearchesResultOrganizationUsageFileSearchesResult OrganizationUsageFileSearchesResult = "organization.usage.file_searches.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
VectorStoreID stringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
type AdminOrganizationUsageFileSearchCallsResponseDataResultOrganizationUsageWebSearchesResult struct{…}The aggregated web search calls usage details of the specific time bucket.
-
NumModelRequests int64The count of model requests.
-
NumRequests int64The count of web search calls.
-
Object OrganizationUsageWebSearchesResultconst OrganizationUsageWebSearchesResultOrganizationUsageWebSearchesResult OrganizationUsageWebSearchesResult = "organization.usage.web_searches.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
ContextLevel stringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageFileSearchCallsResponseDataResultOrganizationCostsResult struct{…}The aggregated costs details of the specific time bucket.
-
Object OrganizationCostsResultconst OrganizationCostsResultOrganizationCostsResult OrganizationCostsResult = "organization.costs.result"
-
Amount AdminOrganizationUsageFileSearchCallsResponseDataResultOrganizationCostsResultAmountThe monetary value in its associated currency.
-
Currency stringLowercase ISO-4217 currency e.g. "usd"
-
Value float64The numeric value of the cost.
-
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
LineItem stringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
Quantity float64When
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
StartTime int64
-
-
HasMore bool -
NextPage string -
Object Pageconst PagePage Page = "page"
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
response, err := client.Admin.Organization.Usage.FileSearchCalls(context.TODO(), openai.AdminOrganizationUsageFileSearchCallsParams{
StartTime: 0,
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
Response
{
"data": [
{
"end_time": 0,
"object": "bucket",
"results": [
{
"input_tokens": 0,
"num_model_requests": 0,
"object": "organization.usage.completions.result",
"output_tokens": 0,
"api_key_id": "api_key_id",
"batch": true,
"input_audio_tokens": 0,
"input_cached_tokens": 0,
"model": "model",
"output_audio_tokens": 0,
"project_id": "project_id",
"service_tier": "service_tier",
"user_id": "user_id"
}
],
"start_time": 0
}
],
"has_more": true,
"next_page": "next_page",
"object": "page"
}
Web search calls
client.Admin.Organization.Usage.WebSearchCalls(ctx, query) (*AdminOrganizationUsageWebSearchCallsResponse, error)
get /organization/usage/web_search_calls
Get web search calls usage details for the organization.
Parameters
-
query AdminOrganizationUsageWebSearchCallsParams-
StartTime param.Field[int64]Start time (Unix seconds) of the query time range, inclusive.
-
APIKeyIDs param.Field[[]string]Return only usage for these API keys.
-
BucketWidth param.Field[AdminOrganizationUsageWebSearchCallsParamsBucketWidth]Width of each time bucket in response. Currently
1m,1hand1dare supported, default to1d.-
const AdminOrganizationUsageWebSearchCallsParamsBucketWidth1m AdminOrganizationUsageWebSearchCallsParamsBucketWidth = "1m" -
const AdminOrganizationUsageWebSearchCallsParamsBucketWidth1h AdminOrganizationUsageWebSearchCallsParamsBucketWidth = "1h" -
const AdminOrganizationUsageWebSearchCallsParamsBucketWidth1d AdminOrganizationUsageWebSearchCallsParamsBucketWidth = "1d"
-
-
ContextLevels param.Field[[]string]Return only web search usage for these context levels.
-
const AdminOrganizationUsageWebSearchCallsParamsContextLevelLow AdminOrganizationUsageWebSearchCallsParamsContextLevel = "low" -
const AdminOrganizationUsageWebSearchCallsParamsContextLevelMedium AdminOrganizationUsageWebSearchCallsParamsContextLevel = "medium" -
const AdminOrganizationUsageWebSearchCallsParamsContextLevelHigh AdminOrganizationUsageWebSearchCallsParamsContextLevel = "high"
-
-
EndTime param.Field[int64]End time (Unix seconds) of the query time range, exclusive.
-
GroupBy param.Field[[]string]Group the usage data by the specified fields. Support fields include
project_id,user_id,api_key_id,model,context_levelor any combination of them.-
const AdminOrganizationUsageWebSearchCallsParamsGroupByProjectID AdminOrganizationUsageWebSearchCallsParamsGroupBy = "project_id" -
const AdminOrganizationUsageWebSearchCallsParamsGroupByUserID AdminOrganizationUsageWebSearchCallsParamsGroupBy = "user_id" -
const AdminOrganizationUsageWebSearchCallsParamsGroupByAPIKeyID AdminOrganizationUsageWebSearchCallsParamsGroupBy = "api_key_id" -
const AdminOrganizationUsageWebSearchCallsParamsGroupByModel AdminOrganizationUsageWebSearchCallsParamsGroupBy = "model" -
const AdminOrganizationUsageWebSearchCallsParamsGroupByContextLevel AdminOrganizationUsageWebSearchCallsParamsGroupBy = "context_level"
-
-
Limit param.Field[int64]Specifies the number of buckets to return.
bucket_width=1d: default: 7, max: 31bucket_width=1h: default: 24, max: 168bucket_width=1m: default: 60, max: 1440
-
Models param.Field[[]string]Return only usage for these models.
-
Page param.Field[string]A cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
ProjectIDs param.Field[[]string]Return only usage for these projects.
-
UserIDs param.Field[[]string]Return only usage for these users.
-
Returns
-
type AdminOrganizationUsageWebSearchCallsResponse struct{…}-
Data []AdminOrganizationUsageWebSearchCallsResponseData-
EndTime int64 -
Object Bucketconst BucketBucket Bucket = "bucket"
-
Results []AdminOrganizationUsageWebSearchCallsResponseDataResultUnion-
type AdminOrganizationUsageWebSearchCallsResponseDataResultOrganizationUsageCompletionsResult struct{…}The aggregated completions usage details of the specific time bucket.
-
InputTokens int64The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageCompletionsResultconst OrganizationUsageCompletionsResultOrganizationUsageCompletionsResult OrganizationUsageCompletionsResult = "organization.usage.completions.result"
-
OutputTokens int64The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Batch boolWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
InputAudioTokens int64The aggregated number of audio input tokens used, including cached tokens.
-
InputCachedTokens int64The aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
OutputAudioTokens int64The aggregated number of audio output tokens used.
-
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
ServiceTier stringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageWebSearchCallsResponseDataResultOrganizationUsageEmbeddingsResult struct{…}The aggregated embeddings usage details of the specific time bucket.
-
InputTokens int64The aggregated number of input tokens used.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageEmbeddingsResultconst OrganizationUsageEmbeddingsResultOrganizationUsageEmbeddingsResult OrganizationUsageEmbeddingsResult = "organization.usage.embeddings.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageWebSearchCallsResponseDataResultOrganizationUsageModerationsResult struct{…}The aggregated moderations usage details of the specific time bucket.
-
InputTokens int64The aggregated number of input tokens used.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageModerationsResultconst OrganizationUsageModerationsResultOrganizationUsageModerationsResult OrganizationUsageModerationsResult = "organization.usage.moderations.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageWebSearchCallsResponseDataResultOrganizationUsageImagesResult struct{…}The aggregated images usage details of the specific time bucket.
-
Images int64The number of images processed.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageImagesResultconst OrganizationUsageImagesResultOrganizationUsageImagesResult OrganizationUsageImagesResult = "organization.usage.images.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Size stringWhen
group_by=size, this field provides the image size of the grouped usage result. -
Source stringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageWebSearchCallsResponseDataResultOrganizationUsageAudioSpeechesResult struct{…}The aggregated audio speeches usage details of the specific time bucket.
-
Characters int64The number of characters processed.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageAudioSpeechesResultconst OrganizationUsageAudioSpeechesResultOrganizationUsageAudioSpeechesResult OrganizationUsageAudioSpeechesResult = "organization.usage.audio_speeches.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageWebSearchCallsResponseDataResultOrganizationUsageAudioTranscriptionsResult struct{…}The aggregated audio transcriptions usage details of the specific time bucket.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageAudioTranscriptionsResultconst OrganizationUsageAudioTranscriptionsResultOrganizationUsageAudioTranscriptionsResult OrganizationUsageAudioTranscriptionsResult = "organization.usage.audio_transcriptions.result"
-
Seconds int64The number of seconds processed.
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageWebSearchCallsResponseDataResultOrganizationUsageVectorStoresResult struct{…}The aggregated vector stores usage details of the specific time bucket.
-
Object OrganizationUsageVectorStoresResultconst OrganizationUsageVectorStoresResultOrganizationUsageVectorStoresResult OrganizationUsageVectorStoresResult = "organization.usage.vector_stores.result"
-
UsageBytes int64The vector stores usage in bytes.
-
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
type AdminOrganizationUsageWebSearchCallsResponseDataResultOrganizationUsageCodeInterpreterSessionsResult struct{…}The aggregated code interpreter sessions usage details of the specific time bucket.
-
NumSessions int64The number of code interpreter sessions.
-
Object OrganizationUsageCodeInterpreterSessionsResultconst OrganizationUsageCodeInterpreterSessionsResultOrganizationUsageCodeInterpreterSessionsResult OrganizationUsageCodeInterpreterSessionsResult = "organization.usage.code_interpreter_sessions.result"
-
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
type AdminOrganizationUsageWebSearchCallsResponseDataResultOrganizationUsageFileSearchesResult struct{…}The aggregated file search calls usage details of the specific time bucket.
-
NumRequests int64The count of file search calls.
-
Object OrganizationUsageFileSearchesResultconst OrganizationUsageFileSearchesResultOrganizationUsageFileSearchesResult OrganizationUsageFileSearchesResult = "organization.usage.file_searches.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
VectorStoreID stringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
type AdminOrganizationUsageWebSearchCallsResponseDataResultOrganizationUsageWebSearchesResult struct{…}The aggregated web search calls usage details of the specific time bucket.
-
NumModelRequests int64The count of model requests.
-
NumRequests int64The count of web search calls.
-
Object OrganizationUsageWebSearchesResultconst OrganizationUsageWebSearchesResultOrganizationUsageWebSearchesResult OrganizationUsageWebSearchesResult = "organization.usage.web_searches.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
ContextLevel stringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageWebSearchCallsResponseDataResultOrganizationCostsResult struct{…}The aggregated costs details of the specific time bucket.
-
Object OrganizationCostsResultconst OrganizationCostsResultOrganizationCostsResult OrganizationCostsResult = "organization.costs.result"
-
Amount AdminOrganizationUsageWebSearchCallsResponseDataResultOrganizationCostsResultAmountThe monetary value in its associated currency.
-
Currency stringLowercase ISO-4217 currency e.g. "usd"
-
Value float64The numeric value of the cost.
-
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
LineItem stringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
Quantity float64When
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
StartTime int64
-
-
HasMore bool -
NextPage string -
Object Pageconst PagePage Page = "page"
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
response, err := client.Admin.Organization.Usage.WebSearchCalls(context.TODO(), openai.AdminOrganizationUsageWebSearchCallsParams{
StartTime: 0,
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
Response
{
"data": [
{
"end_time": 0,
"object": "bucket",
"results": [
{
"input_tokens": 0,
"num_model_requests": 0,
"object": "organization.usage.completions.result",
"output_tokens": 0,
"api_key_id": "api_key_id",
"batch": true,
"input_audio_tokens": 0,
"input_cached_tokens": 0,
"model": "model",
"output_audio_tokens": 0,
"project_id": "project_id",
"service_tier": "service_tier",
"user_id": "user_id"
}
],
"start_time": 0
}
],
"has_more": true,
"next_page": "next_page",
"object": "page"
}
Costs
client.Admin.Organization.Usage.Costs(ctx, query) (*AdminOrganizationUsageCostsResponse, error)
get /organization/costs
Get costs details for the organization.
Parameters
-
query AdminOrganizationUsageCostsParams-
StartTime param.Field[int64]Start time (Unix seconds) of the query time range, inclusive.
-
APIKeyIDs param.Field[[]string]Return only costs for these API keys.
-
BucketWidth param.Field[AdminOrganizationUsageCostsParamsBucketWidth]Width of each time bucket in response. Currently only
1dis supported, default to1d.const AdminOrganizationUsageCostsParamsBucketWidth1d AdminOrganizationUsageCostsParamsBucketWidth = "1d"
-
EndTime param.Field[int64]End time (Unix seconds) of the query time range, exclusive.
-
GroupBy param.Field[[]string]Group the costs by the specified fields. Support fields include
project_id,line_item,api_key_idand any combination of them.-
const AdminOrganizationUsageCostsParamsGroupByProjectID AdminOrganizationUsageCostsParamsGroupBy = "project_id" -
const AdminOrganizationUsageCostsParamsGroupByLineItem AdminOrganizationUsageCostsParamsGroupBy = "line_item" -
const AdminOrganizationUsageCostsParamsGroupByAPIKeyID AdminOrganizationUsageCostsParamsGroupBy = "api_key_id"
-
-
Limit param.Field[int64]A limit on the number of buckets to be returned. Limit can range between 1 and 180, and the default is 7.
-
Page param.Field[string]A cursor for use in pagination. Corresponding to the
next_pagefield from the previous response. -
ProjectIDs param.Field[[]string]Return only costs for these projects.
-
Returns
-
type AdminOrganizationUsageCostsResponse struct{…}-
Data []AdminOrganizationUsageCostsResponseData-
EndTime int64 -
Object Bucketconst BucketBucket Bucket = "bucket"
-
Results []AdminOrganizationUsageCostsResponseDataResultUnion-
type AdminOrganizationUsageCostsResponseDataResultOrganizationUsageCompletionsResult struct{…}The aggregated completions usage details of the specific time bucket.
-
InputTokens int64The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageCompletionsResultconst OrganizationUsageCompletionsResultOrganizationUsageCompletionsResult OrganizationUsageCompletionsResult = "organization.usage.completions.result"
-
OutputTokens int64The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Batch boolWhen
group_by=batch, this field tells whether the grouped usage result is batch or not. -
InputAudioTokens int64The aggregated number of audio input tokens used, including cached tokens.
-
InputCachedTokens int64The aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
-
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
OutputAudioTokens int64The aggregated number of audio output tokens used.
-
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
ServiceTier stringWhen
group_by=service_tier, this field provides the service tier of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageCostsResponseDataResultOrganizationUsageEmbeddingsResult struct{…}The aggregated embeddings usage details of the specific time bucket.
-
InputTokens int64The aggregated number of input tokens used.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageEmbeddingsResultconst OrganizationUsageEmbeddingsResultOrganizationUsageEmbeddingsResult OrganizationUsageEmbeddingsResult = "organization.usage.embeddings.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageCostsResponseDataResultOrganizationUsageModerationsResult struct{…}The aggregated moderations usage details of the specific time bucket.
-
InputTokens int64The aggregated number of input tokens used.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageModerationsResultconst OrganizationUsageModerationsResultOrganizationUsageModerationsResult OrganizationUsageModerationsResult = "organization.usage.moderations.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageCostsResponseDataResultOrganizationUsageImagesResult struct{…}The aggregated images usage details of the specific time bucket.
-
Images int64The number of images processed.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageImagesResultconst OrganizationUsageImagesResultOrganizationUsageImagesResult OrganizationUsageImagesResult = "organization.usage.images.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
Size stringWhen
group_by=size, this field provides the image size of the grouped usage result. -
Source stringWhen
group_by=source, this field provides the source of the grouped usage result, possible values areimage.generation,image.edit,image.variation. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageCostsResponseDataResultOrganizationUsageAudioSpeechesResult struct{…}The aggregated audio speeches usage details of the specific time bucket.
-
Characters int64The number of characters processed.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageAudioSpeechesResultconst OrganizationUsageAudioSpeechesResultOrganizationUsageAudioSpeechesResult OrganizationUsageAudioSpeechesResult = "organization.usage.audio_speeches.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageCostsResponseDataResultOrganizationUsageAudioTranscriptionsResult struct{…}The aggregated audio transcriptions usage details of the specific time bucket.
-
NumModelRequests int64The count of requests made to the model.
-
Object OrganizationUsageAudioTranscriptionsResultconst OrganizationUsageAudioTranscriptionsResultOrganizationUsageAudioTranscriptionsResult OrganizationUsageAudioTranscriptionsResult = "organization.usage.audio_transcriptions.result"
-
Seconds int64The number of seconds processed.
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageCostsResponseDataResultOrganizationUsageVectorStoresResult struct{…}The aggregated vector stores usage details of the specific time bucket.
-
Object OrganizationUsageVectorStoresResultconst OrganizationUsageVectorStoresResultOrganizationUsageVectorStoresResult OrganizationUsageVectorStoresResult = "organization.usage.vector_stores.result"
-
UsageBytes int64The vector stores usage in bytes.
-
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
type AdminOrganizationUsageCostsResponseDataResultOrganizationUsageCodeInterpreterSessionsResult struct{…}The aggregated code interpreter sessions usage details of the specific time bucket.
-
NumSessions int64The number of code interpreter sessions.
-
Object OrganizationUsageCodeInterpreterSessionsResultconst OrganizationUsageCodeInterpreterSessionsResultOrganizationUsageCodeInterpreterSessionsResult OrganizationUsageCodeInterpreterSessionsResult = "organization.usage.code_interpreter_sessions.result"
-
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result.
-
-
type AdminOrganizationUsageCostsResponseDataResultOrganizationUsageFileSearchesResult struct{…}The aggregated file search calls usage details of the specific time bucket.
-
NumRequests int64The count of file search calls.
-
Object OrganizationUsageFileSearchesResultconst OrganizationUsageFileSearchesResultOrganizationUsageFileSearchesResult OrganizationUsageFileSearchesResult = "organization.usage.file_searches.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result. -
VectorStoreID stringWhen
group_by=vector_store_id, this field provides the vector store ID of the grouped usage result.
-
-
type AdminOrganizationUsageCostsResponseDataResultOrganizationUsageWebSearchesResult struct{…}The aggregated web search calls usage details of the specific time bucket.
-
NumModelRequests int64The count of model requests.
-
NumRequests int64The count of web search calls.
-
Object OrganizationUsageWebSearchesResultconst OrganizationUsageWebSearchesResultOrganizationUsageWebSearchesResult OrganizationUsageWebSearchesResult = "organization.usage.web_searches.result"
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API key ID of the grouped usage result. -
ContextLevel stringWhen
group_by=context_level, this field provides the search context size of the grouped usage result. -
Model stringWhen
group_by=model, this field provides the model name of the grouped usage result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped usage result. -
UserID stringWhen
group_by=user_id, this field provides the user ID of the grouped usage result.
-
-
type AdminOrganizationUsageCostsResponseDataResultOrganizationCostsResult struct{…}The aggregated costs details of the specific time bucket.
-
Object OrganizationCostsResultconst OrganizationCostsResultOrganizationCostsResult OrganizationCostsResult = "organization.costs.result"
-
Amount AdminOrganizationUsageCostsResponseDataResultOrganizationCostsResultAmountThe monetary value in its associated currency.
-
Currency stringLowercase ISO-4217 currency e.g. "usd"
-
Value float64The numeric value of the cost.
-
-
APIKeyID stringWhen
group_by=api_key_id, this field provides the API Key ID of the grouped costs result. -
LineItem stringWhen
group_by=line_item, this field provides the line item of the grouped costs result. -
ProjectID stringWhen
group_by=project_id, this field provides the project ID of the grouped costs result. -
Quantity float64When
group_by=line_item, this field provides the quantity of the grouped costs result.
-
-
-
StartTime int64
-
-
HasMore bool -
NextPage string -
Object Pageconst PagePage Page = "page"
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
response, err := client.Admin.Organization.Usage.Costs(context.TODO(), openai.AdminOrganizationUsageCostsParams{
StartTime: 0,
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
Response
{
"data": [
{
"end_time": 0,
"object": "bucket",
"results": [
{
"input_tokens": 0,
"num_model_requests": 0,
"object": "organization.usage.completions.result",
"output_tokens": 0,
"api_key_id": "api_key_id",
"batch": true,
"input_audio_tokens": 0,
"input_cached_tokens": 0,
"model": "model",
"output_audio_tokens": 0,
"project_id": "project_id",
"service_tier": "service_tier",
"user_id": "user_id"
}
],
"start_time": 0
}
],
"has_more": true,
"next_page": "next_page",
"object": "page"
}
Invites
List invites
client.Admin.Organization.Invites.List(ctx, query) (*ConversationCursorPage[Invite], error)
get /organization/invites
Returns a list of invites in the organization.
Parameters
-
query AdminOrganizationInviteListParams-
After param.Field[string]A cursor for use in pagination.
afteris an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. -
Limit param.Field[int64]A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
-
Returns
-
type Invite struct{…}Represents an individual
inviteto the organization.-
ID stringThe identifier, which can be referenced in API endpoints
-
CreatedAt int64The Unix timestamp (in seconds) of when the invite was sent.
-
Email stringThe email address of the individual to whom the invite was sent
-
Object OrganizationInviteThe object type, which is always
organization.inviteconst OrganizationInviteOrganizationInvite OrganizationInvite = "organization.invite"
-
Projects []InviteProjectThe projects that were granted membership upon acceptance of the invite.
-
ID stringProject's public ID
-
Role stringProject membership role
-
const InviteProjectRoleMember InviteProjectRole = "member" -
const InviteProjectRoleOwner InviteProjectRole = "owner"
-
-
-
Role InviteRoleownerorreader-
const InviteRoleOwner InviteRole = "owner" -
const InviteRoleReader InviteRole = "reader"
-
-
Status InviteStatusaccepted,expired, orpending-
const InviteStatusAccepted InviteStatus = "accepted" -
const InviteStatusExpired InviteStatus = "expired" -
const InviteStatusPending InviteStatus = "pending"
-
-
AcceptedAt int64The Unix timestamp (in seconds) of when the invite was accepted.
-
ExpiresAt int64The Unix timestamp (in seconds) of when the invite expires.
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
page, err := client.Admin.Organization.Invites.List(context.TODO(), openai.AdminOrganizationInviteListParams{
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
Response
{
"data": [
{
"id": "id",
"created_at": 0,
"email": "email",
"object": "organization.invite",
"projects": [
{
"id": "id",
"role": "member"
}
],
"role": "owner",
"status": "accepted",
"accepted_at": 0,
"expires_at": 0
}
],
"has_more": true,
"object": "list",
"first_id": "first_id",
"last_id": "last_id"
}
Create invite
client.Admin.Organization.Invites.New(ctx, body) (*Invite, error)
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
-
body AdminOrganizationInviteNewParams-
Email param.Field[string]Send an email to this address
-
Role param.Field[AdminOrganizationInviteNewParamsRole]ownerorreader-
const AdminOrganizationInviteNewParamsRoleReader AdminOrganizationInviteNewParamsRole = "reader" -
const AdminOrganizationInviteNewParamsRoleOwner AdminOrganizationInviteNewParamsRole = "owner"
-
-
Projects param.Field[[]AdminOrganizationInviteNewParamsProject]An array of projects to which membership is granted at the same time the org invite is accepted. If omitted, the user will be invited to the default project for compatibility with legacy behavior. If empty list is passed, the user will not be invited to any projects, including the default one.
-
ID stringProject's public ID
-
Role stringProject membership role
-
const AdminOrganizationInviteNewParamsProjectRoleMember AdminOrganizationInviteNewParamsProjectRole = "member" -
const AdminOrganizationInviteNewParamsProjectRoleOwner AdminOrganizationInviteNewParamsProjectRole = "owner"
-
-
-
Returns
-
type Invite struct{…}Represents an individual
inviteto the organization.-
ID stringThe identifier, which can be referenced in API endpoints
-
CreatedAt int64The Unix timestamp (in seconds) of when the invite was sent.
-
Email stringThe email address of the individual to whom the invite was sent
-
Object OrganizationInviteThe object type, which is always
organization.inviteconst OrganizationInviteOrganizationInvite OrganizationInvite = "organization.invite"
-
Projects []InviteProjectThe projects that were granted membership upon acceptance of the invite.
-
ID stringProject's public ID
-
Role stringProject membership role
-
const InviteProjectRoleMember InviteProjectRole = "member" -
const InviteProjectRoleOwner InviteProjectRole = "owner"
-
-
-
Role InviteRoleownerorreader-
const InviteRoleOwner InviteRole = "owner" -
const InviteRoleReader InviteRole = "reader"
-
-
Status InviteStatusaccepted,expired, orpending-
const InviteStatusAccepted InviteStatus = "accepted" -
const InviteStatusExpired InviteStatus = "expired" -
const InviteStatusPending InviteStatus = "pending"
-
-
AcceptedAt int64The Unix timestamp (in seconds) of when the invite was accepted.
-
ExpiresAt int64The Unix timestamp (in seconds) of when the invite expires.
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
invite, err := client.Admin.Organization.Invites.New(context.TODO(), openai.AdminOrganizationInviteNewParams{
Email: "email",
Role: openai.AdminOrganizationInviteNewParamsRoleReader,
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", invite.ID)
}
Response
{
"id": "id",
"created_at": 0,
"email": "email",
"object": "organization.invite",
"projects": [
{
"id": "id",
"role": "member"
}
],
"role": "owner",
"status": "accepted",
"accepted_at": 0,
"expires_at": 0
}
Retrieve invite
client.Admin.Organization.Invites.Get(ctx, inviteID) (*Invite, error)
get /organization/invites/{invite_id}
Retrieves an invite.
Parameters
inviteID string
Returns
-
type Invite struct{…}Represents an individual
inviteto the organization.-
ID stringThe identifier, which can be referenced in API endpoints
-
CreatedAt int64The Unix timestamp (in seconds) of when the invite was sent.
-
Email stringThe email address of the individual to whom the invite was sent
-
Object OrganizationInviteThe object type, which is always
organization.inviteconst OrganizationInviteOrganizationInvite OrganizationInvite = "organization.invite"
-
Projects []InviteProjectThe projects that were granted membership upon acceptance of the invite.
-
ID stringProject's public ID
-
Role stringProject membership role
-
const InviteProjectRoleMember InviteProjectRole = "member" -
const InviteProjectRoleOwner InviteProjectRole = "owner"
-
-
-
Role InviteRoleownerorreader-
const InviteRoleOwner InviteRole = "owner" -
const InviteRoleReader InviteRole = "reader"
-
-
Status InviteStatusaccepted,expired, orpending-
const InviteStatusAccepted InviteStatus = "accepted" -
const InviteStatusExpired InviteStatus = "expired" -
const InviteStatusPending InviteStatus = "pending"
-
-
AcceptedAt int64The Unix timestamp (in seconds) of when the invite was accepted.
-
ExpiresAt int64The Unix timestamp (in seconds) of when the invite expires.
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
invite, err := client.Admin.Organization.Invites.Get(context.TODO(), "invite_id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", invite.ID)
}
Response
{
"id": "id",
"created_at": 0,
"email": "email",
"object": "organization.invite",
"projects": [
{
"id": "id",
"role": "member"
}
],
"role": "owner",
"status": "accepted",
"accepted_at": 0,
"expires_at": 0
}
Delete invite
client.Admin.Organization.Invites.Delete(ctx, inviteID) (*AdminOrganizationInviteDeleteResponse, error)
delete /organization/invites/{invite_id}
Delete an invite. If the invite has already been accepted, it cannot be deleted.
Parameters
inviteID string
Returns
-
type AdminOrganizationInviteDeleteResponse struct{…}-
ID string -
Deleted bool -
Object OrganizationInviteDeletedThe object type, which is always
organization.invite.deletedconst OrganizationInviteDeletedOrganizationInviteDeleted OrganizationInviteDeleted = "organization.invite.deleted"
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
invite, err := client.Admin.Organization.Invites.Delete(context.TODO(), "invite_id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", invite.ID)
}
Response
{
"id": "id",
"deleted": true,
"object": "organization.invite.deleted"
}
Domain Types
Invite
-
type Invite struct{…}Represents an individual
inviteto the organization.-
ID stringThe identifier, which can be referenced in API endpoints
-
CreatedAt int64The Unix timestamp (in seconds) of when the invite was sent.
-
Email stringThe email address of the individual to whom the invite was sent
-
Object OrganizationInviteThe object type, which is always
organization.inviteconst OrganizationInviteOrganizationInvite OrganizationInvite = "organization.invite"
-
Projects []InviteProjectThe projects that were granted membership upon acceptance of the invite.
-
ID stringProject's public ID
-
Role stringProject membership role
-
const InviteProjectRoleMember InviteProjectRole = "member" -
const InviteProjectRoleOwner InviteProjectRole = "owner"
-
-
-
Role InviteRoleownerorreader-
const InviteRoleOwner InviteRole = "owner" -
const InviteRoleReader InviteRole = "reader"
-
-
Status InviteStatusaccepted,expired, orpending-
const InviteStatusAccepted InviteStatus = "accepted" -
const InviteStatusExpired InviteStatus = "expired" -
const InviteStatusPending InviteStatus = "pending"
-
-
AcceptedAt int64The Unix timestamp (in seconds) of when the invite was accepted.
-
ExpiresAt int64The Unix timestamp (in seconds) of when the invite expires.
-
Users
List users
client.Admin.Organization.Users.List(ctx, query) (*ConversationCursorPage[OrganizationUser], error)
get /organization/users
Lists all of the users in the organization.
Parameters
-
query AdminOrganizationUserListParams-
After param.Field[string]A cursor for use in pagination.
afteris an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. -
Emails param.Field[[]string]Filter by the email address of users.
-
Limit param.Field[int64]A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
-
Returns
-
type OrganizationUser struct{…}Represents an individual
userwithin an organization.-
ID stringThe identifier, which can be referenced in API endpoints
-
AddedAt int64The Unix timestamp (in seconds) of when the user was added.
-
Object OrganizationUserThe object type, which is always
organization.userconst OrganizationUserOrganizationUser OrganizationUser = "organization.user"
-
APIKeyLastUsedAt int64The Unix timestamp (in seconds) of the user's last API key usage.
-
Created int64The Unix timestamp (in seconds) of when the user was created.
-
DeveloperPersona stringThe developer persona metadata for the user.
-
Email stringThe email address of the user
-
IsDefault boolWhether this is the organization's default user.
-
IsScaleTierAuthorizedPurchaser boolWhether the user is an authorized purchaser for Scale Tier.
-
IsScimManaged boolWhether the user is managed through SCIM.
-
IsServiceAccount boolWhether the user is a service account.
-
Name stringThe name of the user
-
Projects OrganizationUserProjectsProjects associated with the user, if included.
-
Data []OrganizationUserProjectsData-
ID string -
Name string -
Role string
-
-
Object Listconst ListList List = "list"
-
-
Role stringownerorreader -
TechnicalLevel stringThe technical level metadata for the user.
-
User OrganizationUserUserNested user details.
-
ID string -
Object Userconst UserUser User = "user"
-
Banned bool -
BannedAt int64 -
Email string -
Enabled bool -
Name string -
Picture string
-
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
page, err := client.Admin.Organization.Users.List(context.TODO(), openai.AdminOrganizationUserListParams{
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
Response
{
"data": [
{
"id": "id",
"added_at": 0,
"object": "organization.user",
"api_key_last_used_at": 0,
"created": 0,
"developer_persona": "developer_persona",
"email": "email",
"is_default": true,
"is_scale_tier_authorized_purchaser": true,
"is_scim_managed": true,
"is_service_account": true,
"name": "name",
"projects": {
"data": [
{
"id": "id",
"name": "name",
"role": "role"
}
],
"object": "list"
},
"role": "role",
"technical_level": "technical_level",
"user": {
"id": "id",
"object": "user",
"banned": true,
"banned_at": 0,
"email": "email",
"enabled": true,
"name": "name",
"picture": "picture"
}
}
],
"has_more": true,
"object": "list",
"first_id": "first_id",
"last_id": "last_id"
}
Retrieve user
client.Admin.Organization.Users.Get(ctx, userID) (*OrganizationUser, error)
get /organization/users/{user_id}
Retrieves a user by their identifier.
Parameters
userID string
Returns
-
type OrganizationUser struct{…}Represents an individual
userwithin an organization.-
ID stringThe identifier, which can be referenced in API endpoints
-
AddedAt int64The Unix timestamp (in seconds) of when the user was added.
-
Object OrganizationUserThe object type, which is always
organization.userconst OrganizationUserOrganizationUser OrganizationUser = "organization.user"
-
APIKeyLastUsedAt int64The Unix timestamp (in seconds) of the user's last API key usage.
-
Created int64The Unix timestamp (in seconds) of when the user was created.
-
DeveloperPersona stringThe developer persona metadata for the user.
-
Email stringThe email address of the user
-
IsDefault boolWhether this is the organization's default user.
-
IsScaleTierAuthorizedPurchaser boolWhether the user is an authorized purchaser for Scale Tier.
-
IsScimManaged boolWhether the user is managed through SCIM.
-
IsServiceAccount boolWhether the user is a service account.
-
Name stringThe name of the user
-
Projects OrganizationUserProjectsProjects associated with the user, if included.
-
Data []OrganizationUserProjectsData-
ID string -
Name string -
Role string
-
-
Object Listconst ListList List = "list"
-
-
Role stringownerorreader -
TechnicalLevel stringThe technical level metadata for the user.
-
User OrganizationUserUserNested user details.
-
ID string -
Object Userconst UserUser User = "user"
-
Banned bool -
BannedAt int64 -
Email string -
Enabled bool -
Name string -
Picture string
-
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
organizationUser, err := client.Admin.Organization.Users.Get(context.TODO(), "user_id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", organizationUser.ID)
}
Response
{
"id": "id",
"added_at": 0,
"object": "organization.user",
"api_key_last_used_at": 0,
"created": 0,
"developer_persona": "developer_persona",
"email": "email",
"is_default": true,
"is_scale_tier_authorized_purchaser": true,
"is_scim_managed": true,
"is_service_account": true,
"name": "name",
"projects": {
"data": [
{
"id": "id",
"name": "name",
"role": "role"
}
],
"object": "list"
},
"role": "role",
"technical_level": "technical_level",
"user": {
"id": "id",
"object": "user",
"banned": true,
"banned_at": 0,
"email": "email",
"enabled": true,
"name": "name",
"picture": "picture"
}
}
Modify user
client.Admin.Organization.Users.Update(ctx, userID, body) (*OrganizationUser, error)
post /organization/users/{user_id}
Modifies a user's role in the organization.
Parameters
-
userID string -
body AdminOrganizationUserUpdateParams-
DeveloperPersona param.Field[string]Developer persona metadata.
-
Role param.Field[string]ownerorreader -
RoleID param.Field[string]Role ID to assign to the user.
-
TechnicalLevel param.Field[string]Technical level metadata.
-
Returns
-
type OrganizationUser struct{…}Represents an individual
userwithin an organization.-
ID stringThe identifier, which can be referenced in API endpoints
-
AddedAt int64The Unix timestamp (in seconds) of when the user was added.
-
Object OrganizationUserThe object type, which is always
organization.userconst OrganizationUserOrganizationUser OrganizationUser = "organization.user"
-
APIKeyLastUsedAt int64The Unix timestamp (in seconds) of the user's last API key usage.
-
Created int64The Unix timestamp (in seconds) of when the user was created.
-
DeveloperPersona stringThe developer persona metadata for the user.
-
Email stringThe email address of the user
-
IsDefault boolWhether this is the organization's default user.
-
IsScaleTierAuthorizedPurchaser boolWhether the user is an authorized purchaser for Scale Tier.
-
IsScimManaged boolWhether the user is managed through SCIM.
-
IsServiceAccount boolWhether the user is a service account.
-
Name stringThe name of the user
-
Projects OrganizationUserProjectsProjects associated with the user, if included.
-
Data []OrganizationUserProjectsData-
ID string -
Name string -
Role string
-
-
Object Listconst ListList List = "list"
-
-
Role stringownerorreader -
TechnicalLevel stringThe technical level metadata for the user.
-
User OrganizationUserUserNested user details.
-
ID string -
Object Userconst UserUser User = "user"
-
Banned bool -
BannedAt int64 -
Email string -
Enabled bool -
Name string -
Picture string
-
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
organizationUser, err := client.Admin.Organization.Users.Update(
context.TODO(),
"user_id",
openai.AdminOrganizationUserUpdateParams{
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", organizationUser.ID)
}
Response
{
"id": "id",
"added_at": 0,
"object": "organization.user",
"api_key_last_used_at": 0,
"created": 0,
"developer_persona": "developer_persona",
"email": "email",
"is_default": true,
"is_scale_tier_authorized_purchaser": true,
"is_scim_managed": true,
"is_service_account": true,
"name": "name",
"projects": {
"data": [
{
"id": "id",
"name": "name",
"role": "role"
}
],
"object": "list"
},
"role": "role",
"technical_level": "technical_level",
"user": {
"id": "id",
"object": "user",
"banned": true,
"banned_at": 0,
"email": "email",
"enabled": true,
"name": "name",
"picture": "picture"
}
}
Delete user
client.Admin.Organization.Users.Delete(ctx, userID) (*AdminOrganizationUserDeleteResponse, error)
delete /organization/users/{user_id}
Deletes a user from the organization.
Parameters
userID string
Returns
-
type AdminOrganizationUserDeleteResponse struct{…}-
ID string -
Deleted bool -
Object OrganizationUserDeletedconst OrganizationUserDeletedOrganizationUserDeleted OrganizationUserDeleted = "organization.user.deleted"
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
user, err := client.Admin.Organization.Users.Delete(context.TODO(), "user_id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", user.ID)
}
Response
{
"id": "id",
"deleted": true,
"object": "organization.user.deleted"
}
Domain Types
Organization User
-
type OrganizationUser struct{…}Represents an individual
userwithin an organization.-
ID stringThe identifier, which can be referenced in API endpoints
-
AddedAt int64The Unix timestamp (in seconds) of when the user was added.
-
Object OrganizationUserThe object type, which is always
organization.userconst OrganizationUserOrganizationUser OrganizationUser = "organization.user"
-
APIKeyLastUsedAt int64The Unix timestamp (in seconds) of the user's last API key usage.
-
Created int64The Unix timestamp (in seconds) of when the user was created.
-
DeveloperPersona stringThe developer persona metadata for the user.
-
Email stringThe email address of the user
-
IsDefault boolWhether this is the organization's default user.
-
IsScaleTierAuthorizedPurchaser boolWhether the user is an authorized purchaser for Scale Tier.
-
IsScimManaged boolWhether the user is managed through SCIM.
-
IsServiceAccount boolWhether the user is a service account.
-
Name stringThe name of the user
-
Projects OrganizationUserProjectsProjects associated with the user, if included.
-
Data []OrganizationUserProjectsData-
ID string -
Name string -
Role string
-
-
Object Listconst ListList List = "list"
-
-
Role stringownerorreader -
TechnicalLevel stringThe technical level metadata for the user.
-
User OrganizationUserUserNested user details.
-
ID string -
Object Userconst UserUser User = "user"
-
Banned bool -
BannedAt int64 -
Email string -
Enabled bool -
Name string -
Picture string
-
-
Roles
List user organization role assignments
client.Admin.Organization.Users.Roles.List(ctx, userID, query) (*NextCursorPage[AdminOrganizationUserRoleListResponse], error)
get /organization/users/{user_id}/roles
Lists the organization roles assigned to a user within the organization.
Parameters
-
userID string -
query AdminOrganizationUserRoleListParams-
After param.Field[string]Cursor for pagination. Provide the value from the previous response's
nextfield to continue listing organization roles. -
Limit param.Field[int64]A limit on the number of organization role assignments to return.
-
Order param.Field[AdminOrganizationUserRoleListParamsOrder]Sort order for the returned organization roles.
-
const AdminOrganizationUserRoleListParamsOrderAsc AdminOrganizationUserRoleListParamsOrder = "asc" -
const AdminOrganizationUserRoleListParamsOrderDesc AdminOrganizationUserRoleListParamsOrder = "desc"
-
-
Returns
-
type AdminOrganizationUserRoleListResponse struct{…}Detailed information about a role assignment entry returned when listing assignments.
-
ID stringIdentifier for the role.
-
AssignmentSources []AdminOrganizationUserRoleListResponseAssignmentSourcePrincipals from which the role assignment is inherited, when available.
-
PrincipalID string -
PrincipalType string
-
-
CreatedAt int64When the role was created.
-
CreatedBy stringIdentifier of the actor who created the role.
-
CreatedByUserObj map[string, any]User details for the actor that created the role, when available.
-
Description stringDescription of the role.
-
Metadata map[string, any]Arbitrary metadata stored on the role.
-
Name stringName of the role.
-
Permissions []stringPermissions associated with the role.
-
PredefinedRole boolWhether the role is predefined by OpenAI.
-
ResourceType stringResource type the role applies to.
-
UpdatedAt int64When the role was last updated.
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
page, err := client.Admin.Organization.Users.Roles.List(
context.TODO(),
"user_id",
openai.AdminOrganizationUserRoleListParams{
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
Response
{
"data": [
{
"id": "id",
"assignment_sources": [
{
"principal_id": "principal_id",
"principal_type": "principal_type"
}
],
"created_at": 0,
"created_by": "created_by",
"created_by_user_obj": {
"foo": "bar"
},
"description": "description",
"metadata": {
"foo": "bar"
},
"name": "name",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type",
"updated_at": 0
}
],
"has_more": true,
"next": "next",
"object": "list"
}
Assign organization role to user
client.Admin.Organization.Users.Roles.New(ctx, userID, body) (*AdminOrganizationUserRoleNewResponse, error)
post /organization/users/{user_id}/roles
Assigns an organization role to a user within the organization.
Parameters
-
userID string -
body AdminOrganizationUserRoleNewParams-
RoleID param.Field[string]Identifier of the role to assign.
-
Returns
-
type AdminOrganizationUserRoleNewResponse struct{…}Role assignment linking a user to a role.
-
Object UserRoleAlways
user.role.const UserRoleUserRole UserRole = "user.role"
-
Role RoleDetails about a role that can be assigned through the public Roles API.
-
ID stringIdentifier for the role.
-
Description stringOptional description of the role.
-
Name stringUnique name for the role.
-
Object RoleAlways
role.const RoleRole Role = "role"
-
Permissions []stringPermissions granted by the role.
-
PredefinedRole boolWhether the role is predefined and managed by OpenAI.
-
ResourceType stringResource type the role is bound to (for example
api.organizationorapi.project).
-
-
User OrganizationUserRepresents an individual
userwithin an organization.-
ID stringThe identifier, which can be referenced in API endpoints
-
AddedAt int64The Unix timestamp (in seconds) of when the user was added.
-
Object OrganizationUserThe object type, which is always
organization.userconst OrganizationUserOrganizationUser OrganizationUser = "organization.user"
-
APIKeyLastUsedAt int64The Unix timestamp (in seconds) of the user's last API key usage.
-
Created int64The Unix timestamp (in seconds) of when the user was created.
-
DeveloperPersona stringThe developer persona metadata for the user.
-
Email stringThe email address of the user
-
IsDefault boolWhether this is the organization's default user.
-
IsScaleTierAuthorizedPurchaser boolWhether the user is an authorized purchaser for Scale Tier.
-
IsScimManaged boolWhether the user is managed through SCIM.
-
IsServiceAccount boolWhether the user is a service account.
-
Name stringThe name of the user
-
Projects OrganizationUserProjectsProjects associated with the user, if included.
-
Data []OrganizationUserProjectsData-
ID string -
Name string -
Role string
-
-
Object Listconst ListList List = "list"
-
-
Role stringownerorreader -
TechnicalLevel stringThe technical level metadata for the user.
-
User OrganizationUserUserNested user details.
-
ID string -
Object Userconst UserUser User = "user"
-
Banned bool -
BannedAt int64 -
Email string -
Enabled bool -
Name string -
Picture string
-
-
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
role, err := client.Admin.Organization.Users.Roles.New(
context.TODO(),
"user_id",
openai.AdminOrganizationUserRoleNewParams{
RoleID: "role_id",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", role.Object)
}
Response
{
"object": "user.role",
"role": {
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
},
"user": {
"id": "id",
"added_at": 0,
"object": "organization.user",
"api_key_last_used_at": 0,
"created": 0,
"developer_persona": "developer_persona",
"email": "email",
"is_default": true,
"is_scale_tier_authorized_purchaser": true,
"is_scim_managed": true,
"is_service_account": true,
"name": "name",
"projects": {
"data": [
{
"id": "id",
"name": "name",
"role": "role"
}
],
"object": "list"
},
"role": "role",
"technical_level": "technical_level",
"user": {
"id": "id",
"object": "user",
"banned": true,
"banned_at": 0,
"email": "email",
"enabled": true,
"name": "name",
"picture": "picture"
}
}
}
Retrieve user organization role
client.Admin.Organization.Users.Roles.Get(ctx, userID, roleID) (*AdminOrganizationUserRoleGetResponse, error)
get /organization/users/{user_id}/roles/{role_id}
Retrieves an organization role assigned to a user.
Parameters
-
userID string -
roleID string
Returns
-
type AdminOrganizationUserRoleGetResponse struct{…}Detailed information about a role assignment entry returned when listing assignments.
-
ID stringIdentifier for the role.
-
AssignmentSources []AdminOrganizationUserRoleGetResponseAssignmentSourcePrincipals from which the role assignment is inherited, when available.
-
PrincipalID string -
PrincipalType string
-
-
CreatedAt int64When the role was created.
-
CreatedBy stringIdentifier of the actor who created the role.
-
CreatedByUserObj map[string, any]User details for the actor that created the role, when available.
-
Description stringDescription of the role.
-
Metadata map[string, any]Arbitrary metadata stored on the role.
-
Name stringName of the role.
-
Permissions []stringPermissions associated with the role.
-
PredefinedRole boolWhether the role is predefined by OpenAI.
-
ResourceType stringResource type the role applies to.
-
UpdatedAt int64When the role was last updated.
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
role, err := client.Admin.Organization.Users.Roles.Get(
context.TODO(),
"user_id",
"role_id",
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", role.ID)
}
Response
{
"id": "id",
"assignment_sources": [
{
"principal_id": "principal_id",
"principal_type": "principal_type"
}
],
"created_at": 0,
"created_by": "created_by",
"created_by_user_obj": {
"foo": "bar"
},
"description": "description",
"metadata": {
"foo": "bar"
},
"name": "name",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type",
"updated_at": 0
}
Unassign organization role from user
client.Admin.Organization.Users.Roles.Delete(ctx, userID, roleID) (*AdminOrganizationUserRoleDeleteResponse, error)
delete /organization/users/{user_id}/roles/{role_id}
Unassigns an organization role from a user within the organization.
Parameters
-
userID string -
roleID string
Returns
-
type AdminOrganizationUserRoleDeleteResponse struct{…}Confirmation payload returned after unassigning a role.
-
Deleted boolWhether the assignment was removed.
-
Object stringIdentifier for the deleted assignment, such as
group.role.deletedoruser.role.deleted.
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
role, err := client.Admin.Organization.Users.Roles.Delete(
context.TODO(),
"user_id",
"role_id",
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", role.Deleted)
}
Response
{
"deleted": true,
"object": "object"
}
Groups
List groups
client.Admin.Organization.Groups.List(ctx, query) (*NextCursorPage[Group], error)
get /organization/groups
Lists all groups in the organization.
Parameters
-
query AdminOrganizationGroupListParams-
After param.Field[string]A cursor for use in pagination.
afteris a group ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with group_abc, your subsequent call can includeafter=group_abcin order to fetch the next page of the list. -
Limit param.Field[int64]A limit on the number of groups to be returned. Limit can range between 0 and 1000, and the default is 100.
-
Order param.Field[AdminOrganizationGroupListParamsOrder]Specifies the sort order of the returned groups.
-
const AdminOrganizationGroupListParamsOrderAsc AdminOrganizationGroupListParamsOrder = "asc" -
const AdminOrganizationGroupListParamsOrderDesc AdminOrganizationGroupListParamsOrder = "desc"
-
-
Returns
-
type Group struct{…}Details about an organization group.
-
ID stringIdentifier for the group.
-
CreatedAt int64Unix timestamp (in seconds) when the group was created.
-
GroupType GroupGroupTypeThe type of the group.
-
const GroupGroupTypeGroup GroupGroupType = "group" -
const GroupGroupTypeTenantGroup GroupGroupType = "tenant_group"
-
-
IsScimManaged boolWhether the group is managed through SCIM and controlled by your identity provider.
-
Name stringDisplay name of the group.
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
page, err := client.Admin.Organization.Groups.List(context.TODO(), openai.AdminOrganizationGroupListParams{
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
Response
{
"data": [
{
"id": "id",
"created_at": 0,
"group_type": "group",
"is_scim_managed": true,
"name": "name"
}
],
"has_more": true,
"next": "next",
"object": "list"
}
Create group
client.Admin.Organization.Groups.New(ctx, body) (*Group, error)
post /organization/groups
Creates a new group in the organization.
Parameters
-
body AdminOrganizationGroupNewParams-
Name param.Field[string]Human readable name for the group.
-
Returns
-
type Group struct{…}Details about an organization group.
-
ID stringIdentifier for the group.
-
CreatedAt int64Unix timestamp (in seconds) when the group was created.
-
GroupType GroupGroupTypeThe type of the group.
-
const GroupGroupTypeGroup GroupGroupType = "group" -
const GroupGroupTypeTenantGroup GroupGroupType = "tenant_group"
-
-
IsScimManaged boolWhether the group is managed through SCIM and controlled by your identity provider.
-
Name stringDisplay name of the group.
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
group, err := client.Admin.Organization.Groups.New(context.TODO(), openai.AdminOrganizationGroupNewParams{
Name: "x",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", group.ID)
}
Response
{
"id": "id",
"created_at": 0,
"group_type": "group",
"is_scim_managed": true,
"name": "name"
}
Retrieve group
client.Admin.Organization.Groups.Get(ctx, groupID) (*Group, error)
get /organization/groups/{group_id}
Retrieves a group.
Parameters
groupID string
Returns
-
type Group struct{…}Details about an organization group.
-
ID stringIdentifier for the group.
-
CreatedAt int64Unix timestamp (in seconds) when the group was created.
-
GroupType GroupGroupTypeThe type of the group.
-
const GroupGroupTypeGroup GroupGroupType = "group" -
const GroupGroupTypeTenantGroup GroupGroupType = "tenant_group"
-
-
IsScimManaged boolWhether the group is managed through SCIM and controlled by your identity provider.
-
Name stringDisplay name of the group.
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
group, err := client.Admin.Organization.Groups.Get(context.TODO(), "group_id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", group.ID)
}
Response
{
"id": "id",
"created_at": 0,
"group_type": "group",
"is_scim_managed": true,
"name": "name"
}
Update group
client.Admin.Organization.Groups.Update(ctx, groupID, body) (*AdminOrganizationGroupUpdateResponse, error)
post /organization/groups/{group_id}
Updates a group's information.
Parameters
-
groupID string -
body AdminOrganizationGroupUpdateParams-
Name param.Field[string]New display name for the group.
-
Returns
-
type AdminOrganizationGroupUpdateResponse struct{…}Response returned after updating a group.
-
ID stringIdentifier for the group.
-
CreatedAt int64Unix timestamp (in seconds) when the group was created.
-
IsScimManaged boolWhether the group is managed through SCIM and controlled by your identity provider.
-
Name stringUpdated display name for the group.
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
group, err := client.Admin.Organization.Groups.Update(
context.TODO(),
"group_id",
openai.AdminOrganizationGroupUpdateParams{
Name: "x",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", group.ID)
}
Response
{
"id": "id",
"created_at": 0,
"is_scim_managed": true,
"name": "name"
}
Delete group
client.Admin.Organization.Groups.Delete(ctx, groupID) (*AdminOrganizationGroupDeleteResponse, error)
delete /organization/groups/{group_id}
Deletes a group from the organization.
Parameters
groupID string
Returns
-
type AdminOrganizationGroupDeleteResponse struct{…}Confirmation payload returned after deleting a group.
-
ID stringIdentifier of the deleted group.
-
Deleted boolWhether the group was deleted.
-
Object GroupDeletedAlways
group.deleted.const GroupDeletedGroupDeleted GroupDeleted = "group.deleted"
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
group, err := client.Admin.Organization.Groups.Delete(context.TODO(), "group_id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", group.ID)
}
Response
{
"id": "id",
"deleted": true,
"object": "group.deleted"
}
Domain Types
Group
-
type Group struct{…}Details about an organization group.
-
ID stringIdentifier for the group.
-
CreatedAt int64Unix timestamp (in seconds) when the group was created.
-
GroupType GroupGroupTypeThe type of the group.
-
const GroupGroupTypeGroup GroupGroupType = "group" -
const GroupGroupTypeTenantGroup GroupGroupType = "tenant_group"
-
-
IsScimManaged boolWhether the group is managed through SCIM and controlled by your identity provider.
-
Name stringDisplay name of the group.
-
Users
List group users
client.Admin.Organization.Groups.Users.List(ctx, groupID, query) (*NextCursorPage[OrganizationGroupUser], error)
get /organization/groups/{group_id}/users
Lists the users assigned to a group.
Parameters
-
groupID string -
query AdminOrganizationGroupUserListParams-
After param.Field[string]A cursor for use in pagination. Provide the ID of the last user from the previous list response to retrieve the next page.
-
Limit param.Field[int64]A limit on the number of users to be returned. Limit can range between 0 and 1000, and the default is 100.
-
Order param.Field[AdminOrganizationGroupUserListParamsOrder]Specifies the sort order of users in the list.
-
const AdminOrganizationGroupUserListParamsOrderAsc AdminOrganizationGroupUserListParamsOrder = "asc" -
const AdminOrganizationGroupUserListParamsOrderDesc AdminOrganizationGroupUserListParamsOrder = "desc"
-
-
Returns
-
type OrganizationGroupUser struct{…}Represents an individual user returned when inspecting group membership.
-
ID stringThe identifier, which can be referenced in API endpoints
-
Email stringThe email address of the user.
-
Name stringThe name of the user.
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
page, err := client.Admin.Organization.Groups.Users.List(
context.TODO(),
"group_id",
openai.AdminOrganizationGroupUserListParams{
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
Response
{
"data": [
{
"id": "id",
"email": "email",
"name": "name"
}
],
"has_more": true,
"next": "next",
"object": "list"
}
Add group user
client.Admin.Organization.Groups.Users.New(ctx, groupID, body) (*AdminOrganizationGroupUserNewResponse, error)
post /organization/groups/{group_id}/users
Adds a user to a group.
Parameters
-
groupID string -
body AdminOrganizationGroupUserNewParams-
UserID param.Field[string]Identifier of the user to add to the group.
-
Returns
-
type AdminOrganizationGroupUserNewResponse struct{…}Confirmation payload returned after adding a user to a group.
-
GroupID stringIdentifier of the group the user was added to.
-
Object GroupUserAlways
group.user.const GroupUserGroupUser GroupUser = "group.user"
-
UserID stringIdentifier of the user that was added.
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
user, err := client.Admin.Organization.Groups.Users.New(
context.TODO(),
"group_id",
openai.AdminOrganizationGroupUserNewParams{
UserID: "user_id",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", user.GroupID)
}
Response
{
"group_id": "group_id",
"object": "group.user",
"user_id": "user_id"
}
Retrieve group user
client.Admin.Organization.Groups.Users.Get(ctx, groupID, userID) (*AdminOrganizationGroupUserGetResponse, error)
get /organization/groups/{group_id}/users/{user_id}
Retrieves a user in a group.
Parameters
-
groupID string -
userID string
Returns
-
type AdminOrganizationGroupUserGetResponse struct{…}Details about a user returned from an organization group membership lookup.
-
ID stringIdentifier for the user.
-
Email stringEmail address of the user, or
nullfor users without an email. -
IsServiceAccount boolWhether the user is a service account.
-
Name stringDisplay name of the user.
-
Picture stringURL of the user's profile picture, if available.
-
UserType AdminOrganizationGroupUserGetResponseUserTypeThe type of user.
-
const AdminOrganizationGroupUserGetResponseUserTypeUser AdminOrganizationGroupUserGetResponseUserType = "user" -
const AdminOrganizationGroupUserGetResponseUserTypeTenantUser AdminOrganizationGroupUserGetResponseUserType = "tenant_user"
-
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
user, err := client.Admin.Organization.Groups.Users.Get(
context.TODO(),
"group_id",
"user_id",
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", user.ID)
}
Response
{
"id": "id",
"email": "email",
"is_service_account": true,
"name": "name",
"picture": "picture",
"user_type": "user"
}
Remove group user
client.Admin.Organization.Groups.Users.Delete(ctx, groupID, userID) (*AdminOrganizationGroupUserDeleteResponse, error)
delete /organization/groups/{group_id}/users/{user_id}
Removes a user from a group.
Parameters
-
groupID string -
userID string
Returns
-
type AdminOrganizationGroupUserDeleteResponse struct{…}Confirmation payload returned after removing a user from a group.
-
Deleted boolWhether the group membership was removed.
-
Object GroupUserDeletedAlways
group.user.deleted.const GroupUserDeletedGroupUserDeleted GroupUserDeleted = "group.user.deleted"
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
user, err := client.Admin.Organization.Groups.Users.Delete(
context.TODO(),
"group_id",
"user_id",
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", user.Deleted)
}
Response
{
"deleted": true,
"object": "group.user.deleted"
}
Domain Types
Organization Group User
-
type OrganizationGroupUser struct{…}Represents an individual user returned when inspecting group membership.
-
ID stringThe identifier, which can be referenced in API endpoints
-
Email stringThe email address of the user.
-
Name stringThe name of the user.
-
Roles
List group organization role assignments
client.Admin.Organization.Groups.Roles.List(ctx, groupID, query) (*NextCursorPage[AdminOrganizationGroupRoleListResponse], error)
get /organization/groups/{group_id}/roles
Lists the organization roles assigned to a group within the organization.
Parameters
-
groupID string -
query AdminOrganizationGroupRoleListParams-
After param.Field[string]Cursor for pagination. Provide the value from the previous response's
nextfield to continue listing organization roles. -
Limit param.Field[int64]A limit on the number of organization role assignments to return.
-
Order param.Field[AdminOrganizationGroupRoleListParamsOrder]Sort order for the returned organization roles.
-
const AdminOrganizationGroupRoleListParamsOrderAsc AdminOrganizationGroupRoleListParamsOrder = "asc" -
const AdminOrganizationGroupRoleListParamsOrderDesc AdminOrganizationGroupRoleListParamsOrder = "desc"
-
-
Returns
-
type AdminOrganizationGroupRoleListResponse struct{…}Detailed information about a role assignment entry returned when listing assignments.
-
ID stringIdentifier for the role.
-
AssignmentSources []AdminOrganizationGroupRoleListResponseAssignmentSourcePrincipals from which the role assignment is inherited, when available.
-
PrincipalID string -
PrincipalType string
-
-
CreatedAt int64When the role was created.
-
CreatedBy stringIdentifier of the actor who created the role.
-
CreatedByUserObj map[string, any]User details for the actor that created the role, when available.
-
Description stringDescription of the role.
-
Metadata map[string, any]Arbitrary metadata stored on the role.
-
Name stringName of the role.
-
Permissions []stringPermissions associated with the role.
-
PredefinedRole boolWhether the role is predefined by OpenAI.
-
ResourceType stringResource type the role applies to.
-
UpdatedAt int64When the role was last updated.
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
page, err := client.Admin.Organization.Groups.Roles.List(
context.TODO(),
"group_id",
openai.AdminOrganizationGroupRoleListParams{
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
Response
{
"data": [
{
"id": "id",
"assignment_sources": [
{
"principal_id": "principal_id",
"principal_type": "principal_type"
}
],
"created_at": 0,
"created_by": "created_by",
"created_by_user_obj": {
"foo": "bar"
},
"description": "description",
"metadata": {
"foo": "bar"
},
"name": "name",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type",
"updated_at": 0
}
],
"has_more": true,
"next": "next",
"object": "list"
}
Assign organization role to group
client.Admin.Organization.Groups.Roles.New(ctx, groupID, body) (*AdminOrganizationGroupRoleNewResponse, error)
post /organization/groups/{group_id}/roles
Assigns an organization role to a group within the organization.
Parameters
-
groupID string -
body AdminOrganizationGroupRoleNewParams-
RoleID param.Field[string]Identifier of the role to assign.
-
Returns
-
type AdminOrganizationGroupRoleNewResponse struct{…}Role assignment linking a group to a role.
-
Group AdminOrganizationGroupRoleNewResponseGroupSummary information about a group returned in role assignment responses.
-
ID stringIdentifier for the group.
-
CreatedAt int64Unix timestamp (in seconds) when the group was created.
-
Name stringDisplay name of the group.
-
Object GroupAlways
group.const GroupGroup Group = "group"
-
ScimManaged boolWhether the group is managed through SCIM.
-
-
Object GroupRoleAlways
group.role.const GroupRoleGroupRole GroupRole = "group.role"
-
Role RoleDetails about a role that can be assigned through the public Roles API.
-
ID stringIdentifier for the role.
-
Description stringOptional description of the role.
-
Name stringUnique name for the role.
-
Object RoleAlways
role.const RoleRole Role = "role"
-
Permissions []stringPermissions granted by the role.
-
PredefinedRole boolWhether the role is predefined and managed by OpenAI.
-
ResourceType stringResource type the role is bound to (for example
api.organizationorapi.project).
-
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
role, err := client.Admin.Organization.Groups.Roles.New(
context.TODO(),
"group_id",
openai.AdminOrganizationGroupRoleNewParams{
RoleID: "role_id",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", role.Group)
}
Response
{
"group": {
"id": "id",
"created_at": 0,
"name": "name",
"object": "group",
"scim_managed": true
},
"object": "group.role",
"role": {
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
}
}
Retrieve group organization role
client.Admin.Organization.Groups.Roles.Get(ctx, groupID, roleID) (*AdminOrganizationGroupRoleGetResponse, error)
get /organization/groups/{group_id}/roles/{role_id}
Retrieves an organization role assigned to a group.
Parameters
-
groupID string -
roleID string
Returns
-
type AdminOrganizationGroupRoleGetResponse struct{…}Detailed information about a role assignment entry returned when listing assignments.
-
ID stringIdentifier for the role.
-
AssignmentSources []AdminOrganizationGroupRoleGetResponseAssignmentSourcePrincipals from which the role assignment is inherited, when available.
-
PrincipalID string -
PrincipalType string
-
-
CreatedAt int64When the role was created.
-
CreatedBy stringIdentifier of the actor who created the role.
-
CreatedByUserObj map[string, any]User details for the actor that created the role, when available.
-
Description stringDescription of the role.
-
Metadata map[string, any]Arbitrary metadata stored on the role.
-
Name stringName of the role.
-
Permissions []stringPermissions associated with the role.
-
PredefinedRole boolWhether the role is predefined by OpenAI.
-
ResourceType stringResource type the role applies to.
-
UpdatedAt int64When the role was last updated.
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
role, err := client.Admin.Organization.Groups.Roles.Get(
context.TODO(),
"group_id",
"role_id",
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", role.ID)
}
Response
{
"id": "id",
"assignment_sources": [
{
"principal_id": "principal_id",
"principal_type": "principal_type"
}
],
"created_at": 0,
"created_by": "created_by",
"created_by_user_obj": {
"foo": "bar"
},
"description": "description",
"metadata": {
"foo": "bar"
},
"name": "name",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type",
"updated_at": 0
}
Unassign organization role from group
client.Admin.Organization.Groups.Roles.Delete(ctx, groupID, roleID) (*AdminOrganizationGroupRoleDeleteResponse, error)
delete /organization/groups/{group_id}/roles/{role_id}
Unassigns an organization role from a group within the organization.
Parameters
-
groupID string -
roleID string
Returns
-
type AdminOrganizationGroupRoleDeleteResponse struct{…}Confirmation payload returned after unassigning a role.
-
Deleted boolWhether the assignment was removed.
-
Object stringIdentifier for the deleted assignment, such as
group.role.deletedoruser.role.deleted.
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
role, err := client.Admin.Organization.Groups.Roles.Delete(
context.TODO(),
"group_id",
"role_id",
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", role.Deleted)
}
Response
{
"deleted": true,
"object": "object"
}
Roles
List organization roles
client.Admin.Organization.Roles.List(ctx, query) (*NextCursorPage[Role], error)
get /organization/roles
Lists the roles configured for the organization.
Parameters
-
query AdminOrganizationRoleListParams-
After param.Field[string]Cursor for pagination. Provide the value from the previous response's
nextfield to continue listing roles. -
Limit param.Field[int64]A limit on the number of roles to return. Defaults to 1000.
-
Order param.Field[AdminOrganizationRoleListParamsOrder]Sort order for the returned roles.
-
const AdminOrganizationRoleListParamsOrderAsc AdminOrganizationRoleListParamsOrder = "asc" -
const AdminOrganizationRoleListParamsOrderDesc AdminOrganizationRoleListParamsOrder = "desc"
-
-
Returns
-
type Role struct{…}Details about a role that can be assigned through the public Roles API.
-
ID stringIdentifier for the role.
-
Description stringOptional description of the role.
-
Name stringUnique name for the role.
-
Object RoleAlways
role.const RoleRole Role = "role"
-
Permissions []stringPermissions granted by the role.
-
PredefinedRole boolWhether the role is predefined and managed by OpenAI.
-
ResourceType stringResource type the role is bound to (for example
api.organizationorapi.project).
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
page, err := client.Admin.Organization.Roles.List(context.TODO(), openai.AdminOrganizationRoleListParams{
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
Response
{
"data": [
{
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
}
],
"has_more": true,
"next": "next",
"object": "list"
}
Create organization role
client.Admin.Organization.Roles.New(ctx, body) (*Role, error)
post /organization/roles
Creates a custom role for the organization.
Parameters
-
body AdminOrganizationRoleNewParams-
Permissions param.Field[[]string]Permissions to grant to the role.
-
RoleName param.Field[string]Unique name for the role.
-
Description param.Field[string]Optional description of the role.
-
Returns
-
type Role struct{…}Details about a role that can be assigned through the public Roles API.
-
ID stringIdentifier for the role.
-
Description stringOptional description of the role.
-
Name stringUnique name for the role.
-
Object RoleAlways
role.const RoleRole Role = "role"
-
Permissions []stringPermissions granted by the role.
-
PredefinedRole boolWhether the role is predefined and managed by OpenAI.
-
ResourceType stringResource type the role is bound to (for example
api.organizationorapi.project).
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
role, err := client.Admin.Organization.Roles.New(context.TODO(), openai.AdminOrganizationRoleNewParams{
Permissions: []string{"string"},
RoleName: "role_name",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", role.ID)
}
Response
{
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
}
Retrieve organization role
client.Admin.Organization.Roles.Get(ctx, roleID) (*Role, error)
get /organization/roles/{role_id}
Retrieves an organization role.
Parameters
roleID string
Returns
-
type Role struct{…}Details about a role that can be assigned through the public Roles API.
-
ID stringIdentifier for the role.
-
Description stringOptional description of the role.
-
Name stringUnique name for the role.
-
Object RoleAlways
role.const RoleRole Role = "role"
-
Permissions []stringPermissions granted by the role.
-
PredefinedRole boolWhether the role is predefined and managed by OpenAI.
-
ResourceType stringResource type the role is bound to (for example
api.organizationorapi.project).
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
role, err := client.Admin.Organization.Roles.Get(context.TODO(), "role_id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", role.ID)
}
Response
{
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
}
Update organization role
client.Admin.Organization.Roles.Update(ctx, roleID, body) (*Role, error)
post /organization/roles/{role_id}
Updates an existing organization role.
Parameters
-
roleID string -
body AdminOrganizationRoleUpdateParams-
Description param.Field[string]New description for the role.
-
Permissions param.Field[[]string]Updated set of permissions for the role.
-
RoleName param.Field[string]New name for the role.
-
Returns
-
type Role struct{…}Details about a role that can be assigned through the public Roles API.
-
ID stringIdentifier for the role.
-
Description stringOptional description of the role.
-
Name stringUnique name for the role.
-
Object RoleAlways
role.const RoleRole Role = "role"
-
Permissions []stringPermissions granted by the role.
-
PredefinedRole boolWhether the role is predefined and managed by OpenAI.
-
ResourceType stringResource type the role is bound to (for example
api.organizationorapi.project).
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
role, err := client.Admin.Organization.Roles.Update(
context.TODO(),
"role_id",
openai.AdminOrganizationRoleUpdateParams{
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", role.ID)
}
Response
{
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
}
Delete organization role
client.Admin.Organization.Roles.Delete(ctx, roleID) (*AdminOrganizationRoleDeleteResponse, error)
delete /organization/roles/{role_id}
Deletes a custom role from the organization.
Parameters
roleID string
Returns
-
type AdminOrganizationRoleDeleteResponse struct{…}Confirmation payload returned after deleting a role.
-
ID stringIdentifier of the deleted role.
-
Deleted boolWhether the role was deleted.
-
Object RoleDeletedAlways
role.deleted.const RoleDeletedRoleDeleted RoleDeleted = "role.deleted"
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
role, err := client.Admin.Organization.Roles.Delete(context.TODO(), "role_id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", role.ID)
}
Response
{
"id": "id",
"deleted": true,
"object": "role.deleted"
}
Domain Types
Role
-
type Role struct{…}Details about a role that can be assigned through the public Roles API.
-
ID stringIdentifier for the role.
-
Description stringOptional description of the role.
-
Name stringUnique name for the role.
-
Object RoleAlways
role.const RoleRole Role = "role"
-
Permissions []stringPermissions granted by the role.
-
PredefinedRole boolWhether the role is predefined and managed by OpenAI.
-
ResourceType stringResource type the role is bound to (for example
api.organizationorapi.project).
-
Data Retention
Retrieve organization data retention
client.Admin.Organization.DataRetention.Get(ctx) (*OrganizationDataRetention, error)
get /organization/data_retention
Retrieves organization data retention controls.
Returns
-
type OrganizationDataRetention struct{…}Represents the organization's data retention control setting.
-
Object OrganizationDataRetentionThe object type, which is always
organization.data_retention.const OrganizationDataRetentionOrganizationDataRetention OrganizationDataRetention = "organization.data_retention"
-
Type OrganizationDataRetentionTypeThe configured organization data retention type.
-
const OrganizationDataRetentionTypeZeroDataRetention OrganizationDataRetentionType = "zero_data_retention" -
const OrganizationDataRetentionTypeModifiedAbuseMonitoring OrganizationDataRetentionType = "modified_abuse_monitoring" -
const OrganizationDataRetentionTypeEnhancedZeroDataRetention OrganizationDataRetentionType = "enhanced_zero_data_retention" -
const OrganizationDataRetentionTypeEnhancedModifiedAbuseMonitoring OrganizationDataRetentionType = "enhanced_modified_abuse_monitoring"
-
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
organizationDataRetention, err := client.Admin.Organization.DataRetention.Get(context.TODO())
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", organizationDataRetention.Object)
}
Response
{
"object": "organization.data_retention",
"type": "zero_data_retention"
}
Update organization data retention
client.Admin.Organization.DataRetention.Update(ctx, body) (*OrganizationDataRetention, error)
post /organization/data_retention
Updates organization data retention controls.
Parameters
-
body AdminOrganizationDataRetentionUpdateParams-
RetentionType param.Field[AdminOrganizationDataRetentionUpdateParamsRetentionType]The desired organization data retention type.
-
const AdminOrganizationDataRetentionUpdateParamsRetentionTypeZeroDataRetention AdminOrganizationDataRetentionUpdateParamsRetentionType = "zero_data_retention" -
const AdminOrganizationDataRetentionUpdateParamsRetentionTypeModifiedAbuseMonitoring AdminOrganizationDataRetentionUpdateParamsRetentionType = "modified_abuse_monitoring" -
const AdminOrganizationDataRetentionUpdateParamsRetentionTypeEnhancedZeroDataRetention AdminOrganizationDataRetentionUpdateParamsRetentionType = "enhanced_zero_data_retention" -
const AdminOrganizationDataRetentionUpdateParamsRetentionTypeEnhancedModifiedAbuseMonitoring AdminOrganizationDataRetentionUpdateParamsRetentionType = "enhanced_modified_abuse_monitoring"
-
-
Returns
-
type OrganizationDataRetention struct{…}Represents the organization's data retention control setting.
-
Object OrganizationDataRetentionThe object type, which is always
organization.data_retention.const OrganizationDataRetentionOrganizationDataRetention OrganizationDataRetention = "organization.data_retention"
-
Type OrganizationDataRetentionTypeThe configured organization data retention type.
-
const OrganizationDataRetentionTypeZeroDataRetention OrganizationDataRetentionType = "zero_data_retention" -
const OrganizationDataRetentionTypeModifiedAbuseMonitoring OrganizationDataRetentionType = "modified_abuse_monitoring" -
const OrganizationDataRetentionTypeEnhancedZeroDataRetention OrganizationDataRetentionType = "enhanced_zero_data_retention" -
const OrganizationDataRetentionTypeEnhancedModifiedAbuseMonitoring OrganizationDataRetentionType = "enhanced_modified_abuse_monitoring"
-
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
organizationDataRetention, err := client.Admin.Organization.DataRetention.Update(context.TODO(), openai.AdminOrganizationDataRetentionUpdateParams{
RetentionType: openai.AdminOrganizationDataRetentionUpdateParamsRetentionTypeZeroDataRetention,
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", organizationDataRetention.Object)
}
Response
{
"object": "organization.data_retention",
"type": "zero_data_retention"
}
Domain Types
Organization Data Retention
-
type OrganizationDataRetention struct{…}Represents the organization's data retention control setting.
-
Object OrganizationDataRetentionThe object type, which is always
organization.data_retention.const OrganizationDataRetentionOrganizationDataRetention OrganizationDataRetention = "organization.data_retention"
-
Type OrganizationDataRetentionTypeThe configured organization data retention type.
-
const OrganizationDataRetentionTypeZeroDataRetention OrganizationDataRetentionType = "zero_data_retention" -
const OrganizationDataRetentionTypeModifiedAbuseMonitoring OrganizationDataRetentionType = "modified_abuse_monitoring" -
const OrganizationDataRetentionTypeEnhancedZeroDataRetention OrganizationDataRetentionType = "enhanced_zero_data_retention" -
const OrganizationDataRetentionTypeEnhancedModifiedAbuseMonitoring OrganizationDataRetentionType = "enhanced_modified_abuse_monitoring"
-
-
Spend Alerts
List organization spend alerts
client.Admin.Organization.SpendAlerts.List(ctx, query) (*ConversationCursorPage[OrganizationSpendAlert], error)
get /organization/spend_alerts
Lists organization spend alerts.
Parameters
-
query AdminOrganizationSpendAlertListParams-
After param.Field[string]Cursor for pagination. Provide the ID of the last spend alert from the previous response to fetch the next page.
-
Before param.Field[string]Cursor for pagination. Provide the ID of the first spend alert from the previous response to fetch the previous page.
-
Limit param.Field[int64]A limit on the number of spend alerts to return. Defaults to 20.
-
Order param.Field[AdminOrganizationSpendAlertListParamsOrder]Sort order for the returned spend alerts.
-
const AdminOrganizationSpendAlertListParamsOrderAsc AdminOrganizationSpendAlertListParamsOrder = "asc" -
const AdminOrganizationSpendAlertListParamsOrderDesc AdminOrganizationSpendAlertListParamsOrder = "desc"
-
-
Returns
-
type OrganizationSpendAlert struct{…}Represents a spend alert configured at the organization level.
-
ID stringThe identifier, which can be referenced in API endpoints.
-
Currency OrganizationSpendAlertCurrencyThe currency for the threshold amount.
const OrganizationSpendAlertCurrencyUsd OrganizationSpendAlertCurrency = "USD"
-
Interval OrganizationSpendAlertIntervalThe time interval for evaluating spend against the threshold.
const OrganizationSpendAlertIntervalMonth OrganizationSpendAlertInterval = "month"
-
NotificationChannel OrganizationSpendAlertNotificationChannelEmail notification settings for a spend alert.
-
Recipients []stringEmail addresses that receive the spend alert notification.
-
Type EmailThe notification channel type. Currently only
emailis supported.const EmailEmail Email = "email"
-
SubjectPrefix stringOptional subject prefix for alert emails.
-
-
Object OrganizationSpendAlertThe object type, which is always
organization.spend_alert.const OrganizationSpendAlertOrganizationSpendAlert OrganizationSpendAlert = "organization.spend_alert"
-
ThresholdAmount int64The alert threshold amount, in cents.
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
page, err := client.Admin.Organization.SpendAlerts.List(context.TODO(), openai.AdminOrganizationSpendAlertListParams{
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
Response
{
"data": [
{
"id": "id",
"currency": "USD",
"interval": "month",
"notification_channel": {
"recipients": [
"string"
],
"type": "email",
"subject_prefix": "subject_prefix"
},
"object": "organization.spend_alert",
"threshold_amount": 0
}
],
"first_id": "first_id",
"has_more": true,
"last_id": "last_id",
"object": "list"
}
Create organization spend alert
client.Admin.Organization.SpendAlerts.New(ctx, body) (*OrganizationSpendAlert, error)
post /organization/spend_alerts
Creates an organization spend alert.
Parameters
-
body AdminOrganizationSpendAlertNewParams-
Currency param.Field[AdminOrganizationSpendAlertNewParamsCurrency]The currency for the threshold amount.
const AdminOrganizationSpendAlertNewParamsCurrencyUsd AdminOrganizationSpendAlertNewParamsCurrency = "USD"
-
Interval param.Field[AdminOrganizationSpendAlertNewParamsInterval]The time interval for evaluating spend against the threshold.
const AdminOrganizationSpendAlertNewParamsIntervalMonth AdminOrganizationSpendAlertNewParamsInterval = "month"
-
NotificationChannel param.Field[AdminOrganizationSpendAlertNewParamsNotificationChannel]Email notification settings for a spend alert.
-
Recipients []stringEmail addresses that receive the spend alert notification.
-
Type EmailThe notification channel type. Currently only
emailis supported.const EmailEmail Email = "email"
-
SubjectPrefix stringOptional subject prefix for alert emails.
-
-
ThresholdAmount param.Field[int64]The alert threshold amount, in cents.
-
Returns
-
type OrganizationSpendAlert struct{…}Represents a spend alert configured at the organization level.
-
ID stringThe identifier, which can be referenced in API endpoints.
-
Currency OrganizationSpendAlertCurrencyThe currency for the threshold amount.
const OrganizationSpendAlertCurrencyUsd OrganizationSpendAlertCurrency = "USD"
-
Interval OrganizationSpendAlertIntervalThe time interval for evaluating spend against the threshold.
const OrganizationSpendAlertIntervalMonth OrganizationSpendAlertInterval = "month"
-
NotificationChannel OrganizationSpendAlertNotificationChannelEmail notification settings for a spend alert.
-
Recipients []stringEmail addresses that receive the spend alert notification.
-
Type EmailThe notification channel type. Currently only
emailis supported.const EmailEmail Email = "email"
-
SubjectPrefix stringOptional subject prefix for alert emails.
-
-
Object OrganizationSpendAlertThe object type, which is always
organization.spend_alert.const OrganizationSpendAlertOrganizationSpendAlert OrganizationSpendAlert = "organization.spend_alert"
-
ThresholdAmount int64The alert threshold amount, in cents.
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
organizationSpendAlert, err := client.Admin.Organization.SpendAlerts.New(context.TODO(), openai.AdminOrganizationSpendAlertNewParams{
Currency: openai.AdminOrganizationSpendAlertNewParamsCurrencyUsd,
Interval: openai.AdminOrganizationSpendAlertNewParamsIntervalMonth,
NotificationChannel: openai.AdminOrganizationSpendAlertNewParamsNotificationChannel{
Recipients: []string{"string"},
},
ThresholdAmount: 0,
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", organizationSpendAlert.ID)
}
Response
{
"id": "id",
"currency": "USD",
"interval": "month",
"notification_channel": {
"recipients": [
"string"
],
"type": "email",
"subject_prefix": "subject_prefix"
},
"object": "organization.spend_alert",
"threshold_amount": 0
}
Retrieve organization spend alert
client.Admin.Organization.SpendAlerts.Get(ctx, alertID) (*OrganizationSpendAlert, error)
get /organization/spend_alerts/{alert_id}
Retrieves an organization spend alert.
Parameters
alertID string
Returns
-
type OrganizationSpendAlert struct{…}Represents a spend alert configured at the organization level.
-
ID stringThe identifier, which can be referenced in API endpoints.
-
Currency OrganizationSpendAlertCurrencyThe currency for the threshold amount.
const OrganizationSpendAlertCurrencyUsd OrganizationSpendAlertCurrency = "USD"
-
Interval OrganizationSpendAlertIntervalThe time interval for evaluating spend against the threshold.
const OrganizationSpendAlertIntervalMonth OrganizationSpendAlertInterval = "month"
-
NotificationChannel OrganizationSpendAlertNotificationChannelEmail notification settings for a spend alert.
-
Recipients []stringEmail addresses that receive the spend alert notification.
-
Type EmailThe notification channel type. Currently only
emailis supported.const EmailEmail Email = "email"
-
SubjectPrefix stringOptional subject prefix for alert emails.
-
-
Object OrganizationSpendAlertThe object type, which is always
organization.spend_alert.const OrganizationSpendAlertOrganizationSpendAlert OrganizationSpendAlert = "organization.spend_alert"
-
ThresholdAmount int64The alert threshold amount, in cents.
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
organizationSpendAlert, err := client.Admin.Organization.SpendAlerts.Get(context.TODO(), "alert_id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", organizationSpendAlert.ID)
}
Response
{
"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
client.Admin.Organization.SpendAlerts.Update(ctx, alertID, body) (*OrganizationSpendAlert, error)
post /organization/spend_alerts/{alert_id}
Updates an organization spend alert.
Parameters
-
alertID string -
body AdminOrganizationSpendAlertUpdateParams-
Currency param.Field[AdminOrganizationSpendAlertUpdateParamsCurrency]The currency for the threshold amount.
const AdminOrganizationSpendAlertUpdateParamsCurrencyUsd AdminOrganizationSpendAlertUpdateParamsCurrency = "USD"
-
Interval param.Field[AdminOrganizationSpendAlertUpdateParamsInterval]The time interval for evaluating spend against the threshold.
const AdminOrganizationSpendAlertUpdateParamsIntervalMonth AdminOrganizationSpendAlertUpdateParamsInterval = "month"
-
NotificationChannel param.Field[AdminOrganizationSpendAlertUpdateParamsNotificationChannel]Email notification settings for a spend alert.
-
Recipients []stringEmail addresses that receive the spend alert notification.
-
Type EmailThe notification channel type. Currently only
emailis supported.const EmailEmail Email = "email"
-
SubjectPrefix stringOptional subject prefix for alert emails.
-
-
ThresholdAmount param.Field[int64]The alert threshold amount, in cents.
-
Returns
-
type OrganizationSpendAlert struct{…}Represents a spend alert configured at the organization level.
-
ID stringThe identifier, which can be referenced in API endpoints.
-
Currency OrganizationSpendAlertCurrencyThe currency for the threshold amount.
const OrganizationSpendAlertCurrencyUsd OrganizationSpendAlertCurrency = "USD"
-
Interval OrganizationSpendAlertIntervalThe time interval for evaluating spend against the threshold.
const OrganizationSpendAlertIntervalMonth OrganizationSpendAlertInterval = "month"
-
NotificationChannel OrganizationSpendAlertNotificationChannelEmail notification settings for a spend alert.
-
Recipients []stringEmail addresses that receive the spend alert notification.
-
Type EmailThe notification channel type. Currently only
emailis supported.const EmailEmail Email = "email"
-
SubjectPrefix stringOptional subject prefix for alert emails.
-
-
Object OrganizationSpendAlertThe object type, which is always
organization.spend_alert.const OrganizationSpendAlertOrganizationSpendAlert OrganizationSpendAlert = "organization.spend_alert"
-
ThresholdAmount int64The alert threshold amount, in cents.
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
organizationSpendAlert, err := client.Admin.Organization.SpendAlerts.Update(
context.TODO(),
"alert_id",
openai.AdminOrganizationSpendAlertUpdateParams{
Currency: openai.AdminOrganizationSpendAlertUpdateParamsCurrencyUsd,
Interval: openai.AdminOrganizationSpendAlertUpdateParamsIntervalMonth,
NotificationChannel: openai.AdminOrganizationSpendAlertUpdateParamsNotificationChannel{
Recipients: []string{"string"},
},
ThresholdAmount: 0,
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", organizationSpendAlert.ID)
}
Response
{
"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
client.Admin.Organization.SpendAlerts.Delete(ctx, alertID) (*OrganizationSpendAlertDeleted, error)
delete /organization/spend_alerts/{alert_id}
Deletes an organization spend alert.
Parameters
alertID string
Returns
-
type OrganizationSpendAlertDeleted struct{…}Confirmation payload returned after deleting an organization spend alert.
-
ID stringThe deleted spend alert ID.
-
Deleted boolWhether the spend alert was deleted.
-
Object OrganizationSpendAlertDeletedAlways
organization.spend_alert.deleted.const OrganizationSpendAlertDeletedOrganizationSpendAlertDeleted OrganizationSpendAlertDeleted = "organization.spend_alert.deleted"
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
organizationSpendAlertDeleted, err := client.Admin.Organization.SpendAlerts.Delete(context.TODO(), "alert_id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", organizationSpendAlertDeleted.ID)
}
Response
{
"id": "id",
"deleted": true,
"object": "organization.spend_alert.deleted"
}
Domain Types
Organization Spend Alert
-
type OrganizationSpendAlert struct{…}Represents a spend alert configured at the organization level.
-
ID stringThe identifier, which can be referenced in API endpoints.
-
Currency OrganizationSpendAlertCurrencyThe currency for the threshold amount.
const OrganizationSpendAlertCurrencyUsd OrganizationSpendAlertCurrency = "USD"
-
Interval OrganizationSpendAlertIntervalThe time interval for evaluating spend against the threshold.
const OrganizationSpendAlertIntervalMonth OrganizationSpendAlertInterval = "month"
-
NotificationChannel OrganizationSpendAlertNotificationChannelEmail notification settings for a spend alert.
-
Recipients []stringEmail addresses that receive the spend alert notification.
-
Type EmailThe notification channel type. Currently only
emailis supported.const EmailEmail Email = "email"
-
SubjectPrefix stringOptional subject prefix for alert emails.
-
-
Object OrganizationSpendAlertThe object type, which is always
organization.spend_alert.const OrganizationSpendAlertOrganizationSpendAlert OrganizationSpendAlert = "organization.spend_alert"
-
ThresholdAmount int64The alert threshold amount, in cents.
-
Organization Spend Alert Deleted
-
type OrganizationSpendAlertDeleted struct{…}Confirmation payload returned after deleting an organization spend alert.
-
ID stringThe deleted spend alert ID.
-
Deleted boolWhether the spend alert was deleted.
-
Object OrganizationSpendAlertDeletedAlways
organization.spend_alert.deleted.const OrganizationSpendAlertDeletedOrganizationSpendAlertDeleted OrganizationSpendAlertDeleted = "organization.spend_alert.deleted"
-
Certificates
List organization certificates
client.Admin.Organization.Certificates.List(ctx, query) (*ConversationCursorPage[AdminOrganizationCertificateListResponse], error)
get /organization/certificates
List uploaded certificates for this organization.
Parameters
-
query AdminOrganizationCertificateListParams-
After param.Field[string]A cursor for use in pagination.
afteris an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. -
Limit param.Field[int64]A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
-
Order param.Field[AdminOrganizationCertificateListParamsOrder]Sort order by the
created_attimestamp of the objects.ascfor ascending order anddescfor descending order.-
const AdminOrganizationCertificateListParamsOrderAsc AdminOrganizationCertificateListParamsOrder = "asc" -
const AdminOrganizationCertificateListParamsOrderDesc AdminOrganizationCertificateListParamsOrder = "desc"
-
-
Returns
-
type AdminOrganizationCertificateListResponse struct{…}Represents an individual certificate configured at the organization level.
-
ID stringThe identifier, which can be referenced in API endpoints
-
Active boolWhether the certificate is currently active at the organization level.
-
CertificateDetails AdminOrganizationCertificateListResponseCertificateDetails-
ExpiresAt int64The Unix timestamp (in seconds) of when the certificate expires.
-
ValidAt int64The Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
CreatedAt int64The Unix timestamp (in seconds) of when the certificate was uploaded.
-
Name stringThe name of the certificate.
-
Object OrganizationCertificateThe object type, which is always
organization.certificate.const OrganizationCertificateOrganizationCertificate OrganizationCertificate = "organization.certificate"
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
page, err := client.Admin.Organization.Certificates.List(context.TODO(), openai.AdminOrganizationCertificateListParams{
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
Response
{
"data": [
{
"id": "id",
"active": true,
"certificate_details": {
"expires_at": 0,
"valid_at": 0
},
"created_at": 0,
"name": "name",
"object": "organization.certificate"
}
],
"first_id": "cert_abc",
"has_more": true,
"last_id": "cert_abc",
"object": "list"
}
Upload certificate
client.Admin.Organization.Certificates.New(ctx, body) (*Certificate, error)
post /organization/certificates
Upload a certificate to the organization. This does not automatically activate the certificate.
Organizations can upload up to 50 certificates.
Parameters
-
body AdminOrganizationCertificateNewParams-
Certificate param.Field[string]The certificate content in PEM format
-
Name param.Field[string]An optional name for the certificate
-
Returns
-
type Certificate struct{…}Represents an individual
certificateuploaded to the organization.-
ID stringThe identifier, which can be referenced in API endpoints
-
CertificateDetails CertificateCertificateDetails-
Content stringThe content of the certificate in PEM format.
-
ExpiresAt int64The Unix timestamp (in seconds) of when the certificate expires.
-
ValidAt int64The Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
CreatedAt int64The Unix timestamp (in seconds) of when the certificate was uploaded.
-
Name stringThe name of the certificate.
-
Object CertificateObjectThe 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. -
const CertificateObjectCertificate CertificateObject = "certificate" -
const CertificateObjectOrganizationCertificate CertificateObject = "organization.certificate" -
const CertificateObjectOrganizationProjectCertificate CertificateObject = "organization.project.certificate"
-
-
Active boolWhether the certificate is currently active at the specified scope. Not returned when getting details for a specific certificate.
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
certificate, err := client.Admin.Organization.Certificates.New(context.TODO(), openai.AdminOrganizationCertificateNewParams{
Certificate: "certificate",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", certificate.ID)
}
Response
{
"id": "id",
"certificate_details": {
"content": "content",
"expires_at": 0,
"valid_at": 0
},
"created_at": 0,
"name": "name",
"object": "certificate",
"active": true
}
Get certificate
client.Admin.Organization.Certificates.Get(ctx, certificateID, query) (*Certificate, error)
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
-
certificateID string -
query AdminOrganizationCertificateGetParams-
Include param.Field[[]string]A list of additional fields to include in the response. Currently the only supported value is
contentto fetch the PEM content of the certificate.const AdminOrganizationCertificateGetParamsIncludeContent AdminOrganizationCertificateGetParamsInclude = "content"
-
Returns
-
type Certificate struct{…}Represents an individual
certificateuploaded to the organization.-
ID stringThe identifier, which can be referenced in API endpoints
-
CertificateDetails CertificateCertificateDetails-
Content stringThe content of the certificate in PEM format.
-
ExpiresAt int64The Unix timestamp (in seconds) of when the certificate expires.
-
ValidAt int64The Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
CreatedAt int64The Unix timestamp (in seconds) of when the certificate was uploaded.
-
Name stringThe name of the certificate.
-
Object CertificateObjectThe 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. -
const CertificateObjectCertificate CertificateObject = "certificate" -
const CertificateObjectOrganizationCertificate CertificateObject = "organization.certificate" -
const CertificateObjectOrganizationProjectCertificate CertificateObject = "organization.project.certificate"
-
-
Active boolWhether the certificate is currently active at the specified scope. Not returned when getting details for a specific certificate.
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
certificate, err := client.Admin.Organization.Certificates.Get(
context.TODO(),
"certificate_id",
openai.AdminOrganizationCertificateGetParams{
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", certificate.ID)
}
Response
{
"id": "id",
"certificate_details": {
"content": "content",
"expires_at": 0,
"valid_at": 0
},
"created_at": 0,
"name": "name",
"object": "certificate",
"active": true
}
Modify certificate
client.Admin.Organization.Certificates.Update(ctx, certificateID, body) (*Certificate, error)
post /organization/certificates/{certificate_id}
Modify a certificate. Note that only the name can be modified.
Parameters
-
certificateID string -
body AdminOrganizationCertificateUpdateParams-
Name param.Field[string]The updated name for the certificate
-
Returns
-
type Certificate struct{…}Represents an individual
certificateuploaded to the organization.-
ID stringThe identifier, which can be referenced in API endpoints
-
CertificateDetails CertificateCertificateDetails-
Content stringThe content of the certificate in PEM format.
-
ExpiresAt int64The Unix timestamp (in seconds) of when the certificate expires.
-
ValidAt int64The Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
CreatedAt int64The Unix timestamp (in seconds) of when the certificate was uploaded.
-
Name stringThe name of the certificate.
-
Object CertificateObjectThe 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. -
const CertificateObjectCertificate CertificateObject = "certificate" -
const CertificateObjectOrganizationCertificate CertificateObject = "organization.certificate" -
const CertificateObjectOrganizationProjectCertificate CertificateObject = "organization.project.certificate"
-
-
Active boolWhether the certificate is currently active at the specified scope. Not returned when getting details for a specific certificate.
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
certificate, err := client.Admin.Organization.Certificates.Update(
context.TODO(),
"certificate_id",
openai.AdminOrganizationCertificateUpdateParams{
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", certificate.ID)
}
Response
{
"id": "id",
"certificate_details": {
"content": "content",
"expires_at": 0,
"valid_at": 0
},
"created_at": 0,
"name": "name",
"object": "certificate",
"active": true
}
Delete certificate
client.Admin.Organization.Certificates.Delete(ctx, certificateID) (*AdminOrganizationCertificateDeleteResponse, error)
delete /organization/certificates/{certificate_id}
Delete a certificate from the organization.
The certificate must be inactive for the organization and all projects.
Parameters
certificateID string
Returns
-
type AdminOrganizationCertificateDeleteResponse struct{…}-
ID stringThe ID of the certificate that was deleted.
-
Object CertificateDeletedThe object type, must be
certificate.deleted.const CertificateDeletedCertificateDeleted CertificateDeleted = "certificate.deleted"
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
certificate, err := client.Admin.Organization.Certificates.Delete(context.TODO(), "certificate_id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", certificate.ID)
}
Response
{
"id": "id",
"object": "certificate.deleted"
}
Activate certificates for organization
client.Admin.Organization.Certificates.Activate(ctx, body) (*Page[AdminOrganizationCertificateActivateResponse], error)
post /organization/certificates/activate
Activate certificates at the organization level.
You can atomically and idempotently activate up to 10 certificates at a time.
Parameters
-
body AdminOrganizationCertificateActivateParamsCertificateIDs param.Field[[]string]
Returns
-
type AdminOrganizationCertificateActivateResponse struct{…}Represents an individual certificate configured at the organization level.
-
ID stringThe identifier, which can be referenced in API endpoints
-
Active boolWhether the certificate is currently active at the organization level.
-
CertificateDetails AdminOrganizationCertificateActivateResponseCertificateDetails-
ExpiresAt int64The Unix timestamp (in seconds) of when the certificate expires.
-
ValidAt int64The Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
CreatedAt int64The Unix timestamp (in seconds) of when the certificate was uploaded.
-
Name stringThe name of the certificate.
-
Object OrganizationCertificateThe object type, which is always
organization.certificate.const OrganizationCertificateOrganizationCertificate OrganizationCertificate = "organization.certificate"
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
page, err := client.Admin.Organization.Certificates.Activate(context.TODO(), openai.AdminOrganizationCertificateActivateParams{
CertificateIDs: []string{"cert_abc"},
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
Response
{
"data": [
{
"id": "id",
"active": true,
"certificate_details": {
"expires_at": 0,
"valid_at": 0
},
"created_at": 0,
"name": "name",
"object": "organization.certificate"
}
],
"object": "organization.certificate.activation"
}
Deactivate certificates for organization
client.Admin.Organization.Certificates.Deactivate(ctx, body) (*Page[AdminOrganizationCertificateDeactivateResponse], error)
post /organization/certificates/deactivate
Deactivate certificates at the organization level.
You can atomically and idempotently deactivate up to 10 certificates at a time.
Parameters
-
body AdminOrganizationCertificateDeactivateParamsCertificateIDs param.Field[[]string]
Returns
-
type AdminOrganizationCertificateDeactivateResponse struct{…}Represents an individual certificate configured at the organization level.
-
ID stringThe identifier, which can be referenced in API endpoints
-
Active boolWhether the certificate is currently active at the organization level.
-
CertificateDetails AdminOrganizationCertificateDeactivateResponseCertificateDetails-
ExpiresAt int64The Unix timestamp (in seconds) of when the certificate expires.
-
ValidAt int64The Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
CreatedAt int64The Unix timestamp (in seconds) of when the certificate was uploaded.
-
Name stringThe name of the certificate.
-
Object OrganizationCertificateThe object type, which is always
organization.certificate.const OrganizationCertificateOrganizationCertificate OrganizationCertificate = "organization.certificate"
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
page, err := client.Admin.Organization.Certificates.Deactivate(context.TODO(), openai.AdminOrganizationCertificateDeactivateParams{
CertificateIDs: []string{"cert_abc"},
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
Response
{
"data": [
{
"id": "id",
"active": true,
"certificate_details": {
"expires_at": 0,
"valid_at": 0
},
"created_at": 0,
"name": "name",
"object": "organization.certificate"
}
],
"object": "organization.certificate.deactivation"
}
Domain Types
Certificate
-
type Certificate struct{…}Represents an individual
certificateuploaded to the organization.-
ID stringThe identifier, which can be referenced in API endpoints
-
CertificateDetails CertificateCertificateDetails-
Content stringThe content of the certificate in PEM format.
-
ExpiresAt int64The Unix timestamp (in seconds) of when the certificate expires.
-
ValidAt int64The Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
CreatedAt int64The Unix timestamp (in seconds) of when the certificate was uploaded.
-
Name stringThe name of the certificate.
-
Object CertificateObjectThe 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. -
const CertificateObjectCertificate CertificateObject = "certificate" -
const CertificateObjectOrganizationCertificate CertificateObject = "organization.certificate" -
const CertificateObjectOrganizationProjectCertificate CertificateObject = "organization.project.certificate"
-
-
Active boolWhether the certificate is currently active at the specified scope. Not returned when getting details for a specific certificate.
-
Projects
List projects
client.Admin.Organization.Projects.List(ctx, query) (*ConversationCursorPage[Project], error)
get /organization/projects
Returns a list of projects.
Parameters
-
query AdminOrganizationProjectListParams-
After param.Field[string]A cursor for use in pagination.
afteris an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. -
IncludeArchived param.Field[bool]If
truereturns all projects including those that have beenarchived. Archived projects are not included by default. -
Limit param.Field[int64]A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
-
Returns
-
type Project struct{…}Represents an individual project.
-
ID stringThe identifier, which can be referenced in API endpoints
-
CreatedAt int64The Unix timestamp (in seconds) of when the project was created.
-
Object OrganizationProjectThe object type, which is always
organization.projectconst OrganizationProjectOrganizationProject OrganizationProject = "organization.project"
-
ArchivedAt int64The Unix timestamp (in seconds) of when the project was archived or
null. -
ExternalKeyID stringThe external key associated with the project.
-
Name stringThe name of the project. This appears in reporting.
-
Status stringactiveorarchived
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
page, err := client.Admin.Organization.Projects.List(context.TODO(), openai.AdminOrganizationProjectListParams{
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
Response
{
"data": [
{
"id": "id",
"created_at": 0,
"object": "organization.project",
"archived_at": 0,
"external_key_id": "external_key_id",
"name": "name",
"status": "status"
}
],
"has_more": true,
"object": "list",
"first_id": "first_id",
"last_id": "last_id"
}
Create project
client.Admin.Organization.Projects.New(ctx, body) (*Project, error)
post /organization/projects
Create a new project in the organization. Projects can be created and archived, but cannot be deleted.
Parameters
-
body AdminOrganizationProjectNewParams-
Name param.Field[string]The friendly name of the project, this name appears in reports.
-
ExternalKeyID param.Field[string]External key ID to associate with the project.
-
Geography param.Field[string]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 to review the functionality and limitations of setting this field.
-
Returns
-
type Project struct{…}Represents an individual project.
-
ID stringThe identifier, which can be referenced in API endpoints
-
CreatedAt int64The Unix timestamp (in seconds) of when the project was created.
-
Object OrganizationProjectThe object type, which is always
organization.projectconst OrganizationProjectOrganizationProject OrganizationProject = "organization.project"
-
ArchivedAt int64The Unix timestamp (in seconds) of when the project was archived or
null. -
ExternalKeyID stringThe external key associated with the project.
-
Name stringThe name of the project. This appears in reporting.
-
Status stringactiveorarchived
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
project, err := client.Admin.Organization.Projects.New(context.TODO(), openai.AdminOrganizationProjectNewParams{
Name: "name",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", project.ID)
}
Response
{
"id": "id",
"created_at": 0,
"object": "organization.project",
"archived_at": 0,
"external_key_id": "external_key_id",
"name": "name",
"status": "status"
}
Retrieve project
client.Admin.Organization.Projects.Get(ctx, projectID) (*Project, error)
get /organization/projects/{project_id}
Retrieves a project.
Parameters
projectID string
Returns
-
type Project struct{…}Represents an individual project.
-
ID stringThe identifier, which can be referenced in API endpoints
-
CreatedAt int64The Unix timestamp (in seconds) of when the project was created.
-
Object OrganizationProjectThe object type, which is always
organization.projectconst OrganizationProjectOrganizationProject OrganizationProject = "organization.project"
-
ArchivedAt int64The Unix timestamp (in seconds) of when the project was archived or
null. -
ExternalKeyID stringThe external key associated with the project.
-
Name stringThe name of the project. This appears in reporting.
-
Status stringactiveorarchived
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
project, err := client.Admin.Organization.Projects.Get(context.TODO(), "project_id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", project.ID)
}
Response
{
"id": "id",
"created_at": 0,
"object": "organization.project",
"archived_at": 0,
"external_key_id": "external_key_id",
"name": "name",
"status": "status"
}
Modify project
client.Admin.Organization.Projects.Update(ctx, projectID, body) (*Project, error)
post /organization/projects/{project_id}
Modifies a project in the organization.
Parameters
-
projectID string -
body AdminOrganizationProjectUpdateParams-
ExternalKeyID param.Field[string]External key ID to associate with the project.
-
Geography param.Field[string]Geography for the project.
-
Name param.Field[string]The updated name of the project, this name appears in reports.
-
Returns
-
type Project struct{…}Represents an individual project.
-
ID stringThe identifier, which can be referenced in API endpoints
-
CreatedAt int64The Unix timestamp (in seconds) of when the project was created.
-
Object OrganizationProjectThe object type, which is always
organization.projectconst OrganizationProjectOrganizationProject OrganizationProject = "organization.project"
-
ArchivedAt int64The Unix timestamp (in seconds) of when the project was archived or
null. -
ExternalKeyID stringThe external key associated with the project.
-
Name stringThe name of the project. This appears in reporting.
-
Status stringactiveorarchived
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
project, err := client.Admin.Organization.Projects.Update(
context.TODO(),
"project_id",
openai.AdminOrganizationProjectUpdateParams{
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", project.ID)
}
Response
{
"id": "id",
"created_at": 0,
"object": "organization.project",
"archived_at": 0,
"external_key_id": "external_key_id",
"name": "name",
"status": "status"
}
Archive project
client.Admin.Organization.Projects.Archive(ctx, projectID) (*Project, error)
post /organization/projects/{project_id}/archive
Archives a project in the organization. Archived projects cannot be used or updated.
Parameters
projectID string
Returns
-
type Project struct{…}Represents an individual project.
-
ID stringThe identifier, which can be referenced in API endpoints
-
CreatedAt int64The Unix timestamp (in seconds) of when the project was created.
-
Object OrganizationProjectThe object type, which is always
organization.projectconst OrganizationProjectOrganizationProject OrganizationProject = "organization.project"
-
ArchivedAt int64The Unix timestamp (in seconds) of when the project was archived or
null. -
ExternalKeyID stringThe external key associated with the project.
-
Name stringThe name of the project. This appears in reporting.
-
Status stringactiveorarchived
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
project, err := client.Admin.Organization.Projects.Archive(context.TODO(), "project_id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", project.ID)
}
Response
{
"id": "id",
"created_at": 0,
"object": "organization.project",
"archived_at": 0,
"external_key_id": "external_key_id",
"name": "name",
"status": "status"
}
Domain Types
Project
-
type Project struct{…}Represents an individual project.
-
ID stringThe identifier, which can be referenced in API endpoints
-
CreatedAt int64The Unix timestamp (in seconds) of when the project was created.
-
Object OrganizationProjectThe object type, which is always
organization.projectconst OrganizationProjectOrganizationProject OrganizationProject = "organization.project"
-
ArchivedAt int64The Unix timestamp (in seconds) of when the project was archived or
null. -
ExternalKeyID stringThe external key associated with the project.
-
Name stringThe name of the project. This appears in reporting.
-
Status stringactiveorarchived
-
Users
List project users
client.Admin.Organization.Projects.Users.List(ctx, projectID, query) (*ConversationCursorPage[ProjectUser], error)
get /organization/projects/{project_id}/users
Returns a list of users in the project.
Parameters
-
projectID string -
query AdminOrganizationProjectUserListParams-
After param.Field[string]A cursor for use in pagination.
afteris an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. -
Limit param.Field[int64]A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
-
Returns
-
type ProjectUser struct{…}Represents an individual user in a project.
-
ID stringThe identifier, which can be referenced in API endpoints
-
AddedAt int64The Unix timestamp (in seconds) of when the project was added.
-
Object OrganizationProjectUserThe object type, which is always
organization.project.userconst OrganizationProjectUserOrganizationProjectUser OrganizationProjectUser = "organization.project.user"
-
Role stringownerormember -
Email stringThe email address of the user
-
Name stringThe name of the user
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
page, err := client.Admin.Organization.Projects.Users.List(
context.TODO(),
"project_id",
openai.AdminOrganizationProjectUserListParams{
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
Response
{
"data": [
{
"id": "id",
"added_at": 0,
"object": "organization.project.user",
"role": "role",
"email": "email",
"name": "name"
}
],
"has_more": true,
"object": "object",
"first_id": "first_id",
"last_id": "last_id"
}
Create project user
client.Admin.Organization.Projects.Users.New(ctx, projectID, body) (*ProjectUser, error)
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
-
projectID string -
body AdminOrganizationProjectUserNewParams-
Role param.Field[string]ownerormember -
Email param.Field[string]Email of the user to add.
-
UserID param.Field[string]The ID of the user.
-
Returns
-
type ProjectUser struct{…}Represents an individual user in a project.
-
ID stringThe identifier, which can be referenced in API endpoints
-
AddedAt int64The Unix timestamp (in seconds) of when the project was added.
-
Object OrganizationProjectUserThe object type, which is always
organization.project.userconst OrganizationProjectUserOrganizationProjectUser OrganizationProjectUser = "organization.project.user"
-
Role stringownerormember -
Email stringThe email address of the user
-
Name stringThe name of the user
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
projectUser, err := client.Admin.Organization.Projects.Users.New(
context.TODO(),
"project_id",
openai.AdminOrganizationProjectUserNewParams{
Role: "role",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", projectUser.ID)
}
Response
{
"id": "id",
"added_at": 0,
"object": "organization.project.user",
"role": "role",
"email": "email",
"name": "name"
}
Retrieve project user
client.Admin.Organization.Projects.Users.Get(ctx, projectID, userID) (*ProjectUser, error)
get /organization/projects/{project_id}/users/{user_id}
Retrieves a user in the project.
Parameters
-
projectID string -
userID string
Returns
-
type ProjectUser struct{…}Represents an individual user in a project.
-
ID stringThe identifier, which can be referenced in API endpoints
-
AddedAt int64The Unix timestamp (in seconds) of when the project was added.
-
Object OrganizationProjectUserThe object type, which is always
organization.project.userconst OrganizationProjectUserOrganizationProjectUser OrganizationProjectUser = "organization.project.user"
-
Role stringownerormember -
Email stringThe email address of the user
-
Name stringThe name of the user
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
projectUser, err := client.Admin.Organization.Projects.Users.Get(
context.TODO(),
"project_id",
"user_id",
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", projectUser.ID)
}
Response
{
"id": "id",
"added_at": 0,
"object": "organization.project.user",
"role": "role",
"email": "email",
"name": "name"
}
Modify project user
client.Admin.Organization.Projects.Users.Update(ctx, projectID, userID, body) (*ProjectUser, error)
post /organization/projects/{project_id}/users/{user_id}
Modifies a user's role in the project.
Parameters
-
projectID string -
userID string -
body AdminOrganizationProjectUserUpdateParams-
Role param.Field[string]ownerormember
-
Returns
-
type ProjectUser struct{…}Represents an individual user in a project.
-
ID stringThe identifier, which can be referenced in API endpoints
-
AddedAt int64The Unix timestamp (in seconds) of when the project was added.
-
Object OrganizationProjectUserThe object type, which is always
organization.project.userconst OrganizationProjectUserOrganizationProjectUser OrganizationProjectUser = "organization.project.user"
-
Role stringownerormember -
Email stringThe email address of the user
-
Name stringThe name of the user
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
projectUser, err := client.Admin.Organization.Projects.Users.Update(
context.TODO(),
"project_id",
"user_id",
openai.AdminOrganizationProjectUserUpdateParams{
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", projectUser.ID)
}
Response
{
"id": "id",
"added_at": 0,
"object": "organization.project.user",
"role": "role",
"email": "email",
"name": "name"
}
Delete project user
client.Admin.Organization.Projects.Users.Delete(ctx, projectID, userID) (*AdminOrganizationProjectUserDeleteResponse, error)
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
-
projectID string -
userID string
Returns
-
type AdminOrganizationProjectUserDeleteResponse struct{…}-
ID string -
Deleted bool -
Object OrganizationProjectUserDeletedconst OrganizationProjectUserDeletedOrganizationProjectUserDeleted OrganizationProjectUserDeleted = "organization.project.user.deleted"
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
user, err := client.Admin.Organization.Projects.Users.Delete(
context.TODO(),
"project_id",
"user_id",
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", user.ID)
}
Response
{
"id": "id",
"deleted": true,
"object": "organization.project.user.deleted"
}
Domain Types
Project User
-
type ProjectUser struct{…}Represents an individual user in a project.
-
ID stringThe identifier, which can be referenced in API endpoints
-
AddedAt int64The Unix timestamp (in seconds) of when the project was added.
-
Object OrganizationProjectUserThe object type, which is always
organization.project.userconst OrganizationProjectUserOrganizationProjectUser OrganizationProjectUser = "organization.project.user"
-
Role stringownerormember -
Email stringThe email address of the user
-
Name stringThe name of the user
-
Roles
List project user role assignments
client.Admin.Organization.Projects.Users.Roles.List(ctx, projectID, userID, query) (*NextCursorPage[AdminOrganizationProjectUserRoleListResponse], error)
get /projects/{project_id}/users/{user_id}/roles
Lists the project roles assigned to a user within a project.
Parameters
-
projectID string -
userID string -
query AdminOrganizationProjectUserRoleListParams-
After param.Field[string]Cursor for pagination. Provide the value from the previous response's
nextfield to continue listing project roles. -
Limit param.Field[int64]A limit on the number of project role assignments to return.
-
Order param.Field[AdminOrganizationProjectUserRoleListParamsOrder]Sort order for the returned project roles.
-
const AdminOrganizationProjectUserRoleListParamsOrderAsc AdminOrganizationProjectUserRoleListParamsOrder = "asc" -
const AdminOrganizationProjectUserRoleListParamsOrderDesc AdminOrganizationProjectUserRoleListParamsOrder = "desc"
-
-
Returns
-
type AdminOrganizationProjectUserRoleListResponse struct{…}Detailed information about a role assignment entry returned when listing assignments.
-
ID stringIdentifier for the role.
-
AssignmentSources []AdminOrganizationProjectUserRoleListResponseAssignmentSourcePrincipals from which the role assignment is inherited, when available.
-
PrincipalID string -
PrincipalType string
-
-
CreatedAt int64When the role was created.
-
CreatedBy stringIdentifier of the actor who created the role.
-
CreatedByUserObj map[string, any]User details for the actor that created the role, when available.
-
Description stringDescription of the role.
-
Metadata map[string, any]Arbitrary metadata stored on the role.
-
Name stringName of the role.
-
Permissions []stringPermissions associated with the role.
-
PredefinedRole boolWhether the role is predefined by OpenAI.
-
ResourceType stringResource type the role applies to.
-
UpdatedAt int64When the role was last updated.
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
page, err := client.Admin.Organization.Projects.Users.Roles.List(
context.TODO(),
"project_id",
"user_id",
openai.AdminOrganizationProjectUserRoleListParams{
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
Response
{
"data": [
{
"id": "id",
"assignment_sources": [
{
"principal_id": "principal_id",
"principal_type": "principal_type"
}
],
"created_at": 0,
"created_by": "created_by",
"created_by_user_obj": {
"foo": "bar"
},
"description": "description",
"metadata": {
"foo": "bar"
},
"name": "name",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type",
"updated_at": 0
}
],
"has_more": true,
"next": "next",
"object": "list"
}
Assign project role to user
client.Admin.Organization.Projects.Users.Roles.New(ctx, projectID, userID, body) (*AdminOrganizationProjectUserRoleNewResponse, error)
post /projects/{project_id}/users/{user_id}/roles
Assigns a project role to a user within a project.
Parameters
-
projectID string -
userID string -
body AdminOrganizationProjectUserRoleNewParams-
RoleID param.Field[string]Identifier of the role to assign.
-
Returns
-
type AdminOrganizationProjectUserRoleNewResponse struct{…}Role assignment linking a user to a role.
-
Object UserRoleAlways
user.role.const UserRoleUserRole UserRole = "user.role"
-
Role RoleDetails about a role that can be assigned through the public Roles API.
-
ID stringIdentifier for the role.
-
Description stringOptional description of the role.
-
Name stringUnique name for the role.
-
Object RoleAlways
role.const RoleRole Role = "role"
-
Permissions []stringPermissions granted by the role.
-
PredefinedRole boolWhether the role is predefined and managed by OpenAI.
-
ResourceType stringResource type the role is bound to (for example
api.organizationorapi.project).
-
-
User OrganizationUserRepresents an individual
userwithin an organization.-
ID stringThe identifier, which can be referenced in API endpoints
-
AddedAt int64The Unix timestamp (in seconds) of when the user was added.
-
Object OrganizationUserThe object type, which is always
organization.userconst OrganizationUserOrganizationUser OrganizationUser = "organization.user"
-
APIKeyLastUsedAt int64The Unix timestamp (in seconds) of the user's last API key usage.
-
Created int64The Unix timestamp (in seconds) of when the user was created.
-
DeveloperPersona stringThe developer persona metadata for the user.
-
Email stringThe email address of the user
-
IsDefault boolWhether this is the organization's default user.
-
IsScaleTierAuthorizedPurchaser boolWhether the user is an authorized purchaser for Scale Tier.
-
IsScimManaged boolWhether the user is managed through SCIM.
-
IsServiceAccount boolWhether the user is a service account.
-
Name stringThe name of the user
-
Projects OrganizationUserProjectsProjects associated with the user, if included.
-
Data []OrganizationUserProjectsData-
ID string -
Name string -
Role string
-
-
Object Listconst ListList List = "list"
-
-
Role stringownerorreader -
TechnicalLevel stringThe technical level metadata for the user.
-
User OrganizationUserUserNested user details.
-
ID string -
Object Userconst UserUser User = "user"
-
Banned bool -
BannedAt int64 -
Email string -
Enabled bool -
Name string -
Picture string
-
-
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
role, err := client.Admin.Organization.Projects.Users.Roles.New(
context.TODO(),
"project_id",
"user_id",
openai.AdminOrganizationProjectUserRoleNewParams{
RoleID: "role_id",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", role.Object)
}
Response
{
"object": "user.role",
"role": {
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
},
"user": {
"id": "id",
"added_at": 0,
"object": "organization.user",
"api_key_last_used_at": 0,
"created": 0,
"developer_persona": "developer_persona",
"email": "email",
"is_default": true,
"is_scale_tier_authorized_purchaser": true,
"is_scim_managed": true,
"is_service_account": true,
"name": "name",
"projects": {
"data": [
{
"id": "id",
"name": "name",
"role": "role"
}
],
"object": "list"
},
"role": "role",
"technical_level": "technical_level",
"user": {
"id": "id",
"object": "user",
"banned": true,
"banned_at": 0,
"email": "email",
"enabled": true,
"name": "name",
"picture": "picture"
}
}
}
Retrieve project user role
client.Admin.Organization.Projects.Users.Roles.Get(ctx, projectID, userID, roleID) (*AdminOrganizationProjectUserRoleGetResponse, error)
get /projects/{project_id}/users/{user_id}/roles/{role_id}
Retrieves a project role assigned to a user.
Parameters
-
projectID string -
userID string -
roleID string
Returns
-
type AdminOrganizationProjectUserRoleGetResponse struct{…}Detailed information about a role assignment entry returned when listing assignments.
-
ID stringIdentifier for the role.
-
AssignmentSources []AdminOrganizationProjectUserRoleGetResponseAssignmentSourcePrincipals from which the role assignment is inherited, when available.
-
PrincipalID string -
PrincipalType string
-
-
CreatedAt int64When the role was created.
-
CreatedBy stringIdentifier of the actor who created the role.
-
CreatedByUserObj map[string, any]User details for the actor that created the role, when available.
-
Description stringDescription of the role.
-
Metadata map[string, any]Arbitrary metadata stored on the role.
-
Name stringName of the role.
-
Permissions []stringPermissions associated with the role.
-
PredefinedRole boolWhether the role is predefined by OpenAI.
-
ResourceType stringResource type the role applies to.
-
UpdatedAt int64When the role was last updated.
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
role, err := client.Admin.Organization.Projects.Users.Roles.Get(
context.TODO(),
"project_id",
"user_id",
"role_id",
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", role.ID)
}
Response
{
"id": "id",
"assignment_sources": [
{
"principal_id": "principal_id",
"principal_type": "principal_type"
}
],
"created_at": 0,
"created_by": "created_by",
"created_by_user_obj": {
"foo": "bar"
},
"description": "description",
"metadata": {
"foo": "bar"
},
"name": "name",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type",
"updated_at": 0
}
Unassign project role from user
client.Admin.Organization.Projects.Users.Roles.Delete(ctx, projectID, userID, roleID) (*AdminOrganizationProjectUserRoleDeleteResponse, error)
delete /projects/{project_id}/users/{user_id}/roles/{role_id}
Unassigns a project role from a user within a project.
Parameters
-
projectID string -
userID string -
roleID string
Returns
-
type AdminOrganizationProjectUserRoleDeleteResponse struct{…}Confirmation payload returned after unassigning a role.
-
Deleted boolWhether the assignment was removed.
-
Object stringIdentifier for the deleted assignment, such as
group.role.deletedoruser.role.deleted.
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
role, err := client.Admin.Organization.Projects.Users.Roles.Delete(
context.TODO(),
"project_id",
"user_id",
"role_id",
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", role.Deleted)
}
Response
{
"deleted": true,
"object": "object"
}
Service Accounts
List project service accounts
client.Admin.Organization.Projects.ServiceAccounts.List(ctx, projectID, query) (*ConversationCursorPage[ProjectServiceAccount], error)
get /organization/projects/{project_id}/service_accounts
Returns a list of service accounts in the project.
Parameters
-
projectID string -
query AdminOrganizationProjectServiceAccountListParams-
After param.Field[string]A cursor for use in pagination.
afteris an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. -
Limit param.Field[int64]A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
-
Returns
-
type ProjectServiceAccount struct{…}Represents an individual service account in a project.
-
ID stringThe identifier, which can be referenced in API endpoints
-
CreatedAt int64The Unix timestamp (in seconds) of when the service account was created
-
Name stringThe name of the service account
-
Object OrganizationProjectServiceAccountThe object type, which is always
organization.project.service_accountconst OrganizationProjectServiceAccountOrganizationProjectServiceAccount OrganizationProjectServiceAccount = "organization.project.service_account"
-
Role ProjectServiceAccountRoleownerormember-
const ProjectServiceAccountRoleOwner ProjectServiceAccountRole = "owner" -
const ProjectServiceAccountRoleMember ProjectServiceAccountRole = "member"
-
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
page, err := client.Admin.Organization.Projects.ServiceAccounts.List(
context.TODO(),
"project_id",
openai.AdminOrganizationProjectServiceAccountListParams{
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
Response
{
"data": [
{
"id": "id",
"created_at": 0,
"name": "name",
"object": "organization.project.service_account",
"role": "owner"
}
],
"has_more": true,
"object": "list",
"first_id": "first_id",
"last_id": "last_id"
}
Create project service account
client.Admin.Organization.Projects.ServiceAccounts.New(ctx, projectID, body) (*AdminOrganizationProjectServiceAccountNewResponse, error)
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
-
projectID string -
body AdminOrganizationProjectServiceAccountNewParams-
Name param.Field[string]The name of the service account being created.
-
Returns
-
type AdminOrganizationProjectServiceAccountNewResponse struct{…}-
ID string -
APIKey AdminOrganizationProjectServiceAccountNewResponseAPIKey-
ID string -
CreatedAt int64 -
Name string -
Object OrganizationProjectServiceAccountAPIKeyThe object type, which is always
organization.project.service_account.api_keyconst OrganizationProjectServiceAccountAPIKeyOrganizationProjectServiceAccountAPIKey OrganizationProjectServiceAccountAPIKey = "organization.project.service_account.api_key"
-
Value string
-
-
CreatedAt int64 -
Name string -
Object OrganizationProjectServiceAccountconst OrganizationProjectServiceAccountOrganizationProjectServiceAccount OrganizationProjectServiceAccount = "organization.project.service_account"
-
Role MemberService accounts can only have one role of type
memberconst MemberMember Member = "member"
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
serviceAccount, err := client.Admin.Organization.Projects.ServiceAccounts.New(
context.TODO(),
"project_id",
openai.AdminOrganizationProjectServiceAccountNewParams{
Name: "name",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", serviceAccount.ID)
}
Response
{
"id": "id",
"api_key": {
"id": "id",
"created_at": 0,
"name": "name",
"object": "organization.project.service_account.api_key",
"value": "value"
},
"created_at": 0,
"name": "name",
"object": "organization.project.service_account",
"role": "member"
}
Retrieve project service account
client.Admin.Organization.Projects.ServiceAccounts.Get(ctx, projectID, serviceAccountID) (*ProjectServiceAccount, error)
get /organization/projects/{project_id}/service_accounts/{service_account_id}
Retrieves a service account in the project.
Parameters
-
projectID string -
serviceAccountID string
Returns
-
type ProjectServiceAccount struct{…}Represents an individual service account in a project.
-
ID stringThe identifier, which can be referenced in API endpoints
-
CreatedAt int64The Unix timestamp (in seconds) of when the service account was created
-
Name stringThe name of the service account
-
Object OrganizationProjectServiceAccountThe object type, which is always
organization.project.service_accountconst OrganizationProjectServiceAccountOrganizationProjectServiceAccount OrganizationProjectServiceAccount = "organization.project.service_account"
-
Role ProjectServiceAccountRoleownerormember-
const ProjectServiceAccountRoleOwner ProjectServiceAccountRole = "owner" -
const ProjectServiceAccountRoleMember ProjectServiceAccountRole = "member"
-
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
projectServiceAccount, err := client.Admin.Organization.Projects.ServiceAccounts.Get(
context.TODO(),
"project_id",
"service_account_id",
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", projectServiceAccount.ID)
}
Response
{
"id": "id",
"created_at": 0,
"name": "name",
"object": "organization.project.service_account",
"role": "owner"
}
Update project service account
client.Admin.Organization.Projects.ServiceAccounts.Update(ctx, projectID, serviceAccountID, body) (*ProjectServiceAccount, error)
post /organization/projects/{project_id}/service_accounts/{service_account_id}
Updates a service account in the project.
Parameters
-
projectID string -
serviceAccountID string -
body AdminOrganizationProjectServiceAccountUpdateParams-
Name param.Field[string]The updated service account name.
-
Role param.Field[AdminOrganizationProjectServiceAccountUpdateParamsRole]The updated service account role.
-
const AdminOrganizationProjectServiceAccountUpdateParamsRoleMember AdminOrganizationProjectServiceAccountUpdateParamsRole = "member" -
const AdminOrganizationProjectServiceAccountUpdateParamsRoleOwner AdminOrganizationProjectServiceAccountUpdateParamsRole = "owner"
-
-
Returns
-
type ProjectServiceAccount struct{…}Represents an individual service account in a project.
-
ID stringThe identifier, which can be referenced in API endpoints
-
CreatedAt int64The Unix timestamp (in seconds) of when the service account was created
-
Name stringThe name of the service account
-
Object OrganizationProjectServiceAccountThe object type, which is always
organization.project.service_accountconst OrganizationProjectServiceAccountOrganizationProjectServiceAccount OrganizationProjectServiceAccount = "organization.project.service_account"
-
Role ProjectServiceAccountRoleownerormember-
const ProjectServiceAccountRoleOwner ProjectServiceAccountRole = "owner" -
const ProjectServiceAccountRoleMember ProjectServiceAccountRole = "member"
-
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
projectServiceAccount, err := client.Admin.Organization.Projects.ServiceAccounts.Update(
context.TODO(),
"project_id",
"service_account_id",
openai.AdminOrganizationProjectServiceAccountUpdateParams{
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", projectServiceAccount.ID)
}
Response
{
"id": "id",
"created_at": 0,
"name": "name",
"object": "organization.project.service_account",
"role": "owner"
}
Delete project service account
client.Admin.Organization.Projects.ServiceAccounts.Delete(ctx, projectID, serviceAccountID) (*AdminOrganizationProjectServiceAccountDeleteResponse, error)
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
-
projectID string -
serviceAccountID string
Returns
-
type AdminOrganizationProjectServiceAccountDeleteResponse struct{…}-
ID string -
Deleted bool -
Object OrganizationProjectServiceAccountDeletedconst OrganizationProjectServiceAccountDeletedOrganizationProjectServiceAccountDeleted OrganizationProjectServiceAccountDeleted = "organization.project.service_account.deleted"
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
serviceAccount, err := client.Admin.Organization.Projects.ServiceAccounts.Delete(
context.TODO(),
"project_id",
"service_account_id",
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", serviceAccount.ID)
}
Response
{
"id": "id",
"deleted": true,
"object": "organization.project.service_account.deleted"
}
Domain Types
Project Service Account
-
type ProjectServiceAccount struct{…}Represents an individual service account in a project.
-
ID stringThe identifier, which can be referenced in API endpoints
-
CreatedAt int64The Unix timestamp (in seconds) of when the service account was created
-
Name stringThe name of the service account
-
Object OrganizationProjectServiceAccountThe object type, which is always
organization.project.service_accountconst OrganizationProjectServiceAccountOrganizationProjectServiceAccount OrganizationProjectServiceAccount = "organization.project.service_account"
-
Role ProjectServiceAccountRoleownerormember-
const ProjectServiceAccountRoleOwner ProjectServiceAccountRole = "owner" -
const ProjectServiceAccountRoleMember ProjectServiceAccountRole = "member"
-
-
API Keys
List project API keys
client.Admin.Organization.Projects.APIKeys.List(ctx, projectID, query) (*ConversationCursorPage[ProjectAPIKey], error)
get /organization/projects/{project_id}/api_keys
Returns a list of API keys in the project.
Parameters
-
projectID string -
query AdminOrganizationProjectAPIKeyListParams-
After param.Field[string]A cursor for use in pagination.
afteris an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. -
Limit param.Field[int64]A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
-
Returns
-
type ProjectAPIKey struct{…}Represents an individual API key in a project.
-
ID stringThe identifier, which can be referenced in API endpoints
-
CreatedAt int64The Unix timestamp (in seconds) of when the API key was created
-
LastUsedAt int64The Unix timestamp (in seconds) of when the API key was last used.
-
Name stringThe name of the API key
-
Object OrganizationProjectAPIKeyThe object type, which is always
organization.project.api_keyconst OrganizationProjectAPIKeyOrganizationProjectAPIKey OrganizationProjectAPIKey = "organization.project.api_key"
-
Owner ProjectAPIKeyOwner-
ServiceAccount ProjectAPIKeyOwnerServiceAccountThe service account that owns a project API key.
-
ID stringThe identifier, which can be referenced in API endpoints
-
CreatedAt int64The Unix timestamp (in seconds) of when the service account was created.
-
Name stringThe name of the service account.
-
Role stringThe service account's project role.
-
-
Type stringuserorservice_account-
const ProjectAPIKeyOwnerTypeUser ProjectAPIKeyOwnerType = "user" -
const ProjectAPIKeyOwnerTypeServiceAccount ProjectAPIKeyOwnerType = "service_account"
-
-
User ProjectAPIKeyOwnerUserThe user that owns a project API key.
-
ID stringThe identifier, which can be referenced in API endpoints
-
CreatedAt int64The Unix timestamp (in seconds) of when the user was created.
-
Email stringThe email address of the user.
-
Name stringThe name of the user.
-
Role stringThe user's project role.
-
-
-
RedactedValue stringThe redacted value of the API key
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
page, err := client.Admin.Organization.Projects.APIKeys.List(
context.TODO(),
"project_id",
openai.AdminOrganizationProjectAPIKeyListParams{
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
Response
{
"data": [
{
"id": "id",
"created_at": 0,
"last_used_at": 0,
"name": "name",
"object": "organization.project.api_key",
"owner": {
"service_account": {
"id": "id",
"created_at": 0,
"name": "name",
"role": "role"
},
"type": "user",
"user": {
"id": "id",
"created_at": 0,
"email": "email",
"name": "name",
"role": "role"
}
},
"redacted_value": "redacted_value"
}
],
"has_more": true,
"object": "list",
"first_id": "first_id",
"last_id": "last_id"
}
Retrieve project API key
client.Admin.Organization.Projects.APIKeys.Get(ctx, projectID, apiKeyID) (*ProjectAPIKey, error)
get /organization/projects/{project_id}/api_keys/{api_key_id}
Retrieves an API key in the project.
Parameters
-
projectID string -
apiKeyID string
Returns
-
type ProjectAPIKey struct{…}Represents an individual API key in a project.
-
ID stringThe identifier, which can be referenced in API endpoints
-
CreatedAt int64The Unix timestamp (in seconds) of when the API key was created
-
LastUsedAt int64The Unix timestamp (in seconds) of when the API key was last used.
-
Name stringThe name of the API key
-
Object OrganizationProjectAPIKeyThe object type, which is always
organization.project.api_keyconst OrganizationProjectAPIKeyOrganizationProjectAPIKey OrganizationProjectAPIKey = "organization.project.api_key"
-
Owner ProjectAPIKeyOwner-
ServiceAccount ProjectAPIKeyOwnerServiceAccountThe service account that owns a project API key.
-
ID stringThe identifier, which can be referenced in API endpoints
-
CreatedAt int64The Unix timestamp (in seconds) of when the service account was created.
-
Name stringThe name of the service account.
-
Role stringThe service account's project role.
-
-
Type stringuserorservice_account-
const ProjectAPIKeyOwnerTypeUser ProjectAPIKeyOwnerType = "user" -
const ProjectAPIKeyOwnerTypeServiceAccount ProjectAPIKeyOwnerType = "service_account"
-
-
User ProjectAPIKeyOwnerUserThe user that owns a project API key.
-
ID stringThe identifier, which can be referenced in API endpoints
-
CreatedAt int64The Unix timestamp (in seconds) of when the user was created.
-
Email stringThe email address of the user.
-
Name stringThe name of the user.
-
Role stringThe user's project role.
-
-
-
RedactedValue stringThe redacted value of the API key
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
projectAPIKey, err := client.Admin.Organization.Projects.APIKeys.Get(
context.TODO(),
"project_id",
"api_key_id",
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", projectAPIKey.ID)
}
Response
{
"id": "id",
"created_at": 0,
"last_used_at": 0,
"name": "name",
"object": "organization.project.api_key",
"owner": {
"service_account": {
"id": "id",
"created_at": 0,
"name": "name",
"role": "role"
},
"type": "user",
"user": {
"id": "id",
"created_at": 0,
"email": "email",
"name": "name",
"role": "role"
}
},
"redacted_value": "redacted_value"
}
Delete project API key
client.Admin.Organization.Projects.APIKeys.Delete(ctx, projectID, apiKeyID) (*AdminOrganizationProjectAPIKeyDeleteResponse, error)
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
-
projectID string -
apiKeyID string
Returns
-
type AdminOrganizationProjectAPIKeyDeleteResponse struct{…}-
ID string -
Deleted bool -
Object OrganizationProjectAPIKeyDeletedconst OrganizationProjectAPIKeyDeletedOrganizationProjectAPIKeyDeleted OrganizationProjectAPIKeyDeleted = "organization.project.api_key.deleted"
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
apiKey, err := client.Admin.Organization.Projects.APIKeys.Delete(
context.TODO(),
"project_id",
"api_key_id",
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", apiKey.ID)
}
Response
{
"id": "id",
"deleted": true,
"object": "organization.project.api_key.deleted"
}
Domain Types
Project API Key
-
type ProjectAPIKey struct{…}Represents an individual API key in a project.
-
ID stringThe identifier, which can be referenced in API endpoints
-
CreatedAt int64The Unix timestamp (in seconds) of when the API key was created
-
LastUsedAt int64The Unix timestamp (in seconds) of when the API key was last used.
-
Name stringThe name of the API key
-
Object OrganizationProjectAPIKeyThe object type, which is always
organization.project.api_keyconst OrganizationProjectAPIKeyOrganizationProjectAPIKey OrganizationProjectAPIKey = "organization.project.api_key"
-
Owner ProjectAPIKeyOwner-
ServiceAccount ProjectAPIKeyOwnerServiceAccountThe service account that owns a project API key.
-
ID stringThe identifier, which can be referenced in API endpoints
-
CreatedAt int64The Unix timestamp (in seconds) of when the service account was created.
-
Name stringThe name of the service account.
-
Role stringThe service account's project role.
-
-
Type stringuserorservice_account-
const ProjectAPIKeyOwnerTypeUser ProjectAPIKeyOwnerType = "user" -
const ProjectAPIKeyOwnerTypeServiceAccount ProjectAPIKeyOwnerType = "service_account"
-
-
User ProjectAPIKeyOwnerUserThe user that owns a project API key.
-
ID stringThe identifier, which can be referenced in API endpoints
-
CreatedAt int64The Unix timestamp (in seconds) of when the user was created.
-
Email stringThe email address of the user.
-
Name stringThe name of the user.
-
Role stringThe user's project role.
-
-
-
RedactedValue stringThe redacted value of the API key
-
Rate Limits
List project rate limits
client.Admin.Organization.Projects.RateLimits.ListRateLimits(ctx, projectID, query) (*ConversationCursorPage[ProjectRateLimit], error)
get /organization/projects/{project_id}/rate_limits
Returns the rate limits per model for a project.
Parameters
-
projectID string -
query AdminOrganizationProjectRateLimitListRateLimitsParams-
After param.Field[string]A cursor for use in pagination.
afteris an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. -
Before param.Field[string]A cursor for use in pagination.
beforeis an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, beginning with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. -
Limit param.Field[int64]A limit on the number of objects to be returned. The default is 100.
-
Returns
-
type ProjectRateLimit struct{…}Represents a project rate limit config.
-
ID stringThe identifier, which can be referenced in API endpoints.
-
MaxRequestsPer1Minute int64The maximum requests per minute.
-
MaxTokensPer1Minute int64The maximum tokens per minute.
-
Model stringThe model this rate limit applies to.
-
Object ProjectRateLimitThe object type, which is always
project.rate_limitconst ProjectRateLimitProjectRateLimit ProjectRateLimit = "project.rate_limit"
-
Batch1DayMaxInputTokens int64The maximum batch input tokens per day. Only present for relevant models.
-
MaxAudioMegabytesPer1Minute int64The maximum audio megabytes per minute. Only present for relevant models.
-
MaxImagesPer1Minute int64The maximum images per minute. Only present for relevant models.
-
MaxRequestsPer1Day int64The maximum requests per day. Only present for relevant models.
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
page, err := client.Admin.Organization.Projects.RateLimits.ListRateLimits(
context.TODO(),
"project_id",
openai.AdminOrganizationProjectRateLimitListRateLimitsParams{
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
Response
{
"data": [
{
"id": "id",
"max_requests_per_1_minute": 0,
"max_tokens_per_1_minute": 0,
"model": "model",
"object": "project.rate_limit",
"batch_1_day_max_input_tokens": 0,
"max_audio_megabytes_per_1_minute": 0,
"max_images_per_1_minute": 0,
"max_requests_per_1_day": 0
}
],
"has_more": true,
"object": "list",
"first_id": "first_id",
"last_id": "last_id"
}
Modify project rate limit
client.Admin.Organization.Projects.RateLimits.UpdateRateLimit(ctx, projectID, rateLimitID, body) (*ProjectRateLimit, error)
post /organization/projects/{project_id}/rate_limits/{rate_limit_id}
Updates a project rate limit.
Parameters
-
projectID string -
rateLimitID string -
body AdminOrganizationProjectRateLimitUpdateRateLimitParams-
Batch1DayMaxInputTokens param.Field[int64]The maximum batch input tokens per day. Only relevant for certain models.
-
MaxAudioMegabytesPer1Minute param.Field[int64]The maximum audio megabytes per minute. Only relevant for certain models.
-
MaxImagesPer1Minute param.Field[int64]The maximum images per minute. Only relevant for certain models.
-
MaxRequestsPer1Day param.Field[int64]The maximum requests per day. Only relevant for certain models.
-
MaxRequestsPer1Minute param.Field[int64]The maximum requests per minute.
-
MaxTokensPer1Minute param.Field[int64]The maximum tokens per minute.
-
Returns
-
type ProjectRateLimit struct{…}Represents a project rate limit config.
-
ID stringThe identifier, which can be referenced in API endpoints.
-
MaxRequestsPer1Minute int64The maximum requests per minute.
-
MaxTokensPer1Minute int64The maximum tokens per minute.
-
Model stringThe model this rate limit applies to.
-
Object ProjectRateLimitThe object type, which is always
project.rate_limitconst ProjectRateLimitProjectRateLimit ProjectRateLimit = "project.rate_limit"
-
Batch1DayMaxInputTokens int64The maximum batch input tokens per day. Only present for relevant models.
-
MaxAudioMegabytesPer1Minute int64The maximum audio megabytes per minute. Only present for relevant models.
-
MaxImagesPer1Minute int64The maximum images per minute. Only present for relevant models.
-
MaxRequestsPer1Day int64The maximum requests per day. Only present for relevant models.
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
projectRateLimit, err := client.Admin.Organization.Projects.RateLimits.UpdateRateLimit(
context.TODO(),
"project_id",
"rate_limit_id",
openai.AdminOrganizationProjectRateLimitUpdateRateLimitParams{
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", projectRateLimit.ID)
}
Response
{
"id": "id",
"max_requests_per_1_minute": 0,
"max_tokens_per_1_minute": 0,
"model": "model",
"object": "project.rate_limit",
"batch_1_day_max_input_tokens": 0,
"max_audio_megabytes_per_1_minute": 0,
"max_images_per_1_minute": 0,
"max_requests_per_1_day": 0
}
Domain Types
Project Rate Limit
-
type ProjectRateLimit struct{…}Represents a project rate limit config.
-
ID stringThe identifier, which can be referenced in API endpoints.
-
MaxRequestsPer1Minute int64The maximum requests per minute.
-
MaxTokensPer1Minute int64The maximum tokens per minute.
-
Model stringThe model this rate limit applies to.
-
Object ProjectRateLimitThe object type, which is always
project.rate_limitconst ProjectRateLimitProjectRateLimit ProjectRateLimit = "project.rate_limit"
-
Batch1DayMaxInputTokens int64The maximum batch input tokens per day. Only present for relevant models.
-
MaxAudioMegabytesPer1Minute int64The maximum audio megabytes per minute. Only present for relevant models.
-
MaxImagesPer1Minute int64The maximum images per minute. Only present for relevant models.
-
MaxRequestsPer1Day int64The maximum requests per day. Only present for relevant models.
-
Model Permissions
Retrieve project model permissions
client.Admin.Organization.Projects.ModelPermissions.Get(ctx, projectID) (*ProjectModelPermissions, error)
get /organization/projects/{project_id}/model_permissions
Returns model permissions for a project.
Parameters
projectID string
Returns
-
type ProjectModelPermissions struct{…}Represents the model allowlist or denylist policy for a project.
-
Mode ProjectModelPermissionsModeWhether the project uses an allowlist or a denylist.
-
const ProjectModelPermissionsModeAllowList ProjectModelPermissionsMode = "allow_list" -
const ProjectModelPermissionsModeDenyList ProjectModelPermissionsMode = "deny_list"
-
-
ModelIDs []stringThe model IDs included in the model permissions policy.
-
Object ProjectModelPermissionsThe object type, which is always
project.model_permissions.const ProjectModelPermissionsProjectModelPermissions ProjectModelPermissions = "project.model_permissions"
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
projectModelPermissions, err := client.Admin.Organization.Projects.ModelPermissions.Get(context.TODO(), "project_id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", projectModelPermissions.ModelIDs)
}
Response
{
"mode": "allow_list",
"model_ids": [
"string"
],
"object": "project.model_permissions"
}
Modify project model permissions
client.Admin.Organization.Projects.ModelPermissions.Update(ctx, projectID, body) (*ProjectModelPermissions, error)
post /organization/projects/{project_id}/model_permissions
Updates model permissions for a project.
Parameters
-
projectID string -
body AdminOrganizationProjectModelPermissionUpdateParams-
Mode param.Field[AdminOrganizationProjectModelPermissionUpdateParamsMode]The model permissions mode to apply.
-
const AdminOrganizationProjectModelPermissionUpdateParamsModeAllowList AdminOrganizationProjectModelPermissionUpdateParamsMode = "allow_list" -
const AdminOrganizationProjectModelPermissionUpdateParamsModeDenyList AdminOrganizationProjectModelPermissionUpdateParamsMode = "deny_list"
-
-
ModelIDs param.Field[[]string]The model IDs included in this permissions policy.
-
Returns
-
type ProjectModelPermissions struct{…}Represents the model allowlist or denylist policy for a project.
-
Mode ProjectModelPermissionsModeWhether the project uses an allowlist or a denylist.
-
const ProjectModelPermissionsModeAllowList ProjectModelPermissionsMode = "allow_list" -
const ProjectModelPermissionsModeDenyList ProjectModelPermissionsMode = "deny_list"
-
-
ModelIDs []stringThe model IDs included in the model permissions policy.
-
Object ProjectModelPermissionsThe object type, which is always
project.model_permissions.const ProjectModelPermissionsProjectModelPermissions ProjectModelPermissions = "project.model_permissions"
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
projectModelPermissions, err := client.Admin.Organization.Projects.ModelPermissions.Update(
context.TODO(),
"project_id",
openai.AdminOrganizationProjectModelPermissionUpdateParams{
Mode: openai.AdminOrganizationProjectModelPermissionUpdateParamsModeAllowList,
ModelIDs: []string{"string"},
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", projectModelPermissions.ModelIDs)
}
Response
{
"mode": "allow_list",
"model_ids": [
"string"
],
"object": "project.model_permissions"
}
Delete project model permissions
client.Admin.Organization.Projects.ModelPermissions.Delete(ctx, projectID) (*ProjectModelPermissionsDeleted, error)
delete /organization/projects/{project_id}/model_permissions
Deletes model permissions for a project.
Parameters
projectID string
Returns
-
type ProjectModelPermissionsDeleted struct{…}Confirmation payload returned after deleting project model permissions.
-
Deleted boolWhether the project model permissions were deleted.
-
Object ProjectModelPermissionsDeletedThe object type, which is always
project.model_permissions.deleted.const ProjectModelPermissionsDeletedProjectModelPermissionsDeleted ProjectModelPermissionsDeleted = "project.model_permissions.deleted"
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
projectModelPermissionsDeleted, err := client.Admin.Organization.Projects.ModelPermissions.Delete(context.TODO(), "project_id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", projectModelPermissionsDeleted.Deleted)
}
Response
{
"deleted": true,
"object": "project.model_permissions.deleted"
}
Domain Types
Project Model Permissions
-
type ProjectModelPermissions struct{…}Represents the model allowlist or denylist policy for a project.
-
Mode ProjectModelPermissionsModeWhether the project uses an allowlist or a denylist.
-
const ProjectModelPermissionsModeAllowList ProjectModelPermissionsMode = "allow_list" -
const ProjectModelPermissionsModeDenyList ProjectModelPermissionsMode = "deny_list"
-
-
ModelIDs []stringThe model IDs included in the model permissions policy.
-
Object ProjectModelPermissionsThe object type, which is always
project.model_permissions.const ProjectModelPermissionsProjectModelPermissions ProjectModelPermissions = "project.model_permissions"
-
Project Model Permissions Deleted
-
type ProjectModelPermissionsDeleted struct{…}Confirmation payload returned after deleting project model permissions.
-
Deleted boolWhether the project model permissions were deleted.
-
Object ProjectModelPermissionsDeletedThe object type, which is always
project.model_permissions.deleted.const ProjectModelPermissionsDeletedProjectModelPermissionsDeleted ProjectModelPermissionsDeleted = "project.model_permissions.deleted"
-
Hosted Tool Permissions
Retrieve project hosted tool permissions
client.Admin.Organization.Projects.HostedToolPermissions.Get(ctx, projectID) (*ProjectHostedToolPermissions, error)
get /organization/projects/{project_id}/hosted_tool_permissions
Returns hosted tool permissions for a project.
Parameters
projectID string
Returns
-
type ProjectHostedToolPermissions struct{…}Represents hosted tool permissions for a project.
-
CodeInterpreter ProjectHostedToolPermissionsCodeInterpreterPermission state for a single hosted tool on a project.
-
Enabled boolWhether the hosted tool is enabled for the project.
-
-
FileSearch ProjectHostedToolPermissionsFileSearchPermission state for a single hosted tool on a project.
-
Enabled boolWhether the hosted tool is enabled for the project.
-
-
ImageGeneration ProjectHostedToolPermissionsImageGenerationPermission state for a single hosted tool on a project.
-
Enabled boolWhether the hosted tool is enabled for the project.
-
-
Mcp ProjectHostedToolPermissionsMcpPermission state for a single hosted tool on a project.
-
Enabled boolWhether the hosted tool is enabled for the project.
-
-
WebSearch ProjectHostedToolPermissionsWebSearchPermission state for a single hosted tool on a project.
-
Enabled boolWhether the hosted tool is enabled for the project.
-
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
projectHostedToolPermissions, err := client.Admin.Organization.Projects.HostedToolPermissions.Get(context.TODO(), "project_id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", projectHostedToolPermissions.CodeInterpreter)
}
Response
{
"code_interpreter": {
"enabled": true
},
"file_search": {
"enabled": true
},
"image_generation": {
"enabled": true
},
"mcp": {
"enabled": true
},
"web_search": {
"enabled": true
}
}
Modify project hosted tool permissions
client.Admin.Organization.Projects.HostedToolPermissions.Update(ctx, projectID, body) (*ProjectHostedToolPermissions, error)
post /organization/projects/{project_id}/hosted_tool_permissions
Updates hosted tool permissions for a project.
Parameters
-
projectID string -
body AdminOrganizationProjectHostedToolPermissionUpdateParams-
CodeInterpreter param.Field[AdminOrganizationProjectHostedToolPermissionUpdateParamsCodeInterpreter]The code interpreter permission update.
-
Enabled boolWhether to enable the hosted tool for the project.
-
-
FileSearch param.Field[AdminOrganizationProjectHostedToolPermissionUpdateParamsFileSearch]The file search permission update.
-
Enabled boolWhether to enable the hosted tool for the project.
-
-
ImageGeneration param.Field[AdminOrganizationProjectHostedToolPermissionUpdateParamsImageGeneration]The image generation permission update.
-
Enabled boolWhether to enable the hosted tool for the project.
-
-
Mcp param.Field[AdminOrganizationProjectHostedToolPermissionUpdateParamsMcp]The MCP permission update.
-
Enabled boolWhether to enable the hosted tool for the project.
-
-
WebSearch param.Field[AdminOrganizationProjectHostedToolPermissionUpdateParamsWebSearch]The web search permission update.
-
Enabled boolWhether to enable the hosted tool for the project.
-
-
Returns
-
type ProjectHostedToolPermissions struct{…}Represents hosted tool permissions for a project.
-
CodeInterpreter ProjectHostedToolPermissionsCodeInterpreterPermission state for a single hosted tool on a project.
-
Enabled boolWhether the hosted tool is enabled for the project.
-
-
FileSearch ProjectHostedToolPermissionsFileSearchPermission state for a single hosted tool on a project.
-
Enabled boolWhether the hosted tool is enabled for the project.
-
-
ImageGeneration ProjectHostedToolPermissionsImageGenerationPermission state for a single hosted tool on a project.
-
Enabled boolWhether the hosted tool is enabled for the project.
-
-
Mcp ProjectHostedToolPermissionsMcpPermission state for a single hosted tool on a project.
-
Enabled boolWhether the hosted tool is enabled for the project.
-
-
WebSearch ProjectHostedToolPermissionsWebSearchPermission state for a single hosted tool on a project.
-
Enabled boolWhether the hosted tool is enabled for the project.
-
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
projectHostedToolPermissions, err := client.Admin.Organization.Projects.HostedToolPermissions.Update(
context.TODO(),
"project_id",
openai.AdminOrganizationProjectHostedToolPermissionUpdateParams{
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", projectHostedToolPermissions.CodeInterpreter)
}
Response
{
"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
-
type ProjectHostedToolPermissions struct{…}Represents hosted tool permissions for a project.
-
CodeInterpreter ProjectHostedToolPermissionsCodeInterpreterPermission state for a single hosted tool on a project.
-
Enabled boolWhether the hosted tool is enabled for the project.
-
-
FileSearch ProjectHostedToolPermissionsFileSearchPermission state for a single hosted tool on a project.
-
Enabled boolWhether the hosted tool is enabled for the project.
-
-
ImageGeneration ProjectHostedToolPermissionsImageGenerationPermission state for a single hosted tool on a project.
-
Enabled boolWhether the hosted tool is enabled for the project.
-
-
Mcp ProjectHostedToolPermissionsMcpPermission state for a single hosted tool on a project.
-
Enabled boolWhether the hosted tool is enabled for the project.
-
-
WebSearch ProjectHostedToolPermissionsWebSearchPermission state for a single hosted tool on a project.
-
Enabled boolWhether the hosted tool is enabled for the project.
-
-
Groups
List project groups
client.Admin.Organization.Projects.Groups.List(ctx, projectID, query) (*NextCursorPage[ProjectGroup], error)
get /organization/projects/{project_id}/groups
Lists the groups that have access to a project.
Parameters
-
projectID string -
query AdminOrganizationProjectGroupListParams-
After param.Field[string]Cursor for pagination. Provide the ID of the last group from the previous response to fetch the next page.
-
Limit param.Field[int64]A limit on the number of project groups to return. Defaults to 20.
-
Order param.Field[AdminOrganizationProjectGroupListParamsOrder]Sort order for the returned groups.
-
const AdminOrganizationProjectGroupListParamsOrderAsc AdminOrganizationProjectGroupListParamsOrder = "asc" -
const AdminOrganizationProjectGroupListParamsOrderDesc AdminOrganizationProjectGroupListParamsOrder = "desc"
-
-
Returns
-
type ProjectGroup struct{…}Details about a group's membership in a project.
-
CreatedAt int64Unix timestamp (in seconds) when the group was granted project access.
-
GroupID stringIdentifier of the group that has access to the project.
-
GroupName stringDisplay name of the group.
-
GroupType ProjectGroupGroupTypeThe type of the group.
-
const ProjectGroupGroupTypeGroup ProjectGroupGroupType = "group" -
const ProjectGroupGroupTypeTenantGroup ProjectGroupGroupType = "tenant_group"
-
-
Object ProjectGroupAlways
project.group.const ProjectGroupProjectGroup ProjectGroup = "project.group"
-
ProjectID stringIdentifier of the project.
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
page, err := client.Admin.Organization.Projects.Groups.List(
context.TODO(),
"project_id",
openai.AdminOrganizationProjectGroupListParams{
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
Response
{
"data": [
{
"created_at": 0,
"group_id": "group_id",
"group_name": "group_name",
"group_type": "group",
"object": "project.group",
"project_id": "project_id"
}
],
"has_more": true,
"next": "next",
"object": "list"
}
Add project group
client.Admin.Organization.Projects.Groups.New(ctx, projectID, body) (*ProjectGroup, error)
post /organization/projects/{project_id}/groups
Grants a group access to a project.
Parameters
-
projectID string -
body AdminOrganizationProjectGroupNewParams-
GroupID param.Field[string]Identifier of the group to add to the project.
-
Role param.Field[string]Identifier of the project role to grant to the group.
-
Returns
-
type ProjectGroup struct{…}Details about a group's membership in a project.
-
CreatedAt int64Unix timestamp (in seconds) when the group was granted project access.
-
GroupID stringIdentifier of the group that has access to the project.
-
GroupName stringDisplay name of the group.
-
GroupType ProjectGroupGroupTypeThe type of the group.
-
const ProjectGroupGroupTypeGroup ProjectGroupGroupType = "group" -
const ProjectGroupGroupTypeTenantGroup ProjectGroupGroupType = "tenant_group"
-
-
Object ProjectGroupAlways
project.group.const ProjectGroupProjectGroup ProjectGroup = "project.group"
-
ProjectID stringIdentifier of the project.
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
projectGroup, err := client.Admin.Organization.Projects.Groups.New(
context.TODO(),
"project_id",
openai.AdminOrganizationProjectGroupNewParams{
GroupID: "group_id",
Role: "role",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", projectGroup.GroupID)
}
Response
{
"created_at": 0,
"group_id": "group_id",
"group_name": "group_name",
"group_type": "group",
"object": "project.group",
"project_id": "project_id"
}
Retrieve project group
client.Admin.Organization.Projects.Groups.Get(ctx, projectID, groupID, query) (*ProjectGroup, error)
get /organization/projects/{project_id}/groups/{group_id}
Retrieves a project's group.
Parameters
-
projectID string -
groupID string -
query AdminOrganizationProjectGroupGetParams-
GroupType param.Field[AdminOrganizationProjectGroupGetParamsGroupType]The type of group to retrieve.
-
const AdminOrganizationProjectGroupGetParamsGroupTypeGroup AdminOrganizationProjectGroupGetParamsGroupType = "group" -
const AdminOrganizationProjectGroupGetParamsGroupTypeTenantGroup AdminOrganizationProjectGroupGetParamsGroupType = "tenant_group"
-
-
Returns
-
type ProjectGroup struct{…}Details about a group's membership in a project.
-
CreatedAt int64Unix timestamp (in seconds) when the group was granted project access.
-
GroupID stringIdentifier of the group that has access to the project.
-
GroupName stringDisplay name of the group.
-
GroupType ProjectGroupGroupTypeThe type of the group.
-
const ProjectGroupGroupTypeGroup ProjectGroupGroupType = "group" -
const ProjectGroupGroupTypeTenantGroup ProjectGroupGroupType = "tenant_group"
-
-
Object ProjectGroupAlways
project.group.const ProjectGroupProjectGroup ProjectGroup = "project.group"
-
ProjectID stringIdentifier of the project.
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
projectGroup, err := client.Admin.Organization.Projects.Groups.Get(
context.TODO(),
"project_id",
"group_id",
openai.AdminOrganizationProjectGroupGetParams{
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", projectGroup.GroupID)
}
Response
{
"created_at": 0,
"group_id": "group_id",
"group_name": "group_name",
"group_type": "group",
"object": "project.group",
"project_id": "project_id"
}
Remove project group
client.Admin.Organization.Projects.Groups.Delete(ctx, projectID, groupID) (*AdminOrganizationProjectGroupDeleteResponse, error)
delete /organization/projects/{project_id}/groups/{group_id}
Revokes a group's access to a project.
Parameters
-
projectID string -
groupID string
Returns
-
type AdminOrganizationProjectGroupDeleteResponse struct{…}Confirmation payload returned after removing a group from a project.
-
Deleted boolWhether the group membership in the project was removed.
-
Object ProjectGroupDeletedAlways
project.group.deleted.const ProjectGroupDeletedProjectGroupDeleted ProjectGroupDeleted = "project.group.deleted"
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
group, err := client.Admin.Organization.Projects.Groups.Delete(
context.TODO(),
"project_id",
"group_id",
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", group.Deleted)
}
Response
{
"deleted": true,
"object": "project.group.deleted"
}
Domain Types
Project Group
-
type ProjectGroup struct{…}Details about a group's membership in a project.
-
CreatedAt int64Unix timestamp (in seconds) when the group was granted project access.
-
GroupID stringIdentifier of the group that has access to the project.
-
GroupName stringDisplay name of the group.
-
GroupType ProjectGroupGroupTypeThe type of the group.
-
const ProjectGroupGroupTypeGroup ProjectGroupGroupType = "group" -
const ProjectGroupGroupTypeTenantGroup ProjectGroupGroupType = "tenant_group"
-
-
Object ProjectGroupAlways
project.group.const ProjectGroupProjectGroup ProjectGroup = "project.group"
-
ProjectID stringIdentifier of the project.
-
Roles
List project group role assignments
client.Admin.Organization.Projects.Groups.Roles.List(ctx, projectID, groupID, query) (*NextCursorPage[AdminOrganizationProjectGroupRoleListResponse], error)
get /projects/{project_id}/groups/{group_id}/roles
Lists the project roles assigned to a group within a project.
Parameters
-
projectID string -
groupID string -
query AdminOrganizationProjectGroupRoleListParams-
After param.Field[string]Cursor for pagination. Provide the value from the previous response's
nextfield to continue listing project roles. -
Limit param.Field[int64]A limit on the number of project role assignments to return.
-
Order param.Field[AdminOrganizationProjectGroupRoleListParamsOrder]Sort order for the returned project roles.
-
const AdminOrganizationProjectGroupRoleListParamsOrderAsc AdminOrganizationProjectGroupRoleListParamsOrder = "asc" -
const AdminOrganizationProjectGroupRoleListParamsOrderDesc AdminOrganizationProjectGroupRoleListParamsOrder = "desc"
-
-
Returns
-
type AdminOrganizationProjectGroupRoleListResponse struct{…}Detailed information about a role assignment entry returned when listing assignments.
-
ID stringIdentifier for the role.
-
AssignmentSources []AdminOrganizationProjectGroupRoleListResponseAssignmentSourcePrincipals from which the role assignment is inherited, when available.
-
PrincipalID string -
PrincipalType string
-
-
CreatedAt int64When the role was created.
-
CreatedBy stringIdentifier of the actor who created the role.
-
CreatedByUserObj map[string, any]User details for the actor that created the role, when available.
-
Description stringDescription of the role.
-
Metadata map[string, any]Arbitrary metadata stored on the role.
-
Name stringName of the role.
-
Permissions []stringPermissions associated with the role.
-
PredefinedRole boolWhether the role is predefined by OpenAI.
-
ResourceType stringResource type the role applies to.
-
UpdatedAt int64When the role was last updated.
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
page, err := client.Admin.Organization.Projects.Groups.Roles.List(
context.TODO(),
"project_id",
"group_id",
openai.AdminOrganizationProjectGroupRoleListParams{
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
Response
{
"data": [
{
"id": "id",
"assignment_sources": [
{
"principal_id": "principal_id",
"principal_type": "principal_type"
}
],
"created_at": 0,
"created_by": "created_by",
"created_by_user_obj": {
"foo": "bar"
},
"description": "description",
"metadata": {
"foo": "bar"
},
"name": "name",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type",
"updated_at": 0
}
],
"has_more": true,
"next": "next",
"object": "list"
}
Assign project role to group
client.Admin.Organization.Projects.Groups.Roles.New(ctx, projectID, groupID, body) (*AdminOrganizationProjectGroupRoleNewResponse, error)
post /projects/{project_id}/groups/{group_id}/roles
Assigns a project role to a group within a project.
Parameters
-
projectID string -
groupID string -
body AdminOrganizationProjectGroupRoleNewParams-
RoleID param.Field[string]Identifier of the role to assign.
-
Returns
-
type AdminOrganizationProjectGroupRoleNewResponse struct{…}Role assignment linking a group to a role.
-
Group AdminOrganizationProjectGroupRoleNewResponseGroupSummary information about a group returned in role assignment responses.
-
ID stringIdentifier for the group.
-
CreatedAt int64Unix timestamp (in seconds) when the group was created.
-
Name stringDisplay name of the group.
-
Object GroupAlways
group.const GroupGroup Group = "group"
-
ScimManaged boolWhether the group is managed through SCIM.
-
-
Object GroupRoleAlways
group.role.const GroupRoleGroupRole GroupRole = "group.role"
-
Role RoleDetails about a role that can be assigned through the public Roles API.
-
ID stringIdentifier for the role.
-
Description stringOptional description of the role.
-
Name stringUnique name for the role.
-
Object RoleAlways
role.const RoleRole Role = "role"
-
Permissions []stringPermissions granted by the role.
-
PredefinedRole boolWhether the role is predefined and managed by OpenAI.
-
ResourceType stringResource type the role is bound to (for example
api.organizationorapi.project).
-
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
role, err := client.Admin.Organization.Projects.Groups.Roles.New(
context.TODO(),
"project_id",
"group_id",
openai.AdminOrganizationProjectGroupRoleNewParams{
RoleID: "role_id",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", role.Group)
}
Response
{
"group": {
"id": "id",
"created_at": 0,
"name": "name",
"object": "group",
"scim_managed": true
},
"object": "group.role",
"role": {
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
}
}
Retrieve project group role
client.Admin.Organization.Projects.Groups.Roles.Get(ctx, projectID, groupID, roleID) (*AdminOrganizationProjectGroupRoleGetResponse, error)
get /projects/{project_id}/groups/{group_id}/roles/{role_id}
Retrieves a project role assigned to a group.
Parameters
-
projectID string -
groupID string -
roleID string
Returns
-
type AdminOrganizationProjectGroupRoleGetResponse struct{…}Detailed information about a role assignment entry returned when listing assignments.
-
ID stringIdentifier for the role.
-
AssignmentSources []AdminOrganizationProjectGroupRoleGetResponseAssignmentSourcePrincipals from which the role assignment is inherited, when available.
-
PrincipalID string -
PrincipalType string
-
-
CreatedAt int64When the role was created.
-
CreatedBy stringIdentifier of the actor who created the role.
-
CreatedByUserObj map[string, any]User details for the actor that created the role, when available.
-
Description stringDescription of the role.
-
Metadata map[string, any]Arbitrary metadata stored on the role.
-
Name stringName of the role.
-
Permissions []stringPermissions associated with the role.
-
PredefinedRole boolWhether the role is predefined by OpenAI.
-
ResourceType stringResource type the role applies to.
-
UpdatedAt int64When the role was last updated.
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
role, err := client.Admin.Organization.Projects.Groups.Roles.Get(
context.TODO(),
"project_id",
"group_id",
"role_id",
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", role.ID)
}
Response
{
"id": "id",
"assignment_sources": [
{
"principal_id": "principal_id",
"principal_type": "principal_type"
}
],
"created_at": 0,
"created_by": "created_by",
"created_by_user_obj": {
"foo": "bar"
},
"description": "description",
"metadata": {
"foo": "bar"
},
"name": "name",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type",
"updated_at": 0
}
Unassign project role from group
client.Admin.Organization.Projects.Groups.Roles.Delete(ctx, projectID, groupID, roleID) (*AdminOrganizationProjectGroupRoleDeleteResponse, error)
delete /projects/{project_id}/groups/{group_id}/roles/{role_id}
Unassigns a project role from a group within a project.
Parameters
-
projectID string -
groupID string -
roleID string
Returns
-
type AdminOrganizationProjectGroupRoleDeleteResponse struct{…}Confirmation payload returned after unassigning a role.
-
Deleted boolWhether the assignment was removed.
-
Object stringIdentifier for the deleted assignment, such as
group.role.deletedoruser.role.deleted.
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
role, err := client.Admin.Organization.Projects.Groups.Roles.Delete(
context.TODO(),
"project_id",
"group_id",
"role_id",
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", role.Deleted)
}
Response
{
"deleted": true,
"object": "object"
}
Roles
List project roles
client.Admin.Organization.Projects.Roles.List(ctx, projectID, query) (*NextCursorPage[Role], error)
get /projects/{project_id}/roles
Lists the roles configured for a project.
Parameters
-
projectID string -
query AdminOrganizationProjectRoleListParams-
After param.Field[string]Cursor for pagination. Provide the value from the previous response's
nextfield to continue listing roles. -
Limit param.Field[int64]A limit on the number of roles to return. Defaults to 1000.
-
Order param.Field[AdminOrganizationProjectRoleListParamsOrder]Sort order for the returned roles.
-
const AdminOrganizationProjectRoleListParamsOrderAsc AdminOrganizationProjectRoleListParamsOrder = "asc" -
const AdminOrganizationProjectRoleListParamsOrderDesc AdminOrganizationProjectRoleListParamsOrder = "desc"
-
-
Returns
-
type Role struct{…}Details about a role that can be assigned through the public Roles API.
-
ID stringIdentifier for the role.
-
Description stringOptional description of the role.
-
Name stringUnique name for the role.
-
Object RoleAlways
role.const RoleRole Role = "role"
-
Permissions []stringPermissions granted by the role.
-
PredefinedRole boolWhether the role is predefined and managed by OpenAI.
-
ResourceType stringResource type the role is bound to (for example
api.organizationorapi.project).
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
page, err := client.Admin.Organization.Projects.Roles.List(
context.TODO(),
"project_id",
openai.AdminOrganizationProjectRoleListParams{
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
Response
{
"data": [
{
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
}
],
"has_more": true,
"next": "next",
"object": "list"
}
Create project role
client.Admin.Organization.Projects.Roles.New(ctx, projectID, body) (*Role, error)
post /projects/{project_id}/roles
Creates a custom role for a project.
Parameters
-
projectID string -
body AdminOrganizationProjectRoleNewParams-
Permissions param.Field[[]string]Permissions to grant to the role.
-
RoleName param.Field[string]Unique name for the role.
-
Description param.Field[string]Optional description of the role.
-
Returns
-
type Role struct{…}Details about a role that can be assigned through the public Roles API.
-
ID stringIdentifier for the role.
-
Description stringOptional description of the role.
-
Name stringUnique name for the role.
-
Object RoleAlways
role.const RoleRole Role = "role"
-
Permissions []stringPermissions granted by the role.
-
PredefinedRole boolWhether the role is predefined and managed by OpenAI.
-
ResourceType stringResource type the role is bound to (for example
api.organizationorapi.project).
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
role, err := client.Admin.Organization.Projects.Roles.New(
context.TODO(),
"project_id",
openai.AdminOrganizationProjectRoleNewParams{
Permissions: []string{"string"},
RoleName: "role_name",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", role.ID)
}
Response
{
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
}
Retrieve project role
client.Admin.Organization.Projects.Roles.Get(ctx, projectID, roleID) (*Role, error)
get /projects/{project_id}/roles/{role_id}
Retrieves a project role.
Parameters
-
projectID string -
roleID string
Returns
-
type Role struct{…}Details about a role that can be assigned through the public Roles API.
-
ID stringIdentifier for the role.
-
Description stringOptional description of the role.
-
Name stringUnique name for the role.
-
Object RoleAlways
role.const RoleRole Role = "role"
-
Permissions []stringPermissions granted by the role.
-
PredefinedRole boolWhether the role is predefined and managed by OpenAI.
-
ResourceType stringResource type the role is bound to (for example
api.organizationorapi.project).
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
role, err := client.Admin.Organization.Projects.Roles.Get(
context.TODO(),
"project_id",
"role_id",
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", role.ID)
}
Response
{
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
}
Update project role
client.Admin.Organization.Projects.Roles.Update(ctx, projectID, roleID, body) (*Role, error)
post /projects/{project_id}/roles/{role_id}
Updates an existing project role.
Parameters
-
projectID string -
roleID string -
body AdminOrganizationProjectRoleUpdateParams-
Description param.Field[string]New description for the role.
-
Permissions param.Field[[]string]Updated set of permissions for the role.
-
RoleName param.Field[string]New name for the role.
-
Returns
-
type Role struct{…}Details about a role that can be assigned through the public Roles API.
-
ID stringIdentifier for the role.
-
Description stringOptional description of the role.
-
Name stringUnique name for the role.
-
Object RoleAlways
role.const RoleRole Role = "role"
-
Permissions []stringPermissions granted by the role.
-
PredefinedRole boolWhether the role is predefined and managed by OpenAI.
-
ResourceType stringResource type the role is bound to (for example
api.organizationorapi.project).
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
role, err := client.Admin.Organization.Projects.Roles.Update(
context.TODO(),
"project_id",
"role_id",
openai.AdminOrganizationProjectRoleUpdateParams{
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", role.ID)
}
Response
{
"id": "id",
"description": "description",
"name": "name",
"object": "role",
"permissions": [
"string"
],
"predefined_role": true,
"resource_type": "resource_type"
}
Delete project role
client.Admin.Organization.Projects.Roles.Delete(ctx, projectID, roleID) (*AdminOrganizationProjectRoleDeleteResponse, error)
delete /projects/{project_id}/roles/{role_id}
Deletes a custom role from a project.
Parameters
-
projectID string -
roleID string
Returns
-
type AdminOrganizationProjectRoleDeleteResponse struct{…}Confirmation payload returned after deleting a role.
-
ID stringIdentifier of the deleted role.
-
Deleted boolWhether the role was deleted.
-
Object RoleDeletedAlways
role.deleted.const RoleDeletedRoleDeleted RoleDeleted = "role.deleted"
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
role, err := client.Admin.Organization.Projects.Roles.Delete(
context.TODO(),
"project_id",
"role_id",
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", role.ID)
}
Response
{
"id": "id",
"deleted": true,
"object": "role.deleted"
}
Data Retention
Retrieve project data retention
client.Admin.Organization.Projects.DataRetention.Get(ctx, projectID) (*ProjectDataRetention, error)
get /organization/projects/{project_id}/data_retention
Retrieves project data retention controls.
Parameters
projectID string
Returns
-
type ProjectDataRetention struct{…}Represents a project's data retention control setting.
-
Object ProjectDataRetentionThe object type, which is always
project.data_retention.const ProjectDataRetentionProjectDataRetention ProjectDataRetention = "project.data_retention"
-
Type ProjectDataRetentionTypeThe configured project data retention type.
-
const ProjectDataRetentionTypeOrganizationDefault ProjectDataRetentionType = "organization_default" -
const ProjectDataRetentionTypeNone ProjectDataRetentionType = "none" -
const ProjectDataRetentionTypeZeroDataRetention ProjectDataRetentionType = "zero_data_retention" -
const ProjectDataRetentionTypeModifiedAbuseMonitoring ProjectDataRetentionType = "modified_abuse_monitoring" -
const ProjectDataRetentionTypeEnhancedZeroDataRetention ProjectDataRetentionType = "enhanced_zero_data_retention" -
const ProjectDataRetentionTypeEnhancedModifiedAbuseMonitoring ProjectDataRetentionType = "enhanced_modified_abuse_monitoring"
-
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
projectDataRetention, err := client.Admin.Organization.Projects.DataRetention.Get(context.TODO(), "project_id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", projectDataRetention.Object)
}
Response
{
"object": "project.data_retention",
"type": "organization_default"
}
Update project data retention
client.Admin.Organization.Projects.DataRetention.Update(ctx, projectID, body) (*ProjectDataRetention, error)
post /organization/projects/{project_id}/data_retention
Updates project data retention controls.
Parameters
-
projectID string -
body AdminOrganizationProjectDataRetentionUpdateParams-
RetentionType param.Field[AdminOrganizationProjectDataRetentionUpdateParamsRetentionType]The desired project data retention type.
-
const AdminOrganizationProjectDataRetentionUpdateParamsRetentionTypeOrganizationDefault AdminOrganizationProjectDataRetentionUpdateParamsRetentionType = "organization_default" -
const AdminOrganizationProjectDataRetentionUpdateParamsRetentionTypeNone AdminOrganizationProjectDataRetentionUpdateParamsRetentionType = "none" -
const AdminOrganizationProjectDataRetentionUpdateParamsRetentionTypeZeroDataRetention AdminOrganizationProjectDataRetentionUpdateParamsRetentionType = "zero_data_retention" -
const AdminOrganizationProjectDataRetentionUpdateParamsRetentionTypeModifiedAbuseMonitoring AdminOrganizationProjectDataRetentionUpdateParamsRetentionType = "modified_abuse_monitoring" -
const AdminOrganizationProjectDataRetentionUpdateParamsRetentionTypeEnhancedZeroDataRetention AdminOrganizationProjectDataRetentionUpdateParamsRetentionType = "enhanced_zero_data_retention" -
const AdminOrganizationProjectDataRetentionUpdateParamsRetentionTypeEnhancedModifiedAbuseMonitoring AdminOrganizationProjectDataRetentionUpdateParamsRetentionType = "enhanced_modified_abuse_monitoring"
-
-
Returns
-
type ProjectDataRetention struct{…}Represents a project's data retention control setting.
-
Object ProjectDataRetentionThe object type, which is always
project.data_retention.const ProjectDataRetentionProjectDataRetention ProjectDataRetention = "project.data_retention"
-
Type ProjectDataRetentionTypeThe configured project data retention type.
-
const ProjectDataRetentionTypeOrganizationDefault ProjectDataRetentionType = "organization_default" -
const ProjectDataRetentionTypeNone ProjectDataRetentionType = "none" -
const ProjectDataRetentionTypeZeroDataRetention ProjectDataRetentionType = "zero_data_retention" -
const ProjectDataRetentionTypeModifiedAbuseMonitoring ProjectDataRetentionType = "modified_abuse_monitoring" -
const ProjectDataRetentionTypeEnhancedZeroDataRetention ProjectDataRetentionType = "enhanced_zero_data_retention" -
const ProjectDataRetentionTypeEnhancedModifiedAbuseMonitoring ProjectDataRetentionType = "enhanced_modified_abuse_monitoring"
-
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
projectDataRetention, err := client.Admin.Organization.Projects.DataRetention.Update(
context.TODO(),
"project_id",
openai.AdminOrganizationProjectDataRetentionUpdateParams{
RetentionType: openai.AdminOrganizationProjectDataRetentionUpdateParamsRetentionTypeOrganizationDefault,
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", projectDataRetention.Object)
}
Response
{
"object": "project.data_retention",
"type": "organization_default"
}
Domain Types
Project Data Retention
-
type ProjectDataRetention struct{…}Represents a project's data retention control setting.
-
Object ProjectDataRetentionThe object type, which is always
project.data_retention.const ProjectDataRetentionProjectDataRetention ProjectDataRetention = "project.data_retention"
-
Type ProjectDataRetentionTypeThe configured project data retention type.
-
const ProjectDataRetentionTypeOrganizationDefault ProjectDataRetentionType = "organization_default" -
const ProjectDataRetentionTypeNone ProjectDataRetentionType = "none" -
const ProjectDataRetentionTypeZeroDataRetention ProjectDataRetentionType = "zero_data_retention" -
const ProjectDataRetentionTypeModifiedAbuseMonitoring ProjectDataRetentionType = "modified_abuse_monitoring" -
const ProjectDataRetentionTypeEnhancedZeroDataRetention ProjectDataRetentionType = "enhanced_zero_data_retention" -
const ProjectDataRetentionTypeEnhancedModifiedAbuseMonitoring ProjectDataRetentionType = "enhanced_modified_abuse_monitoring"
-
-
Spend Alerts
List project spend alerts
client.Admin.Organization.Projects.SpendAlerts.List(ctx, projectID, query) (*ConversationCursorPage[ProjectSpendAlert], error)
get /organization/projects/{project_id}/spend_alerts
Lists project spend alerts.
Parameters
-
projectID string -
query AdminOrganizationProjectSpendAlertListParams-
After param.Field[string]Cursor for pagination. Provide the ID of the last spend alert from the previous response to fetch the next page.
-
Before param.Field[string]Cursor for pagination. Provide the ID of the first spend alert from the previous response to fetch the previous page.
-
Limit param.Field[int64]A limit on the number of spend alerts to return. Defaults to 20.
-
Order param.Field[AdminOrganizationProjectSpendAlertListParamsOrder]Sort order for the returned spend alerts.
-
const AdminOrganizationProjectSpendAlertListParamsOrderAsc AdminOrganizationProjectSpendAlertListParamsOrder = "asc" -
const AdminOrganizationProjectSpendAlertListParamsOrderDesc AdminOrganizationProjectSpendAlertListParamsOrder = "desc"
-
-
Returns
-
type ProjectSpendAlert struct{…}Represents a spend alert configured at the project level.
-
ID stringThe identifier, which can be referenced in API endpoints.
-
Currency ProjectSpendAlertCurrencyThe currency for the threshold amount.
const ProjectSpendAlertCurrencyUsd ProjectSpendAlertCurrency = "USD"
-
Interval ProjectSpendAlertIntervalThe time interval for evaluating spend against the threshold.
const ProjectSpendAlertIntervalMonth ProjectSpendAlertInterval = "month"
-
NotificationChannel ProjectSpendAlertNotificationChannelEmail notification settings for a spend alert.
-
Recipients []stringEmail addresses that receive the spend alert notification.
-
Type EmailThe notification channel type. Currently only
emailis supported.const EmailEmail Email = "email"
-
SubjectPrefix stringOptional subject prefix for alert emails.
-
-
Object ProjectSpendAlertThe object type, which is always
project.spend_alert.const ProjectSpendAlertProjectSpendAlert ProjectSpendAlert = "project.spend_alert"
-
ThresholdAmount int64The alert threshold amount, in cents.
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
page, err := client.Admin.Organization.Projects.SpendAlerts.List(
context.TODO(),
"project_id",
openai.AdminOrganizationProjectSpendAlertListParams{
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
Response
{
"data": [
{
"id": "id",
"currency": "USD",
"interval": "month",
"notification_channel": {
"recipients": [
"string"
],
"type": "email",
"subject_prefix": "subject_prefix"
},
"object": "project.spend_alert",
"threshold_amount": 0
}
],
"first_id": "first_id",
"has_more": true,
"last_id": "last_id",
"object": "list"
}
Create project spend alert
client.Admin.Organization.Projects.SpendAlerts.New(ctx, projectID, body) (*ProjectSpendAlert, error)
post /organization/projects/{project_id}/spend_alerts
Creates a project spend alert.
Parameters
-
projectID string -
body AdminOrganizationProjectSpendAlertNewParams-
Currency param.Field[AdminOrganizationProjectSpendAlertNewParamsCurrency]The currency for the threshold amount.
const AdminOrganizationProjectSpendAlertNewParamsCurrencyUsd AdminOrganizationProjectSpendAlertNewParamsCurrency = "USD"
-
Interval param.Field[AdminOrganizationProjectSpendAlertNewParamsInterval]The time interval for evaluating spend against the threshold.
const AdminOrganizationProjectSpendAlertNewParamsIntervalMonth AdminOrganizationProjectSpendAlertNewParamsInterval = "month"
-
NotificationChannel param.Field[AdminOrganizationProjectSpendAlertNewParamsNotificationChannel]Email notification settings for a spend alert.
-
Recipients []stringEmail addresses that receive the spend alert notification.
-
Type EmailThe notification channel type. Currently only
emailis supported.const EmailEmail Email = "email"
-
SubjectPrefix stringOptional subject prefix for alert emails.
-
-
ThresholdAmount param.Field[int64]The alert threshold amount, in cents.
-
Returns
-
type ProjectSpendAlert struct{…}Represents a spend alert configured at the project level.
-
ID stringThe identifier, which can be referenced in API endpoints.
-
Currency ProjectSpendAlertCurrencyThe currency for the threshold amount.
const ProjectSpendAlertCurrencyUsd ProjectSpendAlertCurrency = "USD"
-
Interval ProjectSpendAlertIntervalThe time interval for evaluating spend against the threshold.
const ProjectSpendAlertIntervalMonth ProjectSpendAlertInterval = "month"
-
NotificationChannel ProjectSpendAlertNotificationChannelEmail notification settings for a spend alert.
-
Recipients []stringEmail addresses that receive the spend alert notification.
-
Type EmailThe notification channel type. Currently only
emailis supported.const EmailEmail Email = "email"
-
SubjectPrefix stringOptional subject prefix for alert emails.
-
-
Object ProjectSpendAlertThe object type, which is always
project.spend_alert.const ProjectSpendAlertProjectSpendAlert ProjectSpendAlert = "project.spend_alert"
-
ThresholdAmount int64The alert threshold amount, in cents.
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
projectSpendAlert, err := client.Admin.Organization.Projects.SpendAlerts.New(
context.TODO(),
"project_id",
openai.AdminOrganizationProjectSpendAlertNewParams{
Currency: openai.AdminOrganizationProjectSpendAlertNewParamsCurrencyUsd,
Interval: openai.AdminOrganizationProjectSpendAlertNewParamsIntervalMonth,
NotificationChannel: openai.AdminOrganizationProjectSpendAlertNewParamsNotificationChannel{
Recipients: []string{"string"},
},
ThresholdAmount: 0,
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", projectSpendAlert.ID)
}
Response
{
"id": "id",
"currency": "USD",
"interval": "month",
"notification_channel": {
"recipients": [
"string"
],
"type": "email",
"subject_prefix": "subject_prefix"
},
"object": "project.spend_alert",
"threshold_amount": 0
}
Retrieve project spend alert
client.Admin.Organization.Projects.SpendAlerts.Get(ctx, projectID, alertID) (*ProjectSpendAlert, error)
get /organization/projects/{project_id}/spend_alerts/{alert_id}
Retrieves a project spend alert.
Parameters
-
projectID string -
alertID string
Returns
-
type ProjectSpendAlert struct{…}Represents a spend alert configured at the project level.
-
ID stringThe identifier, which can be referenced in API endpoints.
-
Currency ProjectSpendAlertCurrencyThe currency for the threshold amount.
const ProjectSpendAlertCurrencyUsd ProjectSpendAlertCurrency = "USD"
-
Interval ProjectSpendAlertIntervalThe time interval for evaluating spend against the threshold.
const ProjectSpendAlertIntervalMonth ProjectSpendAlertInterval = "month"
-
NotificationChannel ProjectSpendAlertNotificationChannelEmail notification settings for a spend alert.
-
Recipients []stringEmail addresses that receive the spend alert notification.
-
Type EmailThe notification channel type. Currently only
emailis supported.const EmailEmail Email = "email"
-
SubjectPrefix stringOptional subject prefix for alert emails.
-
-
Object ProjectSpendAlertThe object type, which is always
project.spend_alert.const ProjectSpendAlertProjectSpendAlert ProjectSpendAlert = "project.spend_alert"
-
ThresholdAmount int64The alert threshold amount, in cents.
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
projectSpendAlert, err := client.Admin.Organization.Projects.SpendAlerts.Get(
context.TODO(),
"project_id",
"alert_id",
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", projectSpendAlert.ID)
}
Response
{
"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
client.Admin.Organization.Projects.SpendAlerts.Update(ctx, projectID, alertID, body) (*ProjectSpendAlert, error)
post /organization/projects/{project_id}/spend_alerts/{alert_id}
Updates a project spend alert.
Parameters
-
projectID string -
alertID string -
body AdminOrganizationProjectSpendAlertUpdateParams-
Currency param.Field[AdminOrganizationProjectSpendAlertUpdateParamsCurrency]The currency for the threshold amount.
const AdminOrganizationProjectSpendAlertUpdateParamsCurrencyUsd AdminOrganizationProjectSpendAlertUpdateParamsCurrency = "USD"
-
Interval param.Field[AdminOrganizationProjectSpendAlertUpdateParamsInterval]The time interval for evaluating spend against the threshold.
const AdminOrganizationProjectSpendAlertUpdateParamsIntervalMonth AdminOrganizationProjectSpendAlertUpdateParamsInterval = "month"
-
NotificationChannel param.Field[AdminOrganizationProjectSpendAlertUpdateParamsNotificationChannel]Email notification settings for a spend alert.
-
Recipients []stringEmail addresses that receive the spend alert notification.
-
Type EmailThe notification channel type. Currently only
emailis supported.const EmailEmail Email = "email"
-
SubjectPrefix stringOptional subject prefix for alert emails.
-
-
ThresholdAmount param.Field[int64]The alert threshold amount, in cents.
-
Returns
-
type ProjectSpendAlert struct{…}Represents a spend alert configured at the project level.
-
ID stringThe identifier, which can be referenced in API endpoints.
-
Currency ProjectSpendAlertCurrencyThe currency for the threshold amount.
const ProjectSpendAlertCurrencyUsd ProjectSpendAlertCurrency = "USD"
-
Interval ProjectSpendAlertIntervalThe time interval for evaluating spend against the threshold.
const ProjectSpendAlertIntervalMonth ProjectSpendAlertInterval = "month"
-
NotificationChannel ProjectSpendAlertNotificationChannelEmail notification settings for a spend alert.
-
Recipients []stringEmail addresses that receive the spend alert notification.
-
Type EmailThe notification channel type. Currently only
emailis supported.const EmailEmail Email = "email"
-
SubjectPrefix stringOptional subject prefix for alert emails.
-
-
Object ProjectSpendAlertThe object type, which is always
project.spend_alert.const ProjectSpendAlertProjectSpendAlert ProjectSpendAlert = "project.spend_alert"
-
ThresholdAmount int64The alert threshold amount, in cents.
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
projectSpendAlert, err := client.Admin.Organization.Projects.SpendAlerts.Update(
context.TODO(),
"project_id",
"alert_id",
openai.AdminOrganizationProjectSpendAlertUpdateParams{
Currency: openai.AdminOrganizationProjectSpendAlertUpdateParamsCurrencyUsd,
Interval: openai.AdminOrganizationProjectSpendAlertUpdateParamsIntervalMonth,
NotificationChannel: openai.AdminOrganizationProjectSpendAlertUpdateParamsNotificationChannel{
Recipients: []string{"string"},
},
ThresholdAmount: 0,
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", projectSpendAlert.ID)
}
Response
{
"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
client.Admin.Organization.Projects.SpendAlerts.Delete(ctx, projectID, alertID) (*ProjectSpendAlertDeleted, error)
delete /organization/projects/{project_id}/spend_alerts/{alert_id}
Deletes a project spend alert.
Parameters
-
projectID string -
alertID string
Returns
-
type ProjectSpendAlertDeleted struct{…}Confirmation payload returned after deleting a project spend alert.
-
ID stringThe deleted spend alert ID.
-
Deleted boolWhether the spend alert was deleted.
-
Object ProjectSpendAlertDeletedAlways
project.spend_alert.deleted.const ProjectSpendAlertDeletedProjectSpendAlertDeleted ProjectSpendAlertDeleted = "project.spend_alert.deleted"
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
projectSpendAlertDeleted, err := client.Admin.Organization.Projects.SpendAlerts.Delete(
context.TODO(),
"project_id",
"alert_id",
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", projectSpendAlertDeleted.ID)
}
Response
{
"id": "id",
"deleted": true,
"object": "project.spend_alert.deleted"
}
Domain Types
Project Spend Alert
-
type ProjectSpendAlert struct{…}Represents a spend alert configured at the project level.
-
ID stringThe identifier, which can be referenced in API endpoints.
-
Currency ProjectSpendAlertCurrencyThe currency for the threshold amount.
const ProjectSpendAlertCurrencyUsd ProjectSpendAlertCurrency = "USD"
-
Interval ProjectSpendAlertIntervalThe time interval for evaluating spend against the threshold.
const ProjectSpendAlertIntervalMonth ProjectSpendAlertInterval = "month"
-
NotificationChannel ProjectSpendAlertNotificationChannelEmail notification settings for a spend alert.
-
Recipients []stringEmail addresses that receive the spend alert notification.
-
Type EmailThe notification channel type. Currently only
emailis supported.const EmailEmail Email = "email"
-
SubjectPrefix stringOptional subject prefix for alert emails.
-
-
Object ProjectSpendAlertThe object type, which is always
project.spend_alert.const ProjectSpendAlertProjectSpendAlert ProjectSpendAlert = "project.spend_alert"
-
ThresholdAmount int64The alert threshold amount, in cents.
-
Project Spend Alert Deleted
-
type ProjectSpendAlertDeleted struct{…}Confirmation payload returned after deleting a project spend alert.
-
ID stringThe deleted spend alert ID.
-
Deleted boolWhether the spend alert was deleted.
-
Object ProjectSpendAlertDeletedAlways
project.spend_alert.deleted.const ProjectSpendAlertDeletedProjectSpendAlertDeleted ProjectSpendAlertDeleted = "project.spend_alert.deleted"
-
Certificates
List project certificates
client.Admin.Organization.Projects.Certificates.List(ctx, projectID, query) (*ConversationCursorPage[AdminOrganizationProjectCertificateListResponse], error)
get /organization/projects/{project_id}/certificates
List certificates for this project.
Parameters
-
projectID string -
query AdminOrganizationProjectCertificateListParams-
After param.Field[string]A cursor for use in pagination.
afteris an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. -
Limit param.Field[int64]A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
-
Order param.Field[AdminOrganizationProjectCertificateListParamsOrder]Sort order by the
created_attimestamp of the objects.ascfor ascending order anddescfor descending order.-
const AdminOrganizationProjectCertificateListParamsOrderAsc AdminOrganizationProjectCertificateListParamsOrder = "asc" -
const AdminOrganizationProjectCertificateListParamsOrderDesc AdminOrganizationProjectCertificateListParamsOrder = "desc"
-
-
Returns
-
type AdminOrganizationProjectCertificateListResponse struct{…}Represents an individual certificate configured at the project level.
-
ID stringThe identifier, which can be referenced in API endpoints
-
Active boolWhether the certificate is currently active at the project level.
-
CertificateDetails AdminOrganizationProjectCertificateListResponseCertificateDetails-
ExpiresAt int64The Unix timestamp (in seconds) of when the certificate expires.
-
ValidAt int64The Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
CreatedAt int64The Unix timestamp (in seconds) of when the certificate was uploaded.
-
Name stringThe name of the certificate.
-
Object OrganizationProjectCertificateThe object type, which is always
organization.project.certificate.const OrganizationProjectCertificateOrganizationProjectCertificate OrganizationProjectCertificate = "organization.project.certificate"
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
page, err := client.Admin.Organization.Projects.Certificates.List(
context.TODO(),
"project_id",
openai.AdminOrganizationProjectCertificateListParams{
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
Response
{
"data": [
{
"id": "id",
"active": true,
"certificate_details": {
"expires_at": 0,
"valid_at": 0
},
"created_at": 0,
"name": "name",
"object": "organization.project.certificate"
}
],
"first_id": "cert_abc",
"has_more": true,
"last_id": "cert_abc",
"object": "list"
}
Activate certificates for project
client.Admin.Organization.Projects.Certificates.Activate(ctx, projectID, body) (*Page[AdminOrganizationProjectCertificateActivateResponse], error)
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
-
projectID string -
body AdminOrganizationProjectCertificateActivateParamsCertificateIDs param.Field[[]string]
Returns
-
type AdminOrganizationProjectCertificateActivateResponse struct{…}Represents an individual certificate configured at the project level.
-
ID stringThe identifier, which can be referenced in API endpoints
-
Active boolWhether the certificate is currently active at the project level.
-
CertificateDetails AdminOrganizationProjectCertificateActivateResponseCertificateDetails-
ExpiresAt int64The Unix timestamp (in seconds) of when the certificate expires.
-
ValidAt int64The Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
CreatedAt int64The Unix timestamp (in seconds) of when the certificate was uploaded.
-
Name stringThe name of the certificate.
-
Object OrganizationProjectCertificateThe object type, which is always
organization.project.certificate.const OrganizationProjectCertificateOrganizationProjectCertificate OrganizationProjectCertificate = "organization.project.certificate"
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
page, err := client.Admin.Organization.Projects.Certificates.Activate(
context.TODO(),
"project_id",
openai.AdminOrganizationProjectCertificateActivateParams{
CertificateIDs: []string{"cert_abc"},
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
Response
{
"data": [
{
"id": "id",
"active": true,
"certificate_details": {
"expires_at": 0,
"valid_at": 0
},
"created_at": 0,
"name": "name",
"object": "organization.project.certificate"
}
],
"object": "organization.project.certificate.activation"
}
Deactivate certificates for project
client.Admin.Organization.Projects.Certificates.Deactivate(ctx, projectID, body) (*Page[AdminOrganizationProjectCertificateDeactivateResponse], error)
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
-
projectID string -
body AdminOrganizationProjectCertificateDeactivateParamsCertificateIDs param.Field[[]string]
Returns
-
type AdminOrganizationProjectCertificateDeactivateResponse struct{…}Represents an individual certificate configured at the project level.
-
ID stringThe identifier, which can be referenced in API endpoints
-
Active boolWhether the certificate is currently active at the project level.
-
CertificateDetails AdminOrganizationProjectCertificateDeactivateResponseCertificateDetails-
ExpiresAt int64The Unix timestamp (in seconds) of when the certificate expires.
-
ValidAt int64The Unix timestamp (in seconds) of when the certificate becomes valid.
-
-
CreatedAt int64The Unix timestamp (in seconds) of when the certificate was uploaded.
-
Name stringThe name of the certificate.
-
Object OrganizationProjectCertificateThe object type, which is always
organization.project.certificate.const OrganizationProjectCertificateOrganizationProjectCertificate OrganizationProjectCertificate = "organization.project.certificate"
-
Example
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAdminAPIKey("My Admin API Key"),
)
page, err := client.Admin.Organization.Projects.Certificates.Deactivate(
context.TODO(),
"project_id",
openai.AdminOrganizationProjectCertificateDeactivateParams{
CertificateIDs: []string{"cert_abc"},
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
Response
{
"data": [
{
"id": "id",
"active": true,
"certificate_details": {
"expires_at": 0,
"valid_at": 0
},
"created_at": 0,
"name": "name",
"object": "organization.project.certificate"
}
],
"object": "organization.project.certificate.deactivation"
}