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

# Get completed intents

> Lists intents that have filled, been cancelled or been rejected, for the caller's organization. Live intents are served by the intents service at `/v1/intents`; this endpoint serves the record of finished ones. The record is kept for six years, and how much of it a caller may read is set by their plan: `start` is raised to that window when it reaches back past it, and omitting `start` reads from the window rather than from the beginning. The `anthid-retention-days` response header carries the window applied. Returns one row per action by default so an amended order shows what it was amended from; pass `terminal_only=true` for one row per intent.



## OpenAPI

````yaml /api-reference/ledger.openapi.json get /v1/ledger/intents/history
openapi: 3.1.0
info:
  title: ledger
  description: ''
  license:
    name: ''
  version: 0.1.0
servers:
  - url: https://api.anthid.com
    description: Production
security: []
tags:
  - name: Ledger
    description: Read current orders, order history, and order activity
  - name: Ledger
    description: Read current positions and position history
  - name: Ledger
    description: Read platform-wide execution metrics
  - name: Ledger
    description: >-
      Read ledger-wide reference data, such as the symbols an organization has
      traded
  - name: Ledger
    description: >-
      Read completed intents. Live ones are served by the intents service at
      /v1/intents; this is the six year record of finished ones
paths:
  /v1/ledger/intents/history:
    get:
      tags:
        - Ledger
      summary: Get completed intents
      description: >-
        Lists intents that have filled, been cancelled or been rejected, for the
        caller's organization. Live intents are served by the intents service at
        `/v1/intents`; this endpoint serves the record of finished ones. The
        record is kept for six years, and how much of it a caller may read is
        set by their plan: `start` is raised to that window when it reaches back
        past it, and omitting `start` reads from the window rather than from the
        beginning. The `anthid-retention-days` response header carries the
        window applied. Returns one row per action by default so an amended
        order shows what it was amended from; pass `terminal_only=true` for one
        row per intent.
      operationId: getIntentHistory
      parameters:
        - name: account_id
          in: query
          description: >-
            Trading account ID. Omitted, the read covers every account in the
            organization.
          required: false
          schema:
            type: string
            format: uuid
          example: 550e8400-e29b-41d4-a716-446655440000
        - name: environment
          in: query
          description: >-
            Required. Which environment the read covers. Resolved to the
            organization's accounts in that environment, including disabled and
            deleted ones, since the ledger stores no environment of its own.
            Rejected with 400 when it disagrees with the account named alongside
            it.
          required: true
          schema:
            $ref: '#/components/schemas/BrokerEnvironment'
          example: paper
        - name: intent_id
          in: query
          description: One intent, by id. Returns its whole action chain.
          required: false
          schema:
            type: string
            format: uuid
          example: 550e8400-e29b-41d4-a716-446655440111
        - name: symbol
          in: query
          description: Filter by symbol. Normalized to uppercase.
          required: false
          schema:
            type: string
          example: AAPL
        - name: terminal_status
          in: query
          description: 'How the intent ended: FILLED, CANCELLED or REJECTED'
          required: false
          schema:
            type: string
          example: FILLED
        - name: start
          in: query
          description: >-
            Inclusive range start, against the sort column when that is a clock
            and `terminal_at` otherwise
          required: false
          schema:
            type: string
            format: date-time
          example: '2026-08-01T00:00:00Z'
        - name: end
          in: query
          description: Exclusive range end, bounding the same column as `start`
          required: false
          schema:
            type: string
            format: date-time
          example: '2026-08-06T00:00:00Z'
        - name: terminal_only
          in: query
          description: One row per intent instead of one per action
          required: false
          schema:
            type: boolean
          example: false
        - name: limit
          in: query
          description: Maximum rows; defaults to 100 and is capped at 1000
          required: false
          schema:
            type: integer
            format: int32
            minimum: 0
          example: 100
        - name: sort_by
          in: query
          description: Sort field; defaults to `terminal_at`
          required: false
          schema:
            $ref: '#/components/schemas/IntentHistorySortBy'
          example: terminal_at
        - name: sort_direction
          in: query
          description: Sort direction; defaults to `Desc`
          required: false
          schema:
            $ref: '#/components/schemas/SortDirection'
          example: Desc
        - name: next_cursor
          in: query
          description: >-
            Opaque keyset cursor from a previous response. Only valid for the
            `sort_by` it was issued with.
          required: false
          schema:
            type: string
      responses:
        '200':
          description: Completed intents retrieved
          headers:
            anthid-retention-days:
              schema:
                type: integer
                format: int64
              description: >-
                Trailing window, in days, that this answer was produced under.
                Comes from the caller's plan, so a value shorter than the range
                requested means the range was narrowed to it. Absent for
                internal service callers, who have no window.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IntentHistoryResponse'
        '400':
          description: Malformed cursor, or a cursor issued for a different sort
        '401':
          description: Unauthorized
        '403':
          description: Not permitted to read intents for this organization
      security:
        - bearerAuth: []
        - apiKeyAuth: []
components:
  schemas:
    BrokerEnvironment:
      type: string
      enum:
        - paper
        - live
    IntentHistorySortBy:
      type: string
      description: >-
        Sortable columns on completed intents.


        Deliberately short. Every column here is either in the table's sort key
        or

        cheap to scan, and a sort offered over a six year table is a promise
        about

        cost as much as about ordering.
      enum:
        - terminal_at
        - created_at
        - received_at
        - symbol
    SortDirection:
      type: string
      enum:
        - Asc
        - Desc
    IntentHistoryResponse:
      type: object
      required:
        - data
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/IntentHistoryAction'
        next_cursor:
          type:
            - string
            - 'null'
    IntentHistoryAction:
      allOf:
        - $ref: '#/components/schemas/IntentActionRecord'
        - type: object
          required:
            - terminal_status
            - terminal_seq
            - filled_quantity
            - terminal_at
          properties:
            external_order_id:
              type:
                - string
                - 'null'
              description: >-
                The broker's id for the final order in the chain. Absent when
                the intent

                was rejected before the broker booked anything.
            filled_quantity:
              $ref: '#/components/schemas/Quantity'
              description: >-
                How much filled before the intent ended. Non-zero on a
                `CANCELLED`

                intent that had filled partially, which is why it is carried
                rather than

                inferred from the status.
            principal_name:
              type:
                - string
                - 'null'
              description: >-
                The directory's name for `principal_id` when the action was
                taken.

                `None` for an API key or a service, neither of which has a
                person to

                name.
            terminal_at:
              type: string
              format: date-time
              description: >-
                When the intent ended, from the broker's own event time rather
                than when

                the platform observed it.
            terminal_seq:
              type: integer
              format: int64
              description: >-
                The action that reached that status. `seq == terminal_seq` marks
                the

                last link in the chain.
            terminal_status:
              $ref: '#/components/schemas/IntentRuntimeStatus'
              description: >-
                How the intent ended. Always `FILLED`, `CANCELLED` or
                `REJECTED`.


                Repeated on every action in the chain, so a caller reading a
                replace can

                see the outcome without fetching the rest.
      description: >-
        One action of a completed intent, as the archive holds it.


        The action is flattened, matching `IntentActionWithState` on the intents

        API: a caller moving from "what is live" to "what did we do" reads
        `symbol`

        and `seq` at the top level in both responses, and only the fields that
        are

        genuinely different differ.


        What differs is the tail. There is no dispatch `state` here, because a

        finished intent was dispatched by definition, and no `runtime_status`,

        because a status that can no longer change is called `terminal_status`.
    IntentActionRecord:
      type: object
      required:
        - organization_id
        - account_id
        - intent_id
        - seq
        - action_type
        - symbol
        - order_side
        - order_type
        - route_strategy
        - quantity
        - principal_type
        - principal_id
        - request_id
        - received_at
        - created_at
      properties:
        account_id:
          type: string
          format: uuid
        action_type:
          $ref: '#/components/schemas/ActionType'
        client_reference_id:
          type:
            - string
            - 'null'
        created_at:
          type: string
          format: date-time
        idempotency_key:
          type:
            - string
            - 'null'
        intent_id:
          type: string
          format: uuid
        limit_price:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Price'
        order_side:
          $ref: '#/components/schemas/OrderSide'
        order_type:
          $ref: '#/components/schemas/OrderType'
        organization_id:
          type: string
          format: uuid
        principal_id:
          type: string
        principal_type:
          $ref: '#/components/schemas/PrincipalType'
        quantity:
          $ref: '#/components/schemas/Quantity'
        received_at:
          type: string
          format: date-time
        request_id:
          type: string
        route_strategy:
          $ref: '#/components/schemas/RouteStrategy'
        seq:
          type: integer
          format: int64
        source_ip:
          type:
            - string
            - 'null'
        stop_price:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Price'
        symbol:
          type: string
        time_in_force:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/TimeInForce'
    Quantity:
      type: string
    IntentRuntimeStatus:
      type: string
      description: >-
        Where an intent stands at the broker.


        Distinct from [`super::record::IntentState`], which is how far a
        *command*

        has got in being dispatched. This is what became of the order once it

        arrived: dispatch can read `SENT` while the order behind it is still
        working,

        and it stays `SENT` forever after the order fills.
      enum:
        - PENDING
        - OPEN
        - PARTIALLY_FILLED
        - FILLED
        - CANCELLED
        - REJECTED
    ActionType:
      type: string
      enum:
        - CREATE
        - REPLACE
        - CANCEL
    Price:
      type: string
    OrderSide:
      type: string
      enum:
        - UNSPECIFIED
        - BUY
        - SELL
        - SELL_SHORT
    OrderType:
      type: string
      enum:
        - UNSPECIFIED
        - LIMIT
        - MARKET
        - FILL_OR_KILL
        - LIMIT_ON_OPEN
        - LIMIT_ON_CLOSE
        - MARKET_ON_OPEN
        - MARKET_ON_CLOSE
        - STOP
        - STOP_LIMIT
        - TRAILING_STOP
    PrincipalType:
      type: string
      description: >-
        Class of credential behind an instruction.


        An order placed with an organization's API key, one placed by a person

        signed in to the dashboard, and one placed by an Anthid service acting
        on

        the organization's behalf are three different claims once an order is

        disputed. Recording only the organization cannot tell them apart.
      enum:
        - API_KEY
        - USER
        - SERVICE
    RouteStrategy:
      type: string
      enum:
        - UNSPECIFIED
        - SMART
        - AMEX
        - ARCA
        - BATS
        - BATY
        - EDGA
        - EDGX
        - NSDQ
        - NYSE
    TimeInForce:
      type: string
      enum:
        - UNSPECIFIED
        - DAY
        - IMMEDIATE_OR_CANCEL
        - GOOD_TILL_CANCEL
        - AT_OPEN
        - AT_CLOSE
        - FILL_OR_KILL
        - EXT
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````