> ## 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 order lifecycle metrics

> Reports how long orders took and how they ended, over a trailing window bucketed hourly for a single day and daily beyond that. Orders are attributed to the bucket their first snapshot landed in and counted once each. Percentiles are null for a bucket with no samples rather than zero, because a bucket in which nothing filled has no time-to-fill.



## OpenAPI

````yaml /api-reference/ledger.openapi.json get /v1/orders/lifecycle
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/orders/lifecycle:
    get:
      tags:
        - Ledger
      summary: Get order lifecycle metrics
      description: >-
        Reports how long orders took and how they ended, over a trailing window
        bucketed hourly for a single day and daily beyond that. Orders are
        attributed to the bucket their first snapshot landed in and counted once
        each. Percentiles are null for a bucket with no samples rather than
        zero, because a bucket in which nothing filled has no time-to-fill.
      operationId: getOrderLifecycle
      parameters:
        - name: account_id
          in: query
          description: >-
            Trading account ID. Omitted, the window 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: days
          in: query
          description: >-
            Trailing day count. Clamped to 1..=90 and then to the window the
            caller's plan grants; a single day is reported as 24 hourly buckets
          required: true
          schema:
            type: integer
            format: int64
          example: 7
        - name: symbol
          in: query
          description: >-
            Filter by symbol. Symbols are normalized to uppercase; a blank value
            is treated as no filter
          required: false
          schema:
            type: string
          example: AAPL
      responses:
        '200':
          description: Lifecycle metrics 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/OrderLifecycleResponse'
              example:
                data:
                  - cancelled_count: 6
                    filled_count: 42
                    ingest_lag:
                      p50_ms: 295
                      p95_ms: 910
                      p99_ms: 1804
                      sample_count: 380
                    open_count: 1
                    order_count: 51
                    partial_fill_count: 3
                    rejected_count: 2
                    time_to_ack:
                      p50_ms: 19
                      p95_ms: 54
                      p99_ms: 91
                      sample_count: 51
                    time_to_fill:
                      p50_ms: 118
                      p95_ms: 806
                      p99_ms: 1502
                      sample_count: 42
                    timestamp: '2026-08-13T00:00:00Z'
                granularity: day
        '400':
          description: >-
            Query parameters are invalid, including a missing or non-numeric
            `days`
          content:
            text/plain:
              schema:
                type: string
        '401':
          description: >-
            Missing or invalid authentication credentials or organization
            context
          content:
            text/plain:
              schema:
                type: string
        '403':
          description: >-
            Caller lacks intent read access, organization access, or ownership
            of the requested trading account, or is on the free tier: analytics
            requires a paid plan and is refused with `BillingTierRestriction`
          content:
            text/plain:
              schema:
                type: string
        '429':
          description: Caller exceeded the request rate limit
          content:
            text/plain:
              schema:
                type: string
        '500':
          description: Unexpected server error while reading lifecycle metrics
          content:
            text/plain:
              schema:
                type: string
      security:
        - bearerAuth: []
        - apiKeyAuth: []
components:
  schemas:
    BrokerEnvironment:
      type: string
      enum:
        - paper
        - live
    OrderLifecycleResponse:
      type: object
      required:
        - granularity
        - data
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/OrderLifecycleBucket'
          description: >-
            One entry per bucket, oldest first, including buckets in which
            nothing

            happened, so the series can be plotted without the caller filling
            gaps.
        granularity:
          $ref: '#/components/schemas/StatsGranularity'
    OrderLifecycleBucket:
      type: object
      description: One bucket of the order lifecycle window.
      required:
        - timestamp
        - time_to_fill
        - time_to_ack
        - ingest_lag
        - filled_count
        - cancelled_count
        - rejected_count
        - open_count
        - order_count
        - partial_fill_count
      properties:
        cancelled_count:
          type: integer
          format: int64
          minimum: 0
        filled_count:
          type: integer
          format: int64
          description: >-
            Orders whose *first* snapshot landed in this bucket, counted once
            each

            by where they ended up. An order still working at the moment of the

            query counts as `open`, so the four always sum to `order_count`.
          minimum: 0
        ingest_lag:
          $ref: '#/components/schemas/DurationPercentiles'
          description: >-
            `received_at` to `inserted_at` on every snapshot written in this
            bucket:

            how far behind the events it reports this reporting surface runs.


            Unlike the two above, this is measured per snapshot rather than per

            order: one order contributes as many samples as it produced rows.
        open_count:
          type: integer
          format: int64
          minimum: 0
        order_count:
          type: integer
          format: int64
          minimum: 0
        partial_fill_count:
          type: integer
          format: int64
          description: |-
            Orders that reached a terminal state having traded some of their
            quantity but not all of it.
          minimum: 0
        rejected_count:
          type: integer
          format: int64
          minimum: 0
        time_to_ack:
          $ref: '#/components/schemas/DurationPercentiles'
          description: |-
            Placement to the broker acknowledging the order, `PENDING_NEW` to
            `NEW`. Separates the platform's own handoff cost from the broker's.
        time_to_fill:
          $ref: '#/components/schemas/DurationPercentiles'
          description: |-
            Placement to first reported fill, over orders that filled in this
            bucket. Measures the round trip a caller actually waits on.
        timestamp:
          type: string
          format: date-time
          description: Start of the bucket, as an RFC 3339 UTC timestamp.
    StatsGranularity:
      type: string
      description: Width of one bucket in a stats series.
      enum:
        - hour
        - day
    DurationPercentiles:
      type: object
      description: >-
        A duration distribution over one bucket, in milliseconds.


        Every percentile is `null` when `sample_count` is zero. A bucket in
        which

        nothing filled has no time-to-fill, and reporting that as `0` would pull
        a

        chart's line to the floor on quiet days as though execution had become

        instant.
      required:
        - sample_count
      properties:
        p50_ms:
          type:
            - number
            - 'null'
          format: double
        p95_ms:
          type:
            - number
            - 'null'
          format: double
        p99_ms:
          type:
            - number
            - 'null'
          format: double
        sample_count:
          type: integer
          format: int64
          minimum: 0
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````