> ## Documentation Index
> Fetch the complete documentation index at: https://openai-hd4n6.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# List audit logs

> List user actions and configuration changes within this organization.



## OpenAPI

````yaml api-definition.yaml get /organization/audit_logs
openapi: 3.0.0
info:
  title: OpenAI API
  description: >-
    The OpenAI REST API. Please see
    https://platform.openai.com/docs/api-reference for more details.
  version: 2.3.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: Assistants
    description: Build Assistants that can call models and use tools.
  - name: Audio
    description: Turn audio into text or text into audio.
  - name: Chat
    description: >-
      Given a list of messages comprising a conversation, the model will return
      a response.
  - name: Completions
    description: >-
      Given a prompt, the model will return one or more predicted completions,
      and can also return the probabilities of alternative tokens at each
      position.
  - name: Embeddings
    description: >-
      Get a vector representation of a given input that can be easily consumed
      by machine learning models and algorithms.
  - name: Evals
    description: Manage and run evals in the OpenAI platform.
  - name: Fine-tuning
    description: Manage fine-tuning jobs to tailor a model to your specific training data.
  - name: Batch
    description: Create large batches of API requests to run asynchronously.
  - name: Files
    description: >-
      Files are used to upload documents that can be used with features like
      Assistants and Fine-tuning.
  - name: Uploads
    description: Use Uploads to upload large files in multiple parts.
  - name: Images
    description: Given a prompt and/or an input image, the model will generate a new image.
  - name: Models
    description: List and describe the various models available in the API.
  - name: Moderations
    description: >-
      Given text and/or image inputs, classifies if those inputs are potentially
      harmful.
  - name: Audit Logs
    description: List user actions and configuration changes within this organization.
paths:
  /organization/audit_logs:
    get:
      tags:
        - Audit Logs
      summary: List audit logs
      description: List user actions and configuration changes within this organization.
      operationId: list-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'
components:
  schemas:
    AuditLogEventType:
      type: string
      description: The event type.
      x-oaiExpandable: true
      enum:
        - api_key.created
        - api_key.updated
        - api_key.deleted
        - checkpoint_permission.created
        - checkpoint_permission.deleted
        - invite.sent
        - invite.accepted
        - invite.deleted
        - login.succeeded
        - login.failed
        - logout.succeeded
        - logout.failed
        - organization.updated
        - project.created
        - project.updated
        - project.archived
        - service_account.created
        - service_account.updated
        - service_account.deleted
        - rate_limit.updated
        - rate_limit.deleted
        - user.added
        - user.updated
        - user.deleted
    ListAuditLogsResponse:
      type: object
      properties:
        object:
          type: string
          enum:
            - list
          x-stainless-const: true
        data:
          type: array
          items:
            $ref: '#/components/schemas/AuditLog'
        first_id:
          type: string
          example: audit_log-defb456h8dks
        last_id:
          type: string
          example: audit_log-hnbkd8s93s
        has_more:
          type: boolean
      required:
        - object
        - data
        - first_id
        - last_id
        - has_more
    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
          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.
          properties:
            id:
              type: string
              description: The project ID.
            name:
              type: string
              description: The project title.
        actor:
          $ref: '#/components/schemas/AuditLogActor'
        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.
        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.
        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.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.
                settings:
                  type: object
                  properties:
                    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`.
        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.
        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
        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_account.deleted:
          type: object
          description: The details for events with this `type`.
          properties:
            id:
              type: string
              description: The service account ID.
        user.added:
          type: object
          description: The details for events with this `type`.
          properties:
            id:
              type: string
              description: The user ID.
            data:
              type: object
              description: The payload used to add the user to the project.
              properties:
                role:
                  type: string
                  description: The role of the user. Is either `owner` or `member`.
        user.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 user.
              properties:
                role:
                  type: string
                  description: The role of the user. Is either `owner` or `member`.
        user.deleted:
          type: object
          description: The details for events with this `type`.
          properties:
            id:
              type: string
              description: The user ID.
        certificate.created:
          type: object
          description: The details for events with this `type`.
          properties:
            id:
              type: string
              description: The certificate ID.
            name:
              type: string
              description: The name of the certificate.
        certificate.updated:
          type: object
          description: The details for events with this `type`.
          properties:
            id:
              type: string
              description: The certificate ID.
            name:
              type: string
              description: The name of the certificate.
        certificate.deleted:
          type: object
          description: The details for events with this `type`.
          properties:
            id:
              type: string
              description: The certificate ID.
            name:
              type: string
              description: The name of the certificate.
            certificate:
              type: string
              description: The certificate content in PEM format.
        certificates.activated:
          type: object
          description: The details for events with this `type`.
          properties:
            certificates:
              type: array
              items:
                type: object
                properties:
                  id:
                    type: string
                    description: The certificate ID.
                  name:
                    type: string
                    description: The name of the certificate.
        certificates.deactivated:
          type: object
          description: The details for events with this `type`.
          properties:
            certificates:
              type: array
              items:
                type: object
                properties:
                  id:
                    type: string
                    description: The certificate ID.
                  name:
                    type: string
                    description: The name of the certificate.
      required:
        - id
        - type
        - effective_at
        - actor
      x-oaiMeta:
        name: The audit log object
        example: |
          {
              "id": "req_xxx_20240101",
              "type": "api_key.created",
              "effective_at": 1720804090,
              "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"
                  }
              },
              "api_key.created": {
                  "id": "key_xxxx",
                  "data": {
                      "scopes": ["resource.operation"]
                  }
              }
          }
    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'
    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.
    AuditLogActorApiKey:
      type: object
      description: The API Key used to perform the audit logged action.
      properties:
        id:
          type: string
          description: The tracking id of the API key.
        type:
          type: string
          description: The type of API key. Can be either `user` or `service_account`.
          enum:
            - user
            - service_account
        user:
          $ref: '#/components/schemas/AuditLogActorUser'
        service_account:
          $ref: '#/components/schemas/AuditLogActorServiceAccount'
    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.
    AuditLogActorServiceAccount:
      type: object
      description: The service account that performed the audit logged action.
      properties:
        id:
          type: string
          description: The service account id.
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer

````