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

# Get historical orders

> Returns historical orders for the authenticated user, newest first by default, paged via the response cursor. The time range is optional and unbounded; an inverted range (`end_timestamp_ns` <= `start_timestamp_ns`) is rejected with a 400. Optionally narrow the result to specific orders via `order_id` and/or `order_ids`. Pages may be returned partial.



## OpenAPI

````yaml openapi/order-gateway.json GET /orders
openapi: 3.1.0
info:
  title: ax-order-gateway
  description: ''
  license:
    name: ''
  version: 15.24.0
servers:
  - url: https://gateway.architect.exchange/orders
security: []
tags:
  - name: order-gateway
    description: Order gateway
paths:
  /orders:
    get:
      tags:
        - order-gateway
      description: >-
        Returns historical orders for the authenticated user, newest first by
        default, paged via the response cursor. The time range is optional and
        unbounded; an inverted range (`end_timestamp_ns` <=
        `start_timestamp_ns`) is rejected with a 400. Optionally narrow the
        result to specific orders via `order_id` and/or `order_ids`. Pages may
        be returned partial.
      operationId: get_orders
      parameters:
        - name: symbol
          in: query
          required: false
          schema:
            type:
              - string
              - 'null'
        - name: timeseries
          in: query
          required: true
          schema:
            $ref: d271698c-8b5b-469e-9325-bc09750bece7
        - name: order_states
          in: query
          description: >-
            Optional comma-separated order state filter, e.g.
            `FILLED,CANCELED,REPLACED`
          required: false
          schema:
            type:
              - array
              - 'null'
            items:
              $ref: '#/components/schemas/OrderState'
        - name: order_id
          in: query
          description: >-
            Optional single order ID filter, e.g. `ORD-1234567890`. Convenience
            alias

            for a one-element `order_ids`; combined with `order_ids` if both are
            set.
          required: false
          schema:
            type:
              - string
              - 'null'
        - name: order_ids
          in: query
          description: >-
            Optional comma-separated order ID filter, e.g. `ORD-1,ORD-2`.
            Combined

            with `order_id` if both are set.
          required: false
          schema:
            type:
              - array
              - 'null'
            items:
              type: string
        - name: account_id
          in: query
          description: >-
            Optional account ID. If omitted, the user's default (primary)
            account is used.
          required: false
          schema:
            type:
              - string
              - 'null'
      responses:
        '200':
          description: List of orders
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetOrdersResponse'
        '400':
          description: Invalid historical order query
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - session_token: []
components:
  schemas:
    OrderState:
      type: string
      enum:
        - PENDING
        - ACCEPTED
        - PARTIALLY_FILLED
        - FILLED
        - CANCELED
        - REJECTED
        - EXPIRED
        - REPLACED
        - DONE_FOR_DAY
        - UNKNOWN
    GetOrdersResponse:
      allOf:
        - $ref: '#/components/schemas/CursorPage'
        - type: object
          required:
            - orders
          properties:
            orders:
              type: array
              items:
                $ref: '#/components/schemas/OrderDetails'
    ErrorResponse:
      type: object
      description: Standard error response format
      required:
        - error
      properties:
        error:
          type: string
    CursorPage:
      type: object
      description: |-
        Page metadata for cursor-paged responses.

        This is intended for response bodies (not query params).
      properties:
        limit:
          type:
            - integer
            - 'null'
          format: int32
          minimum: 0
        next_cursor:
          type:
            - string
            - 'null'
        total_count:
          type:
            - integer
            - 'null'
          format: int64
          minimum: 0
    OrderDetails:
      allOf:
        - $ref: '#/components/schemas/Timestamp'
        - type: object
          required:
            - oid
            - u
            - aid
            - s
            - p
            - q
            - xq
            - rq
            - o
            - d
            - tif
          properties:
            aid:
              type: string
              description: >-
                Owning account — whose positions, balance, and risk this order
                moves.
            cid:
              oneOf:
                - type: 'null'
                - $ref: '#/components/schemas/ClientOrderId'
            d:
              $ref: '#/components/schemas/Side'
            o:
              $ref: '#/components/schemas/OrderState'
            oid:
              $ref: '#/components/schemas/OrderId'
            p:
              type: string
            po:
              type: boolean
            q:
              type: integer
              format: int64
              minimum: 0
            r:
              oneOf:
                - type: 'null'
                - $ref: '#/components/schemas/OrderRejectReason'
            rq:
              type: integer
              format: int64
              minimum: 0
            s:
              type: string
            tag:
              type:
                - string
                - 'null'
            tif:
              type: string
            txt:
              type:
                - string
                - 'null'
            u:
              type: string
              description: >-
                Actor of record — the authenticated user who *placed* this
                order. This

                is distinct from the owning `account_id`: a user may place
                orders on an

                account they do not own (e.g. a proxy or algo acting for another
                party).
            xq:
              type: integer
              format: int64
              minimum: 0
    Timestamp:
      type: object
      required:
        - ts
        - tn
      properties:
        tn:
          type: integer
          format: int32
          minimum: 0
        ts:
          type: integer
          format: int32
    ClientOrderId:
      type: integer
      format: int64
      minimum: 0
    Side:
      type: string
      enum:
        - B
        - S
    OrderId:
      type: string
      description: |-
        Strong type for Order IDs to prevent mixing with other string values

        Order IDs are ULIDs with a prefix:

        - Regular orders: O-<ULID>
        - Liquidation orders: L-<ULID>
    OrderRejectReason:
      type: string
      enum:
        - CLOSE_ONLY
        - INSUFFICIENT_MARGIN
        - MAX_OPEN_ORDERS_EXCEEDED
        - UNKNOWN_SYMBOL
        - EXCHANGE_CLOSED
        - INCORRECT_QUANTITY
        - INVALID_PRICE_INCREMENT
        - INCORRECT_ORDER_TYPE
        - PRICE_OUT_OF_BOUNDS
        - NO_LIQUIDITY
        - INSUFFICIENT_CREDIT_LIMIT
        - ORIGINAL_ORDER_TERMINATED
        - DUPLICATE_CLIENT_ORDER_ID
        - UNKNOWN
  securitySchemes:
    session_token:
      type: http
      scheme: bearer
      description: User session token

````