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

# Batch Amend Orders

> Amend multiple existing orders in a single request



## OpenAPI

````yaml /api-reference/openapi.json post /api/v1/order/amend-batch
openapi: 3.1.0
info:
  title: ekiden-gateway
  description: >-
    API Gateway and WebSocket proxy based on Axum and Utoipa, handling auth,
    rate limiting, and connection buffering.
  license:
    name: ''
  version: 0.1.1
servers:
  - url: https://api.ekiden.fi/
    description: Production
  - url: https://api.staging.ekiden.fi/
    description: Staging
  - url: https://api.dev.ekiden.fi/
    description: Development
  - url: http://localhost:4020/
    description: Local
security: []
paths:
  /api/v1/order/amend-batch:
    post:
      tags:
        - Trade
      summary: Batch Amend Orders
      description: Amend multiple existing orders in a single request
      operationId: batch_amend_orders
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BatchAmendOrdersRequest'
        required: true
      responses:
        '200':
          description: Orders amended
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BatchAmendOrdersResponse'
      security:
        - bearer_auth: []
components:
  schemas:
    BatchAmendOrdersRequest:
      type: object
      description: |-
        Batch amend order request.
        You can amend unfilled or partially filled orders.
        TODO: Maximum 20 orders per request
      required:
        - request
      properties:
        await_outcome:
          type: boolean
          description: |-
            If true, gateway waits up to a server-defined timeout (currently 3s)
            for final engine outcomes and maps them into `exit_info`.

            If false (default), `exit_info` reports edge outcomes
            (validation + publish ack).
        request:
          type: array
          items:
            $ref: '#/components/schemas/AmendOrderRequest'
    BatchAmendOrdersResponse:
      type: object
      description: Response of batch amend orders.
      required:
        - result
        - exit_info
        - time
      properties:
        exit_info:
          type: array
          items:
            $ref: '#/components/schemas/ExitMessage'
          description: Information about the exit status of each order in the batch.
        result:
          type: array
          items:
            $ref: '#/components/schemas/AmendOrderResponse'
        time:
          type: string
          format: date-time
          example: '1672531200000'
    AmendOrderRequest:
      type: object
      description: Request to amend an order.
      required:
        - sub_account_address
        - symbol
        - qty
        - price
      properties:
        order_id:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/OrderId'
        order_iv:
          type:
            - integer
            - 'null'
          format: int64
          minimum: 0
        order_link_id:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/OrderLinkId'
        price:
          type: string
        qty:
          type: string
        sub_account_address:
          type: string
        symbol:
          $ref: '#/components/schemas/Symbol'
        tpsl:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/TpSl'
        trigger:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/ConditionalOrder'
    ExitMessage:
      oneOf:
        - type: object
          required:
            - Error
          properties:
            Error:
              type: object
              required:
                - code
                - msg
              properties:
                code:
                  type: integer
                  format: int32
                  minimum: 0
                msg:
                  $ref: '#/components/schemas/String'
        - type: object
          required:
            - Success
          properties:
            Success:
              type: object
              required:
                - code
                - msg
              properties:
                code:
                  type: integer
                  format: int32
                  minimum: 0
                msg:
                  type: string
    AmendOrderResponse:
      type: object
      description: Response for amending an order.
      properties:
        order_id:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/OrderId'
        order_link_id:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/OrderLinkId'
    OrderId:
      type: string
      format: uuid
    OrderLinkId:
      type: string
    Symbol:
      type: string
      example: BTCUSDC
    TpSl:
      type: object
      required:
        - mode
      properties:
        mode:
          $ref: '#/components/schemas/TpSlMode'
        stop_loss:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/TpSlSpec'
        take_profit:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/TpSlSpec'
    ConditionalOrder:
      type: object
      required:
        - trigger_price
        - trigger_direction
        - trigger_by
      properties:
        trigger_by:
          $ref: '#/components/schemas/TriggerBy'
          description: Last Price, Mark Price, or Index Price.
        trigger_direction:
          $ref: '#/components/schemas/TriggerDirection'
          description: Up or Down.
        trigger_price:
          type: string
          description: The price level that activates the order.
    String:
      type: string
    TpSlMode:
      type: string
      enum:
        - Full
        - Partial
    TpSlSpec:
      oneOf:
        - type: object
          required:
            - market
          properties:
            market:
              type: object
              required:
                - trigger_price
                - trigger_by
              properties:
                trigger_by:
                  $ref: '#/components/schemas/TriggerBy'
                trigger_price:
                  type: string
        - type: object
          required:
            - limit
          properties:
            limit:
              type: object
              required:
                - trigger_price
                - limit_price
                - trigger_by
              properties:
                limit_price:
                  type: string
                trigger_by:
                  $ref: '#/components/schemas/TriggerBy'
                trigger_price:
                  type: string
    TriggerBy:
      type: string
      enum:
        - LastPrice
        - IndexPrice
        - MarkPrice
    TriggerDirection:
      type: string
      enum:
        - Up
        - Down
  securitySchemes:
    bearer_auth:
      type: http
      scheme: bearer

````