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

# Pending orders

> Place limit, stop, and stop-limit orders with explicit prices.

`POST /api/v1/orders/pending` places a pending order. It requires the
`POST:/api/v1/orders/pending` scope, a verified account, trading enabled, and
`Idempotency-Key`. A token restricted to `/orders/market` does not grant this scope.

## Supported types

| `order_type` | MT5 type | Required price |
| - | - | - |
| `buy_limit` | 2 | `price`: limit buy price |
| `sell_limit` | 3 | `price`: limit sell price |
| `buy_stop` | 4 | `price`: buy activation price |
| `sell_stop` | 5 | `price`: sell activation price |
| `buy_stop_limit` | 6 | `price`: activation; `stop_limit_price`: subsequent buy limit |
| `sell_stop_limit` | 7 | `price`: activation; `stop_limit_price`: subsequent sell limit |

For immediate buys/sells (types 0 and 1), use [market orders](https://api-trading-docs.ap-markets.com/trading/orders.md).

## Request

```json theme={null}
{"login":104205,"symbol":"EURUSD","volume":100,"order_type":"buy_limit","price":1.09,"comment":"REST API"}
```

Prices are illustrative, not current quotes. `volume` is an integer in MT5 units:
`100` equals 0.01 lots. There is no conversion from lots.
`login`, `symbol`, `volume`, `order_type`, and `price` are required.
`comment` is optional, accepts up to 31 characters, and defaults to `REST API`.
`digits` is resolved automatically; do not send it.

For stop-limit orders, also provide the required `stop_limit_price`:

```json theme={null}
{"login":104205,"symbol":"EURUSD","volume":100,"order_type":"buy_stop_limit","price":1.12,"stop_limit_price":1.115}
```

Reaching the activation price creates a limit order; it does not imply immediate
execution. For buy stop-limit, the limit price must be at or below the activation
price; for sell stop-limit, at or above. The other four types reject
`stop_limit_price`. The backend maps `price` to `PriceOrder` and
`stop_limit_price` to `PriceTrigger`.

## Validation and lifetime

The backend queries effective symbol settings for the account and validates volume
minimum, maximum, and step; allowed order type and direction; and price decimals
and tick size. It does not round or change the requested volume.
Prices must be positive and finite. Additional fields produce `422`.

This version uses **GTC** (`TypeTime=0`) and **RETURN** (`TypeFill=2`) and requires
GTC support for the symbol. Custom expiration dates are not exposed. Optional `sl` and `tp` are supported.
Broker rules may cancel orders; GTC does not guarantee indefinite persistence.
MT5 checks margin, sessions, distances, and price placement when processing the order.

## Submission and tracking

Save the body as `pending.json` and use a separate key for each intent.

```bash theme={null}
curl --fail-with-body -X POST "$API_BASE/api/v1/orders/pending" \
  -H "Authorization: Bearer $MT5_API_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $PENDING_KEY" \
  --data-binary @pending.json
```

Store `answer.id` or `answer.ID` and query [the result](https://api-trading-docs.ap-markets.com/trading/results.md).
The initial response confirms receipt, not placement or execution.
Then query `GET /api/v1/accounts/{login}/orders` for active orders.
Use [cancel pending order](https://api-trading-docs.ap-markets.com/api-reference/cancel-order.md) to request cancellation.
Modify pending orders with `POST /api/v1/orders/{order}/modify`; see [the modification workflow](https://api-trading-docs.ap-markets.com/trading/modifications.md). Revoking verification does not cancel existing orders.

[Idempotency](https://api-trading-docs.ap-markets.com/trading/idempotency.md) also applies here. Do not change keys to repeat
a request with an uncertain outcome. A reservation may remain pending after lookup
or validation failures before submission.

## Optional SL and TP

`sl` and `tp` are absolute prices. Send either or both when opening; omitted or
null values are not sent, and `0` specifies no level. Precision and distances
are validated; invalid prices are not rounded.
Pending protection uses `price` as reference, or `stop_limit_price` for stop-limit.

[Modify orders or positions](https://api-trading-docs.ap-markets.com/trading/modifications.md) · [MT5 volume units](https://api-trading-docs.ap-markets.com/trading/volume.md)


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