Skip to content
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation

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]
Optional

Return only events performed by users with these emails.

ActorIDs param.Field[[]string]
Optional

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]
Optional

A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.

Before param.Field[string]
Optional

A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.

EffectiveAt param.Field[AdminOrganizationAuditLogListParamsEffectiveAt]
Optional

Return only events whose effective_at (Unix seconds) is in this range.

EventTypes param.Field[[]string]
Optional

Return only events with a type in one of these values. For example, project.created. For all options, see the documentation for the audit log object.

Limit param.Field[int64]
Optional

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]
Optional

Return only events for these projects.

ResourceIDs param.Field[[]string]
Optional

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]
Optional

Return only tenant-scoped events associated with this organization. Required for tenant-scoped events such as role.bound_to_resource and role.unbound_from_resource. When true, 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 string

The ID of this log.

EffectiveAt int64

The Unix timestamp (in seconds) of the event.

formatunixtime
Type AdminOrganizationAuditLogListResponseType

The event type.

Actor AdminOrganizationAuditLogListResponseActor
Optional

The actor who performed the audit logged action.

APIKeyCreated AdminOrganizationAuditLogListResponseAPIKeyCreated
Optional

The details for events with this type.

APIKeyDeleted AdminOrganizationAuditLogListResponseAPIKeyDeleted
Optional

The details for events with this type.

APIKeyUpdated AdminOrganizationAuditLogListResponseAPIKeyUpdated
Optional

The details for events with this type.

CertificateCreated AdminOrganizationAuditLogListResponseCertificateCreated
Optional

The details for events with this type.

CertificateDeleted AdminOrganizationAuditLogListResponseCertificateDeleted
Optional

The details for events with this type.

CertificateUpdated AdminOrganizationAuditLogListResponseCertificateUpdated
Optional

The details for events with this type.

CertificatesActivated AdminOrganizationAuditLogListResponseCertificatesActivated
Optional

The details for events with this type.

CertificatesDeactivated AdminOrganizationAuditLogListResponseCertificatesDeactivated
Optional

The details for events with this type.

CheckpointPermissionCreated AdminOrganizationAuditLogListResponseCheckpointPermissionCreated
Optional

The project and fine-tuned model checkpoint that the checkpoint permission was created for.

CheckpointPermissionDeleted AdminOrganizationAuditLogListResponseCheckpointPermissionDeleted
Optional

The details for events with this type.

ExternalKeyRegistered AdminOrganizationAuditLogListResponseExternalKeyRegistered
Optional

The details for events with this type.

ExternalKeyRemoved AdminOrganizationAuditLogListResponseExternalKeyRemoved
Optional

The details for events with this type.

ExternalStorageRegistered AdminOrganizationAuditLogListResponseExternalStorageRegistered
Optional

The details for events with this type.

ExternalStorageRemoved AdminOrganizationAuditLogListResponseExternalStorageRemoved
Optional

The details for events with this type.

GroupCreated AdminOrganizationAuditLogListResponseGroupCreated
Optional

The details for events with this type.

GroupDeleted AdminOrganizationAuditLogListResponseGroupDeleted
Optional

The details for events with this type.

GroupUpdated AdminOrganizationAuditLogListResponseGroupUpdated
Optional

The details for events with this type.

InviteAccepted AdminOrganizationAuditLogListResponseInviteAccepted
Optional

The details for events with this type.

InviteDeleted AdminOrganizationAuditLogListResponseInviteDeleted
Optional

The details for events with this type.

InviteSent AdminOrganizationAuditLogListResponseInviteSent
Optional

The details for events with this type.

IPAllowlistConfigActivated AdminOrganizationAuditLogListResponseIPAllowlistConfigActivated
Optional

The details for events with this type.

IPAllowlistConfigDeactivated AdminOrganizationAuditLogListResponseIPAllowlistConfigDeactivated
Optional

The details for events with this type.

IPAllowlistCreated AdminOrganizationAuditLogListResponseIPAllowlistCreated
Optional

The details for events with this type.

IPAllowlistDeleted AdminOrganizationAuditLogListResponseIPAllowlistDeleted
Optional

The details for events with this type.

IPAllowlistUpdated AdminOrganizationAuditLogListResponseIPAllowlistUpdated
Optional

The details for events with this type.

LoginFailed AdminOrganizationAuditLogListResponseLoginFailed
Optional

The details for events with this type.

LoginSucceeded any
Optional

This event has no additional fields beyond the standard audit log attributes.

LogoutFailed AdminOrganizationAuditLogListResponseLogoutFailed
Optional

The details for events with this type.

LogoutSucceeded any
Optional

This event has no additional fields beyond the standard audit log attributes.

OrganizationUpdated AdminOrganizationAuditLogListResponseOrganizationUpdated
Optional

The details for events with this type.

Project AdminOrganizationAuditLogListResponseProject
Optional

The project that the action was scoped to. Absent for actions not scoped to projects. Note that any admin actions taken via Admin API keys are associated with the default project.

ProjectArchived AdminOrganizationAuditLogListResponseProjectArchived
Optional

The details for events with this type.

ProjectCreated AdminOrganizationAuditLogListResponseProjectCreated
Optional

The details for events with this type.

ProjectDeleted AdminOrganizationAuditLogListResponseProjectDeleted
Optional

The details for events with this type.

ProjectUpdated AdminOrganizationAuditLogListResponseProjectUpdated
Optional

The details for events with this type.

RateLimitDeleted AdminOrganizationAuditLogListResponseRateLimitDeleted
Optional

The details for events with this type.

RateLimitUpdated AdminOrganizationAuditLogListResponseRateLimitUpdated
Optional

The details for events with this type.

