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

# Get Recent Orders

> Retrieve your recent filled and cancelled orders.



## OpenAPI

````yaml GET /v1/account/orders
openapi: 3.1.0
info:
  title: Options API
  version: 1.0.0
  description: >-
    REST endpoints for Rails Options. Base URLs vary by environment — see the
    Environments page. Authorize with the access token obtained from the Auth
    API.
servers:
  - url: https://api-options.sandbox.rails.xyz
security:
  - bearerAuth: []
paths:
  /v1/account/orders:
    get:
      summary: Get Recent Orders
      description: >-
        Returns one page of your recent options orders, most recent first. Only
        orders that are no longer working are returned — for orders still
        resting on the book, use the Open Orders stream.


        The required `status` parameter selects which history to read:


        - `status=completed` returns orders that were filled, in whole or in
        part. Each order carries a `fillType` of `complete` or `partial`.

        - `status=cancelled` returns orders that were cancelled. These carry no
        `fillType`; check `filledQuantity` to see whether any of the order
        filled before it was cancelled.
      operationId: getOptionsRecentOrders
      parameters:
        - name: status
          in: query
          required: true
          description: >-
            Which history to read: `completed` for orders that were filled in
            whole or in part, or `cancelled` for orders that were cancelled.
            Omitting it, or sending any other value, returns `400`.
          schema:
            type: string
            enum:
              - completed
              - cancelled
        - $ref: '#/components/parameters/pageSize'
        - $ref: '#/components/parameters/pageToken'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  orders:
                    type: array
                    items:
                      type: object
                      properties:
                        orderId:
                          type: string
                          description: Order identifier.
                        contract:
                          type: string
                          description: Contract name.
                        side:
                          type: string
                          description: '`buy` or `sell`.'
                        type:
                          type: string
                          description: 'Order type: `limit` or `market`.'
                        fillType:
                          type: string
                          enum:
                            - complete
                            - partial
                          description: >-
                            How much of the order filled: `complete` when
                            `filledQuantity` reached `quantity`, `partial` when
                            it stopped short. Absent under `status=cancelled` —
                            those orders are cancelled by definition, and
                            `filledQuantity` shows whether any of the order
                            filled first.
                        price:
                          type: string
                          description: >-
                            The price the user submitted: the limit price for
                            limit orders, or the requested price for market
                            orders. Under `status=cancelled`, the order's limit
                            price.
                        quantity:
                          type: string
                          description: Order quantity.
                        filledQuantity:
                          type: string
                          description: Quantity filled.
                        avgFillPrice:
                          type: string
                          description: >-
                            Volume-weighted average fill price; `0` while
                            nothing has filled.
                        leverage:
                          type: string
                          description: Leverage — always `0` for options.
                        createdAt:
                          type: integer
                          description: Creation time (ms since epoch).
                        updatedAt:
                          type: integer
                          description: Last update time (ms since epoch).
                  nextPageToken:
                    type: string
                    description: >-
                      Cursor for the next page. Present only when a further page
                      exists.
              example:
                orders:
                  - orderId: 01J9G4K19776J1CTA8YXA8AA5H
                    contract: BTC-3JUL26-62000-C
                    side: buy
                    type: limit
                    fillType: complete
                    price: '120'
                    quantity: '2'
                    filledQuantity: '2'
                    avgFillPrice: '110'
                    leverage: '0'
                    createdAt: 1751284800000
                    updatedAt: 1751284803120
                  - orderId: 01J9G51ABC7QK2DTB9ZYC9BB6J
                    contract: BTC-3JUL26-60000-P
                    side: sell
                    type: market
                    fillType: partial
                    price: '15.40'
                    quantity: '3'
                    filledQuantity: '1'
                    avgFillPrice: '15.75'
                    leverage: '0'
                    createdAt: 1751288400000
                    updatedAt: 1751288460500
                nextPageToken: eyJwSyI6eyJTIjoiQlRDLTNKVUwyNi02MjAwMC1DIn19
        '400':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                missingStatus:
                  summary: status omitted or not recognised
                  value:
                    error:
                      slug: BAD_REQUEST
                      code: '0006'
                    message: 'status: required, must be one of: completed, cancelled'
                badPageToken:
                  summary: pageToken is not a valid cursor
                  value:
                    error:
                      slug: BAD_REQUEST
                      code: '0006'
                    message: 'pageToken: store: invalid page token'
components:
  parameters:
    pageSize:
      name: pageSize
      in: query
      required: false
      description: Items per page.
      schema:
        type: integer
        default: 50
        maximum: 200
    pageToken:
      name: pageToken
      in: query
      required: false
      description: >-
        Opaque cursor taken from the previous response's `nextPageToken`. Omit
        for the first page. A token is scoped to the endpoint that issued it.
      schema:
        type: string
  schemas:
    Error:
      type: object
      properties:
        error:
          type: object
          description: An object containing error details.
          properties:
            slug:
              type: string
              description: A short string identifier for the error type.
            code:
              type: string
              description: A string code representing the error.
          required:
            - slug
            - code
        message:
          type: string
          description: A human-readable message describing the error.
      required:
        - error
        - message
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````