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

# List Event History

> Query lifecycle state transition history.

Returns events ordered by timestamp descending within the given
time window. Defaults to the last hour if no window is specified.

Returns:
    List of lifecycle events matching the query criteria.



## OpenAPI

````yaml https://api.pragmatiks.io/openapi.json get /events/history
openapi: 3.1.0
info:
  title: Pragma API
  version: 0.1.0
servers: []
security: []
paths:
  /events/history:
    get:
      tags:
        - events
      summary: List Event History
      description: |-
        Query lifecycle state transition history.

        Returns events ordered by timestamp descending within the given
        time window. Defaults to the last hour if no window is specified.

        Returns:
            List of lifecycle events matching the query criteria.
      operationId: events-list_event_history
      parameters:
        - name: since
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date-time
              - type: 'null'
            description: Start of time window (ISO 8601). Defaults to 1 hour ago.
            title: Since
          description: Start of time window (ISO 8601). Defaults to 1 hour ago.
        - name: until
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date-time
              - type: 'null'
            description: End of time window (ISO 8601). Defaults to now.
            title: Until
          description: End of time window (ISO 8601). Defaults to now.
        - name: resource_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Filter to a specific resource by SurrealDB ID.
            title: Resource Id
          description: Filter to a specific resource by SurrealDB ID.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/LifecycleEvent'
                title: Response Events-List Event History
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    LifecycleEvent:
      properties:
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
        organization_id:
          type: string
          title: Organization Id
        resource_id:
          type: string
          title: Resource Id
        resource_name:
          type: string
          title: Resource Name
        provider:
          type: string
          title: Provider
        resource_type:
          type: string
          title: Resource Type
        event_type:
          type: string
          title: Event Type
        from_state:
          anyOf:
            - $ref: '#/components/schemas/LifecycleState'
            - type: 'null'
        to_state:
          $ref: '#/components/schemas/LifecycleState'
        actor_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Actor Type
        actor_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Actor Id
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
        timestamp:
          type: string
          format: date-time
          title: Timestamp
        expires_at:
          type: string
          format: date-time
          title: Expires At
      type: object
      required:
        - organization_id
        - resource_id
        - resource_name
        - provider
        - resource_type
        - event_type
        - to_state
      title: LifecycleEvent
      description: |-
        A recorded lifecycle state transition for a resource.

        Attributes:
            id: SurrealDB record ID (populated by database).
            organization_id: Tenant that owns the resource.
            resource_id: SurrealDB resource ID.
            resource_name: Human-readable resource name.
            provider: Provider that manages the resource.
            resource_type: Resource type name.
            event_type: Lifecycle event that caused the transition (e.g. apply, success, failure).
            from_state: State before transition, None for initial creation.
            to_state: State after transition.
            actor_type: Who caused this event ("user", "agent", "system"), None for legacy events.
            actor_id: Identifier for the actor (user ID or agent resource ID), None for legacy events.
            error: Error message when transitioning to FAILED state.
            timestamp: When the transition occurred.
            expires_at: When this event should be garbage collected.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    LifecycleState:
      type: string
      enum:
        - draft
        - waiting
        - pending
        - processing
        - ready
        - failed
        - deleting
      title: LifecycleState
      description: Lifecycle states for resources.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````