RoleAssignmentCreated AdminOrganizationAuditLogListResponseRoleAssignmentCreated
Optional

The details for events with this type.

RoleAssignmentDeleted AdminOrganizationAuditLogListResponseRoleAssignmentDeleted
Optional

The details for events with this type.

RoleBoundToResource AdminOrganizationAuditLogListResponseRoleBoundToResource
Optional

The details for events with this type.

RoleCreated AdminOrganizationAuditLogListResponseRoleCreated
Optional

The details for events with this type.

RoleDeleted AdminOrganizationAuditLogListResponseRoleDeleted
Optional

The details for events with this type.

RoleUnboundFromResource AdminOrganizationAuditLogListResponseRoleUnboundFromResource
Optional

The details for events with this type.

RoleUpdated AdminOrganizationAuditLogListResponseRoleUpdated
Optional

The details for events with this type.

ScimDisabled AdminOrganizationAuditLogListResponseScimDisabled
Optional

The details for events with this type.

ScimEnabled AdminOrganizationAuditLogListResponseScimEnabled
Optional

The details for events with this type.

ServiceAccountCreated AdminOrganizationAuditLogListResponseServiceAccountCreated
Optional

The details for events with this type.

ServiceAccountDeleted AdminOrganizationAuditLogListResponseServiceAccountDeleted
Optional

The details for events with this type.

ServiceAccountUpdated AdminOrganizationAuditLogListResponseServiceAccountUpdated
Optional

The details for events with this type.

UserAdded AdminOrganizationAuditLogListResponseUserAdded
Optional

The details for events with this type.

UserDeleted AdminOrganizationAuditLogListResponseUserDeleted
Optional

The details for events with this type.

UserUpdated AdminOrganizationAuditLogListResponseUserUpdated
Optional

The details for events with this type.

WorkloadIdentityProviderMappingCreated AdminOrganizationAuditLogListResponseWorkloadIdentityProviderMappingCreated
Optional

The details for events with this type.

WorkloadIdentityProviderMappingDeleted AdminOrganizationAuditLogListResponseWorkloadIdentityProviderMappingDeleted
Optional

The details for events with this type.

WorkloadIdentityProviderMappingUpdated AdminOrganizationAuditLogListResponseWorkloadIdentityProviderMappingUpdated
Optional

The details for events with this type.

WorkloadIdentityProviderCreated AdminOrganizationAuditLogListResponseWorkloadIdentityProviderCreated
Optional

The details for events with this type.

WorkloadIdentityProviderDeleted AdminOrganizationAuditLogListResponseWorkloadIdentityProviderDeleted
Optional

The details for events with this type.

WorkloadIdentityProviderUpdated AdminOrganizationAuditLogListResponseWorkloadIdentityProviderUpdated
Optional

The details for events with this type.

List audit logs

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)
}
{
    "object": "list",
    "data": [
        {
            "id": "audit_log-xxx_yyyymmdd",
            "type": "project.archived",
            "effective_at": 1722461446,
            "actor": {
                "type": "api_key",
                "api_key": {
                    "type": "user",
                    "user": {
                        "id": "user-xxx",
                        "email": "user@example.com"
                    }
                }
            },
            "project.archived": {
                "id": "proj_abc"
            }
        },
        {
            "id": "audit_log-yyy__20240101",
            "type": "api_key.updated",
            "effective_at": 1720804190,
            "actor": {
                "type": "session",
                "session": {
                    "user": {
                        "id": "user-xxx",
                        "email": "user@example.com"
                    },
                    "ip_address": "127.0.0.1",
                    "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
                    "ja3": "a497151ce4338a12c4418c44d375173e",
                    "ja4": "q13d0313h3_55b375c5d22e_c7319ce65786",
                    "ip_address_details": {
                      "country": "US",
                      "city": "San Francisco",
                      "region": "California",
                      "region_code": "CA",
                      "asn": "1234",
                      "latitude": "37.77490",
                      "longitude": "-122.41940"
                    }
                }
            },
            "api_key.updated": {
                "id": "key_xxxx",
                "data": {
                    "scopes": ["resource_2.operation_2"]
                }
            }
        }
    ],
    "first_id": "audit_log-xxx__20240101",
    "last_id": "audit_log_yyy__20240101",
    "has_more": true
}
Returns Examples
{
    "object": "list",
    "data": [
        {
            "id": "audit_log-xxx_yyyymmdd",
            "type": "project.archived",
            "effective_at": 1722461446,
            "actor": {
                "type": "api_key",
                "api_key": {
                    "type": "user",
                    "user": {
                        "id": "user-xxx",
                        "email": "user@example.com"
                    }
                }
            },
            "project.archived": {
                "id": "proj_abc"
            }
        },
        {
            "id": "audit_log-yyy__20240101",
            "type": "api_key.updated",
            "effective_at": 1720804190,
            "actor": {
                "type": "session",
                "session": {
                    "user": {
                        "id": "user-xxx",
                        "email": "user@example.com"
                    },
                    "ip_address": "127.0.0.1",
                    "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
                    "ja3": "a497151ce4338a12c4418c44d375173e",
                    "ja4": "q13d0313h3_55b375c5d22e_c7319ce65786",
                    "ip_address_details": {
                      "country": "US",
                      "city": "San Francisco",
                      "region": "California",
                      "region_code": "CA",
                      "asn": "1234",
                      "latitude": "37.77490",
                      "longitude": "-122.41940"
                    }
                }
            },
            "api_key.updated": {
                "id": "key_xxxx",
                "data": {
                    "scopes": ["resource_2.operation_2"]
                }
            }
        }
    ],
    "first_id": "audit_log-xxx__20240101",
    "last_id": "audit_log_yyy__20240101",
    "has_more": true
}