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

# List audit events

> Returns the audit events of the API key's environment, newest first. Results are ordered by `occurred_at` descending, then `id` descending, so paging with `cursor` returns every event once. Filters combine with AND. Events that belong to the organization and not to one environment, such as membership changes, are not returned. Only an API key can call this endpoint. An agent's run key gets `403`.



## OpenAPI

````yaml /openapi.json get /audit_events
openapi: 3.1.0
info:
  title: End Close API
  description: REST API is used to interact with the End Close platform.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.endclose.com/v1
security:
  - ApiKeyAuth: []
paths:
  /audit_events:
    get:
      summary: List audit events
      description: >-
        Returns the audit events of the API key's environment, newest first.
        Results are ordered by `occurred_at` descending, then `id` descending,
        so paging with `cursor` returns every event once. Filters combine with
        AND. Events that belong to the organization and not to one environment,
        such as membership changes, are not returned. Only an API key can call
        this endpoint. An agent's run key gets `403`.
      parameters:
        - in: query
          name: actor_type
          required: false
          schema:
            type: string
            enum:
              - user
              - api_key
              - agent
              - system
          description: Only events by this kind of actor.
        - in: query
          name: actor_id
          required: false
          schema:
            type: string
          description: Only events by the actor with this id.
        - in: query
          name: target_type
          required: false
          schema:
            type: string
          description: >-
            Only events on this kind of object, such as `Reconciliation` or
            `ReconciliationRule`.
        - in: query
          name: target_id
          required: false
          schema:
            type: string
          description: Only events on the object with this id.
        - in: query
          name: event_action
          required: false
          schema:
            type: string
          description: >-
            Only events with this action, such as `reconciliation_rule.updated`.
            The parameter is `event_action`, not `action`.
        - in: query
          name: from
          required: false
          schema:
            type: string
          description: >-
            Only events at or after this time. An ISO 8601 date-time, or a date.
            A date starts at 00:00:00 UTC on that day.
        - in: query
          name: to
          required: false
          schema:
            type: string
          description: >-
            Only events at or before this time. An ISO 8601 date-time, or a
            date. A date includes all of that day in UTC.
        - in: query
          name: cursor
          required: false
          schema:
            type: string
          description: >-
            Opaque cursor from a previous response's `next_cursor`. Omit for the
            first page. Send the same filters with every page.
        - in: query
          name: limit
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 200
            default: 50
      responses:
        '200':
          description: Paginated list of audit events
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/AuditEvent'
                  next_cursor:
                    type: string
                    nullable: true
                    description: Opaque cursor for the next page. Null when no more pages.
                  limit:
                    type: integer
        '401':
          description: Unauthorized
        '403':
          description: The key is not an API key. Agent run keys cannot read audit events.
        '422':
          description: >-
            A filter is not valid, such as an unknown `actor_type` or a `from`
            that is not ISO 8601
components:
  schemas:
    AuditEvent:
      type: object
      description: >-
        One audited action: who (`actor`) did what (`action`) to what
        (`target`), when, from where, and what changed. Events are append-only:
        End Close never changes or deletes an event after it is recorded.
      properties:
        id:
          type: string
          format: uuid
        action:
          type: string
          description: >-
            What happened, as `<subject>.<verb>`. For example
            `reconciliation_rule.updated`, `reconciliation_match.created` or
            `api_key.deleted`.
        occurred_at:
          type: string
          format: date-time
          description: When the action happened, in UTC with millisecond precision.
        actor:
          type: object
          description: >-
            Who acted. The label is the value the actor had when the event was
            recorded, so the event still reads after the actor is removed.
          properties:
            type:
              type: string
              enum:
                - user
                - api_key
                - agent
                - system
              description: >-
                `user` is a person signed in to End Close. `api_key` is one of
                your API keys. `agent` is an End Close agent acting through one
                of its runs. `system` is End Close itself, such as a scheduled
                job.
            id:
              type: string
              nullable: true
              description: The actor's id. Null for `system`.
            label:
              type: string
              nullable: true
              description: >-
                A display value: the person's WorkOS user id, the API key's
                masked token, or the agent's name. An API key's full token is
                never stored.
        target:
          type: object
          nullable: true
          description: What was acted on. Null when the action has no single target.
          properties:
            type:
              type: string
              description: >-
                The kind of object, such as `Reconciliation`,
                `ReconciliationRule` or `APIKey`.
            id:
              type: string
              description: The object's id.
            label:
              type: string
              nullable: true
              description: The object's name when the event was recorded.
        changes:
          type: object
          additionalProperties:
            type: array
            minItems: 2
            maxItems: 2
            items: {}
          description: >-
            The changed attributes, as `{ "attribute": [before, after] }`. Empty
            when nothing was changed in place. Secrets and tokens are redacted.
        metadata:
          type: object
          additionalProperties: true
          description: >-
            More detail for the action, such as the record ids of a manual match
            and its `adjustment_reason`. Its keys depend on the action.
        source:
          type: string
          description: >-
            How the action reached End Close, such as `web`, `api`, `mcp`, `job`
            or `system`.
        environment_id:
          type: string
          format: uuid
        request_id:
          type: string
          nullable: true
          description: The id of the request that caused the action, when there was one.
        ip_address:
          type: string
          nullable: true
          description: The IP address of the request, when there was one.
        user_agent:
          type: string
          nullable: true
          description: The user agent of the request, when there was one.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.