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

# Place order

> Send a new order to the broker. Supports market, limit, stop, and stop-limit orders.

**Side + Type mapping:**
- `buy` + `market` = Buy
- `sell` + `market` = Sell
- `buy` + `limit` = BuyLimit
- `sell` + `limit` = SellLimit
- `buy` + `stop` = BuyStop
- `sell` + `stop` = SellStop
- `buy` + `stop_limit` = BuyStopLimit
- `sell` + `stop_limit` = SellStopLimit

**Symbol naming:** symbols are case-sensitive and broker-specific
(e.g. `XAUUSD.r` on Raw FP Trading, `XAUUSD` elsewhere). Use
`GET /accounts/{id}/symbol-names` to discover the exact strings
your broker exposes — mismatches return `422 ORDER_FAILED` with
message `"Symbol not found"`.




## OpenAPI

````yaml /openapi-spec/easierprop.yaml post /api/accounts/{id}/orders
openapi: 3.0.3
info:
  title: Easier Prop REST API
  version: 2.1.0
  description: >
    MT5 Trading Infrastructure API. Manage multiple broker accounts, execute
    trades, stream market data, and administer API keys, usage snapshots, and
    billing terms.


    **Client API** endpoints live under `/api` and require an `X-API-Key`
    header.

    **Admin API** endpoints live under `/admin` and accept either a JWT
    `Authorization: Bearer <jwt>` (obtained via `/admin/login`) or the same
    `X-API-Key` header used by client endpoints.


    Admin user provisioning is read-only via REST: `GET /admin/admins` lists
    admins, but creation, update, and deletion are performed out-of-band (DB /
    ops tooling). Bootstrap a brand-new deployment with `POST /admin/seed` while
    no superadmin exists.
servers:
  - url: https://api.easierprop.com
    description: Production
security: []
tags:
  - name: Admin
    description: Authentication, API key management, and admin user CRUD
  - name: Accounts
    description: Register and manage MT5 broker accounts
  - name: Sessions
    description: Control broker connections
  - name: Trading
    description: Place, modify, and close orders
  - name: Account Info
    description: Balance, equity, margin, and statistics
  - name: Market Data
    description: Symbols, quotes, OHLC history, and trade sessions
  - name: Expert Advisors
    description: Upload, run, stop, and monitor MQL5 Expert Advisors on your accounts
  - name: Enhanced
    description: >-
      Portfolio, risk, performance, copy-trade, hedge, breakeven, close-all, lot
      calculator, and position details
  - name: Extended
    description: >-
      Change password, server timezone, symbol sessions, closed positions,
      mails, tick value, equity stats, and more
paths:
  /api/accounts/{id}/orders:
    parameters:
      - $ref: '#/components/parameters/accountId'
    post:
      tags:
        - Trading
      summary: Place order
      description: >
        Send a new order to the broker. Supports market, limit, stop, and
        stop-limit orders.


        **Side + Type mapping:**

        - `buy` + `market` = Buy

        - `sell` + `market` = Sell

        - `buy` + `limit` = BuyLimit

        - `sell` + `limit` = SellLimit

        - `buy` + `stop` = BuyStop

        - `sell` + `stop` = SellStop

        - `buy` + `stop_limit` = BuyStopLimit

        - `sell` + `stop_limit` = SellStopLimit


        **Symbol naming:** symbols are case-sensitive and broker-specific

        (e.g. `XAUUSD.r` on Raw FP Trading, `XAUUSD` elsewhere). Use

        `GET /accounts/{id}/symbol-names` to discover the exact strings

        your broker exposes — mismatches return `422 ORDER_FAILED` with

        message `"Symbol not found"`.
      operationId: createOrder
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrderRequest'
      responses:
        '200':
          description: Order result
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                    example: true
                  data:
                    $ref: '#/components/schemas/Order'
        '422':
          description: |
            Order rejected. Returned for broker rejections (insufficient
            margin, invalid stops, market closed) and for invalid inputs
            that mt5rest reports in-band rather than via HTTP status
            (e.g. unknown symbol — see "Symbol naming" above).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - ApiKeyHeader: []
components:
  parameters:
    accountId:
      name: id
      in: path
      required: true
      schema:
        type: string
        format: uuid
      description: Account ID
  schemas:
    OrderRequest:
      type: object
      required:
        - symbol
        - side
        - type
        - volume
      properties:
        symbol:
          type: string
          description: Trading instrument
          example: EURUSD
        side:
          type: string
          enum:
            - buy
            - sell
          example: buy
        type:
          type: string
          enum:
            - market
            - limit
            - stop
            - stop_limit
          example: market
        volume:
          type: number
          description: Lot size
          example: 0.01
        price:
          type: number
          description: Required for limit/stop orders
        sl:
          type: number
          description: Stop loss price
        tp:
          type: number
          description: Take profit price
        deviation:
          type: integer
          description: Max slippage in points
        comment:
          type: string
          description: Order comment visible in MT5
    Order:
      type: object
      description: Full order/position object as returned by the broker
      properties:
        ticket:
          type: integer
          format: int64
          example: 12345678
        symbol:
          type: string
          example: EURUSD
        orderType:
          type: string
          example: Buy
        lots:
          type: number
          example: 0.01
        openPrice:
          type: number
          example: 1.08542
        stopLoss:
          type: number
          example: 0
        takeProfit:
          type: number
          example: 0
        profit:
          type: number
          example: 3.2
        swap:
          type: number
          example: 0
        commission:
          type: number
          example: -0.07
        comment:
          type: string
          example: ''
        openTime:
          type: string
          example: '2026-04-01T12:00:00'
        closePrice:
          type: number
          example: 0
        closeTime:
          type: string
          example: ''
        dealType:
          type: string
          example: Buy
        digits:
          type: integer
          example: 5
        contractSize:
          type: number
          example: 100000
        volume:
          type: number
          example: 0.01
        state:
          type: string
          example: Filled
        fillPolicy:
          type: string
          example: FillOrKill
        expirationType:
          type: string
          example: GTC
        expertId:
          type: integer
          format: int64
          example: 0
        dealInternalIn:
          type: integer
          format: int64
          example: 0
        dealInternalOut:
          type: integer
          format: int64
          example: 0
        orderInternal:
          type: integer
          format: int64
          example: 0
        partialCloseDeals:
          type: array
          items:
            type: object
        partialFillDeals:
          type: array
          items:
            type: object
        placedType:
          type: string
          example: ByClient
        profitRate:
          type: number
          example: 1
        requestId:
          type: integer
          format: int64
          example: 0
        stopLimitPrice:
          type: number
          example: 0
        fee:
          type: number
          example: 0
        closeComment:
          type: string
          example: ''
        closeLots:
          type: number
          example: 0
        closeVolume:
          type: number
          example: 0
        openTimestampUTC:
          type: integer
          format: int64
          example: 1711972800
        closeTimestampUTC:
          type: integer
          format: int64
          example: 0
        expirationTime:
          type: string
          example: ''
    Error:
      type: object
      properties:
        ok:
          type: boolean
          example: false
        error:
          type: object
          properties:
            code:
              type: string
              example: ACCOUNT_NOT_FOUND
            message:
              type: string
              example: Account not found
  securitySchemes:
    ApiKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
      description: |
        Client API key (prefixed with `sk_`). On `/api/*` endpoints the key
        is scoped to its own MT5 accounts. On `/admin/*` endpoints the key
        identifies its **owning admin** and grants access to all of that
        admin's keys — so any of your `sk_` works to manage any of your
        other keys (cross-admin operations are rejected as `400 Key not
        found`).

````