OpenAI Audit Logs API

List user actions and configuration changes within this organization.

Documentation

📖
Documentation
https://platform.openai.com/docs/assistants/overview
📖
Documentation
https://platform.openai.com/docs/api-reference/assistants
📖
Documentation
https://platform.openai.com/docs/guides/text-to-speech
📖
Documentation
https://platform.openai.com/docs/api-reference/audio
📖
Documentation
https://platform.openai.com/docs/guides/speech-to-text
📖
Documentation
https://developers.openai.com/api/docs/guides/audio/
📖
Documentation
https://developers.openai.com/api/docs/guides/voice-agents/
📖
Documentation
https://platform.openai.com/docs/api-reference/chat
📖
Documentation
https://platform.openai.com/docs/guides/embeddings
📖
Documentation
https://platform.openai.com/docs/api-reference/embeddings
📖
Documentation
https://platform.openai.com/docs/api-reference/files
📖
Documentation
https://platform.openai.com/docs/guides/fine-tuning
📖
Documentation
https://platform.openai.com/docs/api-reference/fine-tuning
📖
Documentation
https://platform.openai.com/docs/guides/images
📖
Documentation
https://platform.openai.com/docs/api-reference/images
📖
Documentation
https://platform.openai.com/docs/guides/image-generation
📖
Documentation
https://platform.openai.com/docs/guides/images-vision
📖
Documentation
https://platform.openai.com/docs/models
📖
Documentation
https://platform.openai.com/docs/api-reference/models
📖
Documentation
https://platform.openai.com/docs/assistants/how-it-works/managing-threads-and-messages
📖
Documentation
https://platform.openai.com/docs/api-reference/threads
📖
Documentation
https://platform.openai.com/docs/api-reference/completions

Specifications

Schemas & Data

Other Resources

OpenAPI Specification

openai-audit-logs-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  title: OpenAI Assistants Audit Logs API
  description: The Assistants API allows you to build AI assistants within your own applications. An Assistant has instructions and can leverage models, tools, and knowledge to respond to user queries. The Assistants API currently supports three types of tools - Code Interpreter, Retrieval, and Function calling. In the future, we plan to release more OpenAI-built tools, and allow you to provide your own tools on our platform.
  version: 2.0.0
  termsOfService: https://openai.com/policies/terms-of-use
  contact:
    name: OpenAI Support
    url: https://help.openai.com/
  license:
    name: MIT
    url: https://github.com/openai/openai-openapi/blob/master/LICENSE
servers:
- url: https://api.openai.com/v1
security:
- ApiKeyAuth: []
tags:
- name: Audit Logs
  description: List user actions and configuration changes within this organization.
