> For the complete documentation index, see [llms.txt](https://docs.openmm.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.openmm.io/api-reference/orders/orders-create.md).

# POST /orders

Create a new order.

## Request

```
POST /api/v1/orders
Content-Type: application/json
```

### Body

```json
{
  "exchange": "mexc",
  "symbol": "BTC/USDT",
  "side": "buy",
  "type": "limit",
  "amount": 0.1,
  "price": 40000
}
```

### Parameters

| Parameter | Type   | Required | Description                 |
| --------- | ------ | -------- | --------------------------- |
| exchange  | string | ✅        | Exchange ID                 |
| symbol    | string | ✅        | Trading pair                |
| side      | string | ✅        | `buy` or `sell`             |
| type      | string | ✅        | `limit` or `market`         |
| amount    | number | ✅        | Order size in base currency |
| price     | number | ⚠️       | Required for limit orders   |

## Response

```json
{
  "success": true,
  "exchange": "mexc",
  "order": {
    "id": "123456",
    "symbol": "BTC/USDT",
    "side": "buy",
    "type": "limit",
    "price": 40000,
    "amount": 0.1,
    "filled": 0,
    "remaining": 0.1,
    "status": "open",
    "timestamp": 1710000000000
  }
}
```

## Examples

### Limit Order

```bash
curl -X POST "http://localhost:3000/api/v1/orders" \
  -H "Content-Type: application/json" \
  -d '{
    "exchange": "mexc",
    "symbol": "BTC/USDT",
    "side": "buy",
    "type": "limit",
    "amount": 0.1,
    "price": 40000
  }'
```

### Market Order

```bash
curl -X POST "http://localhost:3000/api/v1/orders" \
  -H "Content-Type: application/json" \
  -d '{
    "exchange": "mexc",
    "symbol": "BTC/USDT",
    "side": "sell",
    "type": "market",
    "amount": 0.1
  }'
```

## Errors

| Code | Error          | Description                  |
| ---- | -------------- | ---------------------------- |
| 400  | Invalid side   | Side must be buy or sell     |
| 400  | Invalid type   | Type must be limit or market |
| 400  | Price required | Limit orders need price      |
| 500  | Order failed   | Exchange rejected order      |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.openmm.io/api-reference/orders/orders-create.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
