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

# Crear orden pendiente

> Envía una orden limit, stop o stop-limit.

Requiere cuenta verificada, trading habilitado, permiso del endpoint e `Idempotency-Key`.
Consulta [tipos, precios y ejemplos](https://api-trading-docs.ap-markets.com/es/trading/pending.md) y [recuperación](https://api-trading-docs.ap-markets.com/es/trading/idempotency.md).

## SL y TP opcionales

`sl` y `tp` son precios absolutos. Puedes enviar uno o ambos al abrir; omitidos
o `null` no se envían, y `0` indica ausencia del nivel. Se validan precisión y
distancias; no se redondean precios inválidos.
En pendientes, la referencia es `price`; para stop-limit, `stop_limit_price`.

[Modificar órdenes o posiciones](https://api-trading-docs.ap-markets.com/es/trading/modifications.md) · [Volumen en unidades MT5](https://api-trading-docs.ap-markets.com/es/trading/volume.md)


## OpenAPI

````yaml es/openapi.json POST /api/v1/orders/pending
openapi: 3.1.0
info:
  title: AP Markets API — Partner Portal
  description: >-
    Endpoints seguros para verificar la propiedad de cuentas, consultar el
    mercado y operar en cuentas previamente verificadas.
  version: 0.1.0
servers:
  - url: https://api-trading.ap-markets.com
    description: AP Markets API
security: []
paths:
  /api/v1/orders/pending:
    post:
      tags:
        - Trading
      summary: Crear una orden pendiente
      description: >-
        Place a limit, stop or stop-limit order. SL/TP are optional absolute
        prices. Returns a request ID; check its result to confirm placement.
      operationId: pending_order_api_v1_orders_pending_post
      parameters:
        - name: Idempotency-Key
          in: header
          required: true
          schema:
            type: string
            minLength: 16
            maxLength: 128
            pattern: ^[A-Za-z0-9._:-]{16,128}$
            example: 550e8400-e29b-41d4-a716-446655440000
          description: >-
            Persisted key for this intent. Reuse the same key and body when
            retrying; use a new key for another trading intent, including a
            modification.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PendingOrderRequest'
            example:
              login: 104205
              symbol: EURUSD
              volume: 100
              order_type: buy_limit
              price: 1.09
              comment: REST API
              sl: null
              tp: null
      responses:
        '200':
          description: Respuesta satisfactoria
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: 'Respuesta: Crear una orden pendiente'
        '400':
          description: Idempotency-Key ausente o inválida.
        '409':
          description: Clave reutilizada con otros datos o solicitud pendiente.
        '422':
          description: Invalid request or incompatible trading parameters.
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    type: string
              example:
                detail: Invalid request
      security:
        - HTTPBearer: []
components:
  schemas:
    PendingOrderRequest:
      properties:
        sl:
          anyOf:
            - type: number
              minimum: 0
            - type: 'null'
          title: Sl
          description: >-
            Optional absolute Stop Loss price. Omit or send null to skip; 0
            specifies no SL.
        tp:
          anyOf:
            - type: number
              minimum: 0
            - type: 'null'
          title: Tp
          description: >-
            Optional absolute Take Profit price. Omit or send null to skip; 0
            specifies no TP.
        login:
          type: integer
          exclusiveMinimum: 0
          title: Login
          examples:
            - 104205
          example: 104205
        symbol:
          type: string
          maxLength: 32
          minLength: 1
          pattern: ^[A-Za-z0-9._() -]+$
          title: Símbolo
          examples:
            - EURUSD
          example: EURUSD
        volume:
          type: integer
          exclusiveMinimum: 0
          title: Volumen
          description: >-
            Integer MT5 units: 10000 = 1 lot, independent of contract size. Must
            match the symbol minimum, maximum and step.
          example: 100
        order_type:
          type: string
          enum:
            - buy_limit
            - sell_limit
            - buy_stop
            - sell_stop
            - buy_stop_limit
            - sell_stop_limit
          title: Tipo de orden
        price:
          type: number
          exclusiveMinimum: 0
          title: Precio
          description: Precio de la pendiente; precio de activación para stop-limit.
          example: 1.1
        stop_limit_price:
          anyOf:
            - type: number
              exclusiveMinimum: 0
            - type: 'null'
          title: Precio limit posterior
          description: >-
            Precio de la orden limit posterior a la activación; obligatorio solo
            para stop-limit.
        comment:
          type: string
          maxLength: 31
          title: Comentario
          default: REST API
      additionalProperties: false
      type: object
      required:
        - login
        - symbol
        - volume
        - order_type
        - price
      title: PendingOrderRequest
      examples:
        - comment: REST API
          login: 104205
          order_type: buy_limit
          price: 1.09
          symbol: EURUSD
          volume: 100
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer
      description: >-
        Envía el token entregado por el proveedor en el encabezado Authorization
        mediante autenticación Bearer.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.