paths:
  /organization/audit_logs:
    get:
      security:
      - AdminApiKeyAuth: []
      summary: List user actions and configuration changes within this organization.
      operationId: list-audit-logs
      tags:
      - Audit Logs
      parameters:
      - name: effective_at
        in: query
        description: Return only events whose `effective_at` (Unix seconds) is in this range.
        required: false
        schema:
          type: object
          properties:
            gt:
              type: integer
              description: Return only events whose `effective_at` (Unix seconds) is greater than this value.
            gte:
              type: integer
              description: Return only events whose `effective_at` (Unix seconds) is greater than or equal to this value.
            lt:
              type: integer
              description: Return only events whose `effective_at` (Unix seconds) is less than this value.
            lte:
              type: integer
              description: Return only events whose `effective_at` (Unix seconds) is less than or equal to this value.
      - name: project_ids[]
        in: query
        description: Return only events for these projects.
        required: false
        schema:
          type: array
          items:
            type: string
      - name: event_types[]
        in: query
        description: 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](/docs/api-reference/audit-logs/object).
        required: false
        schema:
          type: array
          items:
            $ref: '#/components/schemas/AuditLogEventType'
      - name: actor_ids[]
        in: query
        description: Return only events performed by these actors. Can be a user ID, a service account ID, or an api key tracking ID.
        required: false
        schema:
          type: array
          items:
            type: string
      - name: actor_emails[]
        in: query
        description: Return only events performed by users with these emails.
        required: false
        schema:
          type: array
          items:
            type: string
      - name: resource_ids[]
        in: query
        description: Return only events performed on these targets. For example, a project ID updated.
        required: false
        schema:
          type: array
          items:
            type: string
      - name: limit
        in: query
        description: 'A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.

          '
        required: false
        schema:
          type: integer
          default: 20
      - name: after
        in: query
        description: '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.

          '
        schema:
          type: string
      - name: before
        in: query
        description: '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.

          '
        schema:
          type: string
      responses:
        '200':
          description: Audit logs listed successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListAuditLogsResponse'
      x-oaiMeta:
        name: List audit logs
        group: audit-logs
        examples:
          request:
            curl: 'curl https://api.openai.com/v1/organization/audit_logs \

              -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \

              -H "Content-Type: application/json"

              '
            node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n  adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted\n});\n\n// Automatically fetches more pages as needed.\nfor await (const auditLogListResponse of client.admin.organization.auditLogs.list()) {\n  console.log(auditLogListResponse.id);\n}"
            python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n    admin_api_key=os.environ.get(\"OPENAI_ADMIN_KEY\"),  # This is the default and can be omitted\n)\npage = client.admin.organization.audit_logs.list()\npage = page.data[0]\nprint(page.id)"
            go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tpage, err := client.Admin.Organization.AuditLogs.List(context.TODO(), openai.AdminOrganizationAuditLogListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n"
            java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.admin.organization.auditlogs.AuditLogListPage;\nimport com.openai.models.admin.organization.auditlogs.AuditLogListParams;\n\npublic final class Main {\n    private Main() {}\n\n    public static void main(String[] args) {\n        OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n        AuditLogListPage page = client.admin().organization().auditLogs().list();\n    }\n}"
            ruby: 'require "openai"


              openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")


              page = openai.admin.organization.audit_logs.list


              puts(page)'
          response: "{\n    \"object\": \"list\",\n    \"data\": [\n        {\n            \"id\": \"audit_log-xxx_yyyymmdd\",\n            \"type\": \"project.archived\",\n            \"effective_at\": 1722461446,\n            \"actor\": {\n                \"type\": \"api_key\",\n                \"api_key\": {\n                    \"type\": \"user\",\n                    \"user\": {\n                        \"id\": \"user-xxx\",\n                        \"email\": \"user@example.com\"\n                    }\n                }\n            },\n            \"project.archived\": {\n                \"id\": \"proj_abc\"\n            },\n        },\n        {\n            \"id\": \"audit_log-yyy__20240101\",\n            \"type\": \"api_key.updated\",\n            \"effective_at\": 1720804190,\n            \"actor\": {\n                \"type\": \"session\",\n                \"session\": {\n                    \"user\": {\n                        \"id\": \"user-xxx\",\n                        \"email\": \"user@example.com\"\n                    },\n                    \"ip_address\": \"127.0.0.1\",\n                    \"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\",\n                    \"ja3\": \"a497151ce4338a12c4418c44d375173e\",\n                    \"ja4\": \"q13d0313h3_55b375c5d22e_c7319ce65786\",\n                    \"ip_address_details\": {\n                      \"country\": \"US\",\n                      \"city\": \"San Francisco\",\n                      \"region\": \"California\",\n                      \"region_code\": \"CA\",\n                      \"asn\": \"1234\",\n                      \"latitude\": \"37.77490\",\n                      \"longitude\": \"-122.41940\"\n                    }\n                }\n            },\n            \"api_key.updated\": {\n                \"id\": \"key_xxxx\",\n                \"data\": {\n                    \"scopes\": [\"resource_2.operation_2\"]\n                }\n            },\n        }\n    ],\n    \"first_id\": \"audit_log-xxx__20240101\",\n    \"last_id\": \"audit_log_yyy__20240101\",\n    \"has_more\": true\n}\n"
components:
  schemas:
    AuditLogActor:
      type: object
      description: The actor who performed the audit logged action.
      properties:
        type:
          type: string
          description: The type of actor. Is either `session` or `api_key`.
          enum:
          - session
          - api_key
        session:
          $ref: '#/components/schemas/AuditLogActorSession'
        api_key:
          $ref: '#/components/schemas/AuditLogActorApiKey'
    AuditLogActorServiceAccount:
      type: object
      description: The service account that performed the audit logged action.
      properties:
        id:
          type: string
          description: The service account id.
    AuditLogActorSession:
      type: object
      description: The session in which the audit logged action was performed.
      properties:
        user:
          $ref: '#/components/schemas/AuditLogActorUser'
        ip_address:
          type: string
          description: The IP address from which the action was performed.
    ListAuditLogsResponse:
      type: object
      properties:
        object:
          type: string
          enum:
          - list
          x-stainless-const: true
        data:
          type: array
          items:
            $ref: '#/components/schemas/AuditLog'
        first_id:
          anyOf:
          - type: string
          - type: 'null'
          example: audit_log-defb456h8dks
        last_id:
          anyOf:
          - type: string
          - type: 'null'
          example: audit_log-hnbkd8s93s
        has_more:
          type: boolean
      required:
      - object
      - data
      - has_more
    AuditLogEventType:
      type: string
      description: The event type.
      enum:
      - api_key.created
      - api_key.updated
      - api_key.deleted
      - certificate.created
      - certificate.updated
      - certificate.deleted
      - certificates.activated
      - certificates.deactivated
      - checkpoint.permission.created
      - checkpoint.permission.deleted
      - external_key.registered
      - external_key.removed
      - group.created
      - group.updated
      - group.deleted
      - invite.sent
      - invite.accepted
      - invite.deleted
      - ip_allowlist.created
      - ip_allowlist.updated
      - ip_allowlist.deleted
      - ip_allowlist.config.activated
      - ip_allowlist.config.deactivated
      - login.succeeded
      - login.failed
      - logout.succeeded
      - logout.failed
      - organization.updated
      - project.created
      - project.updated
      - project.archived
      - project.deleted
      - rate_limit.updated
      - rate_limit.deleted
      - resource.deleted
      - tunnel.created
      - tunnel.updated
      - tunnel.deleted
      - role.created
      - role.updated
      - role.deleted
      - role.assignment.created
      - role.assignment.deleted
      - scim.enabled
      - scim.disabled
      - service_account.created
      - service_account.updated
      - service_account.deleted
      - user.added
      - user.updated
      - user.deleted
    AuditLogActorUser:
      type: object
      description: The user who performed the audit logged action.
      properties:
        id:
          type: string
          description: The user id.
        email:
          type: string
          description: The user email.
    AuditLog:
      type: object
      description: A log of a user action or configuration change within this organization.
      properties:
        id:
          type: string
          description: The ID of this log.
        type:
          $ref: '#/components/schemas/AuditLogEventType'
        effective_at:
          type: integer
          format: unixtime
          description: The Unix timestamp (in seconds) of the event.
        project:
          type: object
          description: 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.
          properties:
            id:
              type: string
              description: The project ID.
            name:
              type: string
              description: The project title.
        actor:
          anyOf:
          - $ref: '#/components/schemas/AuditLogActor'
          - type: 'null'
        api_key.created:
          type: object
          description: The details for events with this `type`.
          properties:
            id:
              type: string
              description: The tracking ID of the API key.
            data:
              type: object
              description: The payload used to create the API key.
              properties:
                scopes:
                  type: array
                  items:
                    type: string
                  description: A list of scopes allowed for the API key, e.g. `["api.model.request"]`
        api_key.updated:
          type: object
          description: The details for events with this `type`.
          properties:
            id:
              type: string
              description: The tracking ID of the API key.
            changes_requested:
              type: object
              description: The payload used to update the API key.
              properties:
                scopes:
                  type: array
                  items:
                    type: string
                  description: A list of scopes allowed for the API key, e.g. `["api.model.request"]`
        api_key.deleted:
          type: object
          description: The details for events with this `type`.
          properties:
            id:
              type: string
              description: The tracking ID of the API key.
        checkpoint.permission.created:
          type: object
          description: The project and fine-tuned model checkpoint that the checkpoint permission was created for.
          properties:
            id:
              type: string
              description: The ID of the checkpoint permission.
            data:
              type: object
              description: The payload used to create the checkpoint permission.
              properties:
                project_id:
                  type: string
                  description: The ID of the project that the checkpoint permission was created for.
                fine_tuned_model_checkpoint:
                  type: string
                  description: The ID of the fine-tuned model checkpoint.
        checkpoint.permission.deleted:
          type: object
          description: The details for events with this `type`.
          properties:
            id:
              type: string
              description: The ID of the checkpoint permission.
        external_key.registered:
          type: object
          description: The details for events with this `type`.
          properties:
            id:
              type: string
              description: The ID of the external key configuration.
            data:
              type: object
              description: The configuration for the external key.
        external_key.removed:
          type: object
          description: The details for events with this `type`.
          properties:
            id:
              type: string
              description: The ID of the external key configuration.
        group.created:
          type: object
          description: The details for events with this `type`.
          properties:
            id:
              type: string
              description: The ID of the group.
            data:
              type: object
              description: Information about the created group.
              properties:
                group_name:
                  type: string
                  description: The group name.
        group.updated:
          type: object
          description: The details for events with this `type`.
          properties:
            id:
              type: string
              description: The ID of the group.
            changes_requested:
              type: object
              description: The payload used to update the group.
              properties:
                group_name:
                  type: string
                  description: The updated group name.
        group.deleted:
          type: object
          description: The details for events with this `type`.
          properties:
            id:
              type: string
              description: The ID of the group.
        scim.enabled:
          type: object
          description: The details for events with this `type`.
          properties:
            id:
              type: string
              description: The ID of the SCIM was enabled for.
        scim.disabled:
          type: object
          description: The details for events with this `type`.
          properties:
            id:
              type: string
              description: The ID of the SCIM was disabled for.
        invite.sent:
          type: object
          description: The details for events with this `type`.
          properties:
            id:
              type: string
              description: The ID of the invite.
            data:
              type: object
              description: The payload used to create the invite.
              properties:
                email:
                  type: string
                  description: The email invited to the organization.
                role:
                  type: string
                  description: The role the email was invited to be. Is either `owner` or `member`.
        invite.accepted:
          type: object
          description: The details for events with this `type`.
          properties:
            id:
              type: string
              description: The ID of the invite.
        invite.deleted:
          type: object
          description: The details for events with this `type`.
          properties:
            id:
              type: string
              description: The ID of the invite.
        ip_allowlist.created:
          type: object
          description: The details for events with this `type`.
          properties:
            id:
              type: string
              description: The ID of the IP allowlist configuration.
            name:
              type: string
              description: The name of the IP allowlist configuration.
            allowed_ips:
              type: array
              description: The IP addresses or CIDR ranges included in the configuration.
              items:
                type: string
        ip_allowlist.updated:
          type: object
          description: The details for events with this `type`.
          properties:
            id:
              type: string
              description: The ID of the IP allowlist configuration.
            allowed_ips:
              type: array
              description: The updated set of IP addresses or CIDR ranges in the configuration.
              items:
                type: string
        ip_allowlist.deleted:
          type: object
          description: The details for events with this `type`.
          properties:
            id:
              type: string
              description: The ID of the IP allowlist configuration.
            name:
              type: string
              description: The name of the IP allowlist configuration.
            allowed_ips:
              type: array
              description: The IP addresses or CIDR ranges that were in the configuration.
              items:
                type: string
        ip_allowlist.config.activated:
          type: object
          description: The details for events with this `type`.
          properties:
            configs:
              type: array
              description: The configurations that were activated.
              items:
                type: object
                properties:
                  id:
                    type: string
                    description: The ID of the IP allowlist configuration.
                  name:
                    type: string
                    description: The name of the IP allowlist configuration.
        ip_allowlist.config.deactivated:
          type: object
          description: The details for events with this `type`.
          properties:
            configs:
              type: array
              description: The configurations that were deactivated.
              items:
                type: object
                properties:
                  id:
                    type: string
                    description: The ID of the IP allowlist configuration.
                  name:
                    type: string
                    description: The name of the IP allowlist configuration.
        login.succeeded:
          type: object
          description: This event has no additional fields beyond the standard audit log attributes.
        login.failed:
          type: object
          description: The details for events with this `type`.
          properties:
            error_code:
              type: string
              description: The error code of the failure.
            error_message:
              type: string
              description: The error message of the failure.
        logout.succeeded:
          type: object
          description: This event has no additional fields beyond the standard audit log attributes.
        logout.failed:
          type: object
          description: The details for events with this `type`.
          properties:
            error_code:
              type: string
              description: The error code of the failure.
            error_message:
              type: string
              description: The error message of the failure.
        organization.updated:
          type: object
          description: The details for events with this `type`.
          properties:
            id:
              type: string
              description: The organization ID.
            changes_requested:
              type: object
              description: The payload used to update the organization settings.
              properties:
                title:
                  type: string
                  description: The organization title.
                description:
                  type: string
                  description: The organization description.
                name:
                  type: string
                  description: The organization name.
                threads_ui_visibility:
                  type: string
                  description: Visibility of the threads page which shows messages created with the Assistants API and Playground. One of `ANY_ROLE`, `OWNERS`, or `NONE`.
                usage_dashboard_visibility:
                  type: string
                  description: Visibility of the usage dashboard which shows activity and costs for your organization. One of `ANY_ROLE` or `OWNERS`.
                api_call_logging:
                  type: string
                  description: How your organization logs data from supported API calls. One of `disabled`, `enabled_per_call`, `enabled_for_all_projects`, or `enabled_for_selected_projects`
                api_call_logging_project_ids:
                  type: string
                  description: The list of project ids if api_call_logging is set to `enabled_for_selected_projects`
        project.created:
          type: object
          description: The details for events with this `type`.
          properties:
            id:
              type: string
              description: The project ID.
            data:
              type: object
              description: The payload used to create the project.
              properties:
                name:
                  type: string
                  description: The project name.
                title:
                  type: string
                  description: The title of the project as seen on the dashboard.
        project.updated:
          type: object
          description: The details for events with this `type`.
          properties:
            id:
              type: string
              description: The project ID.
            changes_requested:
              type: object
              description: The payload used to update the project.
              properties:
                title:
                  type: string
                  description: The title of the project as seen on the dashboard.
        project.archived:
          type: object
          description: The details for events with this `type`.
          properties:
            id:
              type: string
              description: The project ID.
        project.deleted:
          type: object
          description: The details for events with this `type`.
          properties:
            id:
              type: string
              description: The project ID.
        rate_limit.updated:
          type: object
          description: The details for events with this `type`.
          properties:
            id:
              type: string
              description: The rate limit ID
            changes_requested:
              type: object
              description: The payload used to update the rate limits.
              properties:
                max_requests_per_1_minute:
                  type: integer
                  description: The maximum requests per minute.
                max_tokens_per_1_minute:
                  type: integer
                  description: The maximum tokens per minute.
                max_images_per_1_minute:
                  type: integer
                  description: The maximum images per minute. Only relevant for certain models.
                max_audio_megabytes_per_1_minute:
                  type: integer
                  description: The maximum audio megabytes per minute. Only relevant for certain models.
                max_requests_per_1_day:
                  type: integer
                  description: The maximum requests per day. Only relevant for certain models.
                batch_1_day_max_input_tokens:
                  type: integer
                  description: The maximum batch input tokens per day. Only relevant for certain models.
        rate_limit.deleted:
          type: object
          description: The details for events with this `type`.
          properties:
            id:
              type: string
              description: The rate limit ID
        role.created:
          type: object
          description: The details for events with this `type`.
          properties:
            id:
              type: string
              description: The role ID.
            role_name:
              type: string
              description: The name of the role.
            permissions:
              type: array
              items:
                type: string
              description: The permissions granted by the role.
            resource_type:
              type: string
              description: The type of resource the role belongs to.
            resource_id:
              type: string
              description: The resource the role is scoped to.
        role.updated:
          type: object
          description: The details for events with this `type`.
          properties:
            id:
              type: string
              description: The role ID.
            changes_requested:
              type: object
              description: The payload used to update the role.
              properties:
                role_name:
                  type: string
                  description: The updated role name, when provided.
                resource_id:
                  type: string
                  description: The resource the role is scoped to.
                resource_type:
                  type: string
                  description: The type of resource the role belongs to.
                permissions_added:
                  type: array
                  items:
                    type: string
                  description: The permissions added to the role.
                permissions_removed:
                  type: array
                  items:
                    type: string
                  description: The permissions removed from the role.
                description:
                  type: string
                  description: The updated role description, when provided.
                metadata:
                  type: object
                  description: Additional metadata stored on the role.
        role.deleted:
          type: object
          description: The details for events with this `type`.
          properties:
            id:
              type: string
              description: The role ID.
        role.assignment.created:
          type: object
          description: The details for events with this `type`.
          properties:
            id:
              type: string
              description: The identifier of the role assignment.
            principal_id:
              type: string
              description: The principal (user or group) that received the role.
            principal_type:
              type: string
              description: The type of principal (user or group) that received the role.
            resource_id:
              type: string
              description: The resource the role assignment is scoped to.
            resource_type:
              type: string
              description: The type of resource the role assignment is scoped to.
        role.assignment.deleted:
          type: object
          description: The details for events with this `type`.
          properties:
            id:
              type: string
              description: The identifier of the role assignment.
            principal_id:
              type: string
              description: The principal (user or group) that had the role removed.
            principal_type:
              type: string
              description: The type of principal (user or group) that had the role removed.
            resource_id:
              type: string
              description: The resource the role assignment was scoped to.
            resource_type:
              type: string
              description: The type of resource the role assignment was scoped to.
        service_account.created:
          type: object
          description: The details for events with this `type`.
          properties:
            id:
              type: string
              description: The service account ID.
            data:
              type: object
              description: The payload used to create the service account.
              properties:
                role:
                  type: string
                  description: The role of the service account. Is either `owner` or `member`.
        service_account.updated:
          type: object
          description: The details for events with this `type`.
          properties:
            id:
              type: string
              description: The service account ID.
            changes_requested:
              type: object
              description: The payload used to updated the service account.
              properties:
                role:
                  type: string
                  description: The role of the service account. Is either `owner` or `member`.
        service_ac

# --- truncated at 32 KB (44 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/openai/refs/heads/main/openapi/openai-audit-logs-api-openapi.yml