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

# Replace order



## OpenAPI

````yaml openapi/order-gateway.json POST /replace-order
openapi: 3.1.0
info:
  title: ax-order-gateway
  description: ''
  license:
    name: ''
  version: 15.22.0
servers:
  - url: https://gateway.architect.exchange/orders
security: []
tags:
  - name: order-gateway
    description: Order gateway
paths:
  /replace-order:
    post:
      tags:
        - order-gateway
      operationId: replace_order
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ReplaceOrderRequest'
        required: true
      responses:
        '200':
          description: Order replaced successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReplaceOrderResponse'
        '400':
          description: Bad request
      security:
        - session_token: []
components:
  schemas:
    ReplaceOrderRequest:
      allOf:
        - $ref: '#/components/schemas/OrderReference'
          description: >-
            Identifier of the order to replace; either `oid` (server order id)
            or

            `cid` (client order id).
        - type: object
          properties:
            aid:
              type:
                - string
                - 'null'
              description: >-
                Optional account ID, selecting which account's `cid` namespace
                the

                reference resolves against. Only meaningful when the order is
                given by

                `cid` — a `cid` is unique per account, not globally — and
                superfluous

                when `oid` is supplied (server order ids are globally unique).
                If

                omitted, the account is inferred from the connection: the user's
                default

                account, or the session account for an account-scoped session.
            p:
              type:
                - string
                - 'null'
              description: >-
                New price for the replacement order (optional, inherits from
                original if not provided)
            po:
              type:
                - boolean
                - 'null'
              description: >-
                Whether the replacement order is post-only (optional, inherits
                from original if not provided)
            q:
              type:
                - integer
                - 'null'
              format: int64
              description: >-
                New quantity for the replacement order (optional, inherits from
                original if not provided)
              minimum: 0
            tif:
              type:
                - string
                - 'null'
              description: >-
                New time in force for the replacement order (optional, inherits
                from original if not provided)
    ReplaceOrderResponse:
      type: object
      required:
        - oid
      properties:
        oid:
          $ref: '#/components/schemas/OrderId'
          description: Order ID of the new replacement order; e.g. "ORD-1234567890"
    OrderReference:
      oneOf:
        - type: object
          required:
            - oid
          properties:
            oid:
              $ref: '#/components/schemas/OrderId'
        - type: object
          required:
            - cid
          properties:
            cid:
              $ref: '#/components/schemas/ClientOrderId'
    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>
    ClientOrderId:
      type: integer
      format: int64
      minimum: 0
  securitySchemes:
    session_token:
      type: http
      scheme: bearer
      description: User session token

````