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

# Create multiple orders



## OpenAPI

````yaml https://docs.api.monacoprotocol.xyz/api/v1/exchange-openapi-general.json post /orders/batch
openapi: 3.1.0
info:
  title: BetDEX General Integration API
  description: >-
    A RESTful API that allows you to interact with the BetDEX Exchange. Provides
    endpoints for managing Events, Markets, Sessions, Wallets and Orders. To
    interact with the API, a client must have an App Id and an API Key to
    authenticate and create a session.
  version: '0.1'
servers:
  - url: https://sandbox.api.btdx.io/
    description: Sandbox API Server
  - url: https://prod.api.btdx.io/
    description: Production API Server
security: []
tags:
  - name: API Key Management
  - name: App Management
  - name: Currencies
  - name: Event Categories
  - name: Event Groups
  - name: Event Subcategories
  - name: Events
  - name: External Reference Sources
  - name: Heartbeat Management
  - name: Market Prices
  - name: Market Types
  - name: Markets
  - name: Orders
  - name: Participants
  - name: Session Management
  - name: Status
  - name: Trades
  - name: Wallet API Key Management
  - name: Wallets
paths:
  /orders/batch:
    post:
      tags:
        - Orders
      summary: Create multiple orders
      operationId: createOrders
      parameters:
        - name: authorization
          in: header
          description: Header with the accessToken for the current session
          required: true
          schema:
            type: string
          example: Bearer eyJ0eXAiOiJ...bjV7AtDgA
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BatchCreateOrderRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/BatchOrderResponse'
        '400':
          description: Request invalid
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/BatchOrderResponse'
        '401':
          description: Session invalid
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/BatchOrderResponse'
        '403':
          description: Missing permission
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/BatchOrderResponse'
        '503':
          description: Service temporarily unavailable
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/BatchOrderResponse'
components:
  schemas:
    BatchCreateOrderRequest:
      type: object
      properties:
        requests:
          type: array
          description: list of individual order requests
          items:
            $ref: '#/components/schemas/CreateOrderRequest'
          maxItems: 50
          minItems: 1
      required:
        - requests
    BatchOrderResponse:
      type: object
      properties:
        _meta:
          $ref: '#/components/schemas/Meta'
        orders:
          type: array
          items:
            oneOf:
              - $ref: '#/components/schemas/Order'
              - $ref: '#/components/schemas/OrderFailure'
        markets:
          type: array
          items:
            $ref: '#/components/schemas/MarketSummary'
        events:
          type: array
          items:
            $ref: '#/components/schemas/EventSummary'
        trades:
          type: array
          items:
            $ref: '#/components/schemas/TradeSummary'
        eventGroups:
          type: array
          items:
            $ref: '#/components/schemas/EventGroupSummary'
        subcategories:
          type: array
          items:
            $ref: '#/components/schemas/SubcategorySummary'
        categories:
          type: array
          items:
            $ref: '#/components/schemas/CategorySummary'
    CreateOrderRequest:
      type: object
      properties:
        walletId:
          type: string
        marketId:
          type: string
        side:
          type: string
          enum:
            - For
            - Against
        outcomeId:
          type: string
        price:
          type: number
        stake:
          type: number
        keepWhenInPlay:
          type: boolean
          description: >-
            Optional - whether to keep unmatched portion of the order when its
            market enters InPlay (only relevant if the market has
            eventStartAction: CancelUnmatchedLiquidity) - default is false
        matchBehavior:
          type: string
          description: |
            Optional - How any unmatched portion of an order is treated:
            <ul>
                <li>RetainUnmatched - unmatched portion persists as an offer (default)</li>
                <li>CancelUnmatched - unmatched portion is cancelled</li>
            </ul>
          enum:
            - RetainUnmatched
            - CancelUnmatched
        reference:
          type: string
        commissionRateId:
          type: string
          description: >
            Optional - to use a different commission rate for this order than
            your app's

            default commission rate. If omitted or set to null, the app's
            default

            commission rate will be used (if it has one).
      required:
        - keepWhenInPlay
        - marketId
        - outcomeId
        - price
        - side
        - stake
        - walletId
    Meta:
      type: object
      properties:
        _primary_document:
          type: string
          enum:
            - apiKeys
            - apps
            - categories
            - commissionRates
            - currencies
            - depositAddresses
            - depositRequests
            - events
            - eventGroups
            - externalReferences
            - externalReferenceSources
            - heartbeats
            - ids
            - markets
            - marketOutcomes
            - marketPositions
            - marketTypes
            - orders
            - participants
            - prices
            - priceLadders
            - sessions
            - statuses
            - subcategories
            - trades
            - transactions
            - wallets
            - walletMetrics
            - withdrawalRequests
        _count:
          type: integer
          format: int32
        _page:
          $ref: '#/components/schemas/PageMeta'
    Order:
      allOf:
        - $ref: '#/components/schemas/OrderResult'
        - type: object
          properties:
            id:
              type: string
            appId:
              type: string
            market:
              $ref: '#/components/schemas/DocumentReference'
            walletId:
              type: string
            side:
              type: string
              enum:
                - For
                - Against
            outcomeId:
              type: string
            outcomeTitle:
              type: string
            price:
              type: number
            stake:
              type: number
            stakeUnmatched:
              type: number
            stakeVoided:
              type: number
            keepWhenInPlay:
              type: boolean
              description: >-
                Whether to keep unmatched portion of the order when its market
                enters InPlay (only relevant if the market has eventStartAction:
                CancelUnmatchedLiquidity)
            createdAt:
              type: string
              format: date-time
            modifiedAt:
              type: string
              format: date-time
            commissionRateId:
              type: string
            reference:
              type: string
            status:
              type: string
              description: |
                The status of an order can be one of the following
                <ul>
                    <li> Cancelled - The order was not matched and has been cancelled either on request or automatically</li>
                    <li> Failed - A pending order was persisted but then failed to be fully created</li>
                    <li> Matched - The order has been matched, either fully, or partially where the remaining unmatched stake has been cancelled, either on request or automatically</li>
                    <li> PartiallyMatched - The order has been partially matched, and the remaining unmatched portion might still be matched</li>
                    <li> Pending - An order has been persisted but has not yet been processed</li>
                    <li> Unmatched - The order has not yet been matched, and the remaining unmatched portion might still be matched</li>
                    <li> Won - The market has been settled and this previously Matched order has been deemed to have Won</li>
                    <li> Lost - The market has been settled and this previously Matched order has been deemed to have Lost</li>
                    <li> Voided - The market has been voided so this order has been voided</li>
                </ul>
              enum:
                - Cancelled
                - Failed
                - Matched
                - PartiallyMatched
                - Pending
                - Unmatched
                - Won
                - Lost
                - Voided
            matchBehavior:
              type: string
              description: |
                Optional - How any unmatched portion of an order is treated:
                <ul>
                    <li>RetainUnmatched - unmatched portion persists as an offer (default)</li>
                    <li>CancelUnmatched - unmatched portion is cancelled</li>
                </ul>
              enum:
                - RetainUnmatched
                - CancelUnmatched
            cancellationReason:
              type: string
              description: >-
                Only present for Cancelled or Failed orders - why an order is
                Cancelled or Failed
      required:
        - id
    OrderFailure:
      allOf:
        - $ref: '#/components/schemas/OrderResult'
        - type: object
          properties:
            errorCode:
              type: string
              description: >
                Order operation error code describing type of an error. Possible
                values:

                MARKET_NOT_FOUND,

                INVALID_MARKET_STATUS,

                SUSPENDED_MARKET,

                MARKET_OUTCOME_NOT_FOUND,

                COMMISSION_RATE_NOT_FOUND,

                WALLET_NOT_FOUND,

                WALLET_INSUFFICIENT_CREDIT,

                WALLET_ACCOUNT_NOT_FOUND,

                WALLET_ACCOUNT_INSUFFICIENT_CREDIT,

                MARKET_POSITION_NOT_FOUND,

                ORDER_ALREADY_EXISTS,

                INTERRUPTED
            errorMessage:
              type: string
              description: Order operation error detailed message
        - $ref: '#/components/schemas/OrderIDResult'
      description: Order operation error
      required:
        - errorCode
    MarketSummary:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        inPlayStatus:
          type: string
          enum:
            - NotApplicable
            - PrePlay
            - InPlay
        published:
          type: boolean
        suspended:
          type: boolean
        status:
          type: string
          enum:
            - Initializing
            - Open
            - Locking
            - Locked
            - Settling
            - Settled
            - Voiding
            - Voided
            - Closed
        lockAt:
          type: string
          format: date-time
        settledAt:
          type: string
          format: date-time
        event:
          $ref: '#/components/schemas/DocumentReference'
    EventSummary:
      type: object
      properties:
        id:
          type: string
        eventGroup:
          $ref: '#/components/schemas/DocumentReference'
        name:
          type: string
        code:
          type: string
        expectedStartTime:
          type: string
          format: date-time
        active:
          type: boolean
    TradeSummary:
      type: object
      properties:
        order:
          $ref: '#/components/schemas/DocumentReference'
        id:
          type: string
        price:
          type: number
        stake:
          type: number
        profitLoss:
          type: number
          description: |2
               Profit or Loss for the trade, calculated as follows:<br>
               'For' trades
               <ul>
                   <li> Winning trade; profitLoss = stake * (price-1) </li>
                   <li> Losing trade, profitLoss = (stake * -1)  </li>
                   <li> Voided trade, profitLoss = 0 </li>
               </ul>
               'Against' trades
              <ul>
                   <li> Winning trade, profitLoss = stake </li>
                   <li> Losing trade, profitLoss = stake * (price-1) * (-1) </li>
                   <li> Voided trade, profitLoss = 0 </li>
               </ul>
        createdAt:
          type: string
          format: date-time
    EventGroupSummary:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        subcategory:
          $ref: '#/components/schemas/DocumentReference'
    SubcategorySummary:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        category:
          $ref: '#/components/schemas/DocumentReference'
    CategorySummary:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
    PageMeta:
      type: object
      properties:
        _pageNumber:
          type: integer
          format: int32
        _pageSize:
          type: integer
          format: int32
        _totalElements:
          type: integer
          format: int64
        _totalPages:
          type: integer
          format: int32
    OrderResult:
      type: object
    DocumentReference:
      type: object
      properties:
        _ref:
          type: string
        _ids:
          type: array
          items:
            type: string
    OrderIDResult:
      type: object

````