> ## 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.

# Count completed intents

> Counts distinct intents that finished within a trailing window, for the caller's organization. Counts intents rather than actions, so an order amended twice counts once. Live intents are not included: they have not finished, and the intents service holds them.



## OpenAPI

````yaml /api-reference/ledger.openapi.json get /v1/ledger/intents/stats
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/stats:
    get:
      tags:
        - Ledger
      summary: Count completed intents
      description: >-
        Counts distinct intents that finished within a trailing window, for the
        caller's organization. Counts intents rather than actions, so an order
        amended twice counts once. Live intents are not included: they have not
        finished, and the intents service holds them.
      operationId: getIntentHistoryStats
      parameters:
        - name: account_id
          in: query
          description: Trading account ID. Omitted counts the whole 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: days
          in: query
          description: >-
            Trailing day count. Capped at 90, and again at the window the
            caller's plan grants.
          required: true
          schema:
            type: integer
            format: int64
          example: 30
      responses:
        '200':
          description: Count 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/IntentHistoryStatsResponse'
              example:
                intent_count: 148
        '401':
          description: Unauthorized
        '403':
          description: Not permitted to read intents for this organization
      security:
        - bearerAuth: []
        - apiKeyAuth: []
components:
  schemas:
    BrokerEnvironment:
      type: string
      enum:
        - paper
        - live
    IntentHistoryStatsResponse:
      type: object
      description: >-
        How many intents finished in a window.


        Distinct intents, not actions: an order amended twice is one intent, and

        counting its three rows would make an active desk look three times
        busier

        than a passive one placing the same number of orders.
      required:
        - intent_count
      properties:
        intent_count:
          type: integer
          format: int64
          minimum: 0
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````