> ## Documentation Index
> Fetch the complete documentation index at: https://developers.telnyx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# List Audit Logs

> Retrieve a list of audit log entries. Audit logs are a best-effort, eventually consistent record of significant account-related changes.



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/account-billing/audit.yml get /audit_events
openapi: 3.1.0
info:
  title: Telnyx Audit Trail API
  version: 2.0.0
  description: API for Audit trail.
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
paths:
  /audit_events:
    get:
      tags:
        - Audit Logs
      summary: List Audit Logs
      description: >-
        Retrieve a list of audit log entries. Audit logs are a best-effort,
        eventually consistent record of significant account-related changes.
      operationId: ListAuditLogs
      parameters:
        - $ref: '#/components/parameters/audit-logs_PageConsolidated'
        - $ref: '#/components/parameters/audit-logs_FilterConsolidated'
        - $ref: '#/components/parameters/Sort'
      responses:
        '200':
          $ref: '#/components/responses/AuditLogListResponse'
        '401':
          $ref: '#/components/responses/AuditLogsGenericErrorResponse'
        default:
          $ref: '#/components/responses/AuditLogsGenericErrorResponse'
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Telnyx from 'telnyx';


            const client = new Telnyx({
              apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
            });


            // Automatically fetches more pages as needed.

            for await (const auditEventListResponse of
            client.auditEvents.list()) {
              console.log(auditEventListResponse.id);
            }
        - lang: Python
          source: |-
            import os
            from telnyx import Telnyx

            client = Telnyx(
                api_key=os.environ.get("TELNYX_API_KEY"),  # This is the default and can be omitted
            )
            page = client.audit_events.list()
            page = page.data[0]
            print(page.id)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/team-telnyx/telnyx-go\"\n\t\"github.com/team-telnyx/telnyx-go/option\"\n)\n\nfunc main() {\n\tclient := telnyx.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.AuditEvents.List(context.TODO(), telnyx.AuditEventListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n"
        - lang: Java
          source: |-
            package com.telnyx.sdk.example;

            import com.telnyx.sdk.client.TelnyxClient;
            import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
            import com.telnyx.sdk.models.auditevents.AuditEventListPage;
            import com.telnyx.sdk.models.auditevents.AuditEventListParams;

            public final class Main {
                private Main() {}

                public static void main(String[] args) {
                    TelnyxClient client = TelnyxOkHttpClient.fromEnv();

                    AuditEventListPage page = client.auditEvents().list();
                }
            }
        - lang: Ruby
          source: |-
            require "telnyx"

            telnyx = Telnyx::Client.new(api_key: "My API Key")

            page = telnyx.audit_events.list

            puts(page)
        - lang: CLI
          source: |-
            telnyx audit-events list \
              --api-key 'My API Key'
components:
  parameters:
    audit-logs_PageConsolidated:
      name: page
      in: query
      style: deepObject
      explode: true
      description: >-
        Consolidated page parameter (deepObject style). Originally:
        page[number], page[size]
      schema:
        type: object
        properties:
          number:
            type: integer
            example: 1
            description: Page number to load.
          size:
            type: integer
            example: 10
            description: Number of items per page.
    audit-logs_FilterConsolidated:
      name: filter
      in: query
      style: deepObject
      explode: true
      description: >-
        Consolidated filter parameter (deepObject style). Originally:
        filter[created_before], filter[created_after]
      schema:
        type: object
        properties:
          created_before:
            type: string
            format: date-time
            example: '2021-01-01T00:00:00Z'
            description: Filter for audit events created before a specific date.
          created_after:
            type: string
            format: date-time
            example: '2021-01-01T00:00:00Z'
            description: Filter for audit events created after a specific date.
    Sort:
      name: sort
      in: query
      description: Set the order of the results by the creation date.
      required: false
      schema:
        type: string
        enum:
          - asc
          - desc
        example: desc
  responses:
    AuditLogListResponse:
      description: A list of audit log entries.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/AuditLogList'
    AuditLogsGenericErrorResponse:
      description: Unexpected error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/AuditLogsErrors'
  schemas:
    AuditLogList:
      type: object
      title: Audit Log List
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/AuditLog'
        meta:
          $ref: '#/components/schemas/audit-logs_PaginationMeta'
    AuditLogsErrors:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/audit-logs_Error'
    AuditLog:
      type: object
      title: Audit Log Entry
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for the audit log entry.
          example: 550e8400-e29b-41d4-a716-446655440000
        user_id:
          type: string
          format: uuid
          description: Unique identifier for the user who made the change.
          example: 550e8400-e29b-41d4-a716-446655440001
        record_type:
          type: string
          description: The type of the resource being audited.
          example: audit_event
        resource_id:
          type: string
          description: Unique identifier for the resource that was changed.
          example: 550e8400-e29b-41d4-a716-446655440002
        alternate_resource_id:
          type:
            - string
            - 'null'
          description: >-
            An alternate identifier for a resource which may be considered
            unique enough to identify the resource but is not the primary
            identifier for the resource. For example, this field could be used
            to store the phone number value for a phone number when the primary
            database identifier is a separate distinct value.
          example: '+14155551234'
        change_made_by:
          type: string
          enum:
            - telnyx
            - account_manager
            - account_owner
            - organization_member
          description: >-
            Indicates if the change was made by Telnyx on your behalf, the
            organization owner, a member of your organization, or in the case of
            managed accounts, the account manager.
          example: organization_member
        changes:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/AuditEventChanges'
          description: Details of the changes made to the resource.
          example:
            - field: field.name
              to: old value
              from: new value
        organization_id:
          type: string
          format: uuid
          description: Unique identifier for the organization that owns the resource.
          example: 550e8400-e29b-41d4-a716-446655440003
        change_type:
          type: string
          description: The type of change that occurred.
          example: update
        created_at:
          type: string
          format: date-time
          description: ISO 8601 formatted date indicating when the change occurred.
          example: '2023-01-01T00:00:00Z'
    audit-logs_PaginationMeta:
      type: object
      title: Pagination Meta
      properties:
        total_pages:
          type: integer
          example: 3
        total_results:
          type: integer
          example: 50
        page_number:
          type: integer
          example: 1
        page_size:
          type: integer
          example: 10
    audit-logs_Error:
      type: object
      properties:
        code:
          type: string
          description: Error code.
          example: '10001'
        title:
          type: string
          description: Short description of the error.
          example: Unauthorized
        detail:
          type: string
          description: Detailed information about the error.
          example: The request requires user authentication.
    AuditEventChanges:
      type: object
      title: Audit Event Changes
      description: Details of the changes made to a resource.
      properties:
        field:
          type: string
          description: >-
            The name of the field that was changed. May use the dot notation to
            indicate nested fields.
          example: nested.field.name
        to:
          anyOf:
            - type: string
            - type: number
            - type: boolean
            - type: object
              additionalProperties: true
            - type: array
              items: {}
            - type: 'null'
          description: The new value of the field. Can be any JSON type.
          example: 12345
        from:
          anyOf:
            - type: string
            - type: number
            - type: boolean
            - type: object
              additionalProperties: true
            - type: array
              items: {}
            - type: 'null'
          description: The previous value of the field. Can be any JSON type.
          example: 54321
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````