# OANDA API POST /v3/accounts/{accountID}/orders

Independent and unofficial. Not affiliated with or endorsed by any broker or platform named here. Educational only: nothing here is advice, and nothing here recommends a broker or a trade.

This is the markdown version of https://openbrokerapi.com/brokers/oanda/endpoints/post-orders, written from the same records as that page.

Risk warning: CFDs and spread bets are complex instruments and come with a high risk of losing money rapidly due to leverage. You can lose money on these products, and each provider publishes its own loss figure under FCA rules. You should consider whether you understand how they work and whether you can afford to take the high risk of losing your money. Automated and API trading can amplify losses through bugs, connectivity failures and runaway orders.

Create an order. Market, limit, stop, market if touched and dependent orders all go through this one endpoint. Returns 201.

- Request: `POST /v3/accounts/{accountID}/orders`
- Version: v3
- Group: Orders
- Status: verified. Source: [developer.oanda.com](https://developer.oanda.com/rest-live-v20/order-ep/), checked 2026-10-12.
- Official reference: https://developer.oanda.com/rest-live-v20/order-ep/

Note: Confirmed on the official order endpoints page. Method, path and request parameters were re-read on that page on 12 Oct 2026 and agree with this record; the mock reply was not compared field by field. Success is HTTP 201, not 200; 400 means the order was rejected and the body carries orderRejectTransaction. Units are strings. Test on a practice account first.

## Parameters

- `Accept-Datetime-Format` (in header, type string, optional): Optional. RFC3339 (default) or UNIX for epoch seconds in datetime fields.
- `Content-Type` (in header, type string, required): Send application/json on every request with a body.
- `accountID` (in path, type string, required): Account ID from GET /v3/accounts. Mock value shown.
- `order` (in body, type object, required): The order request. For a market order: type MARKET, instrument, units (positive to buy, negative to sell), timeInForce FOK, positionFill DEFAULT.

### Authentication headers

- `Authorization` (type string, required): Send Bearer followed by your personal access token. Placeholder only: never paste a real token into this site.

## Request

Written from the method, path and parameters recorded on this page, against the demo host. Not executed against a live or demo account. Credentials are read from environment variables on your own machine and are never entered on this site. The request builder at https://openbrokerapi.com/tools/request-builder writes these same snippets, from the same record.

This call takes a request body. The samples send it as JSON with a placeholder for each of the 1 body field the record marks as required. Each placeholder has to be replaced with a real value before the request can succeed.

The owner's quickstart ends with one script that logs in, reads positions, sends this request and reads the confirmation, dry run by default: https://openbrokerapi.com/brokers/oanda/quickstart#step-7

### Python

```python
# Set OANDA_TOKEN, OANDA_ACCOUNT_ID as environment variables first. Never paste real values into code.
# Optional and not shown: headers Accept-Datetime-Format.
import os
import requests

BASE_URL = "https://api-fxpractice.oanda.com"  # the demo host
headers = {
    "Authorization": "Bearer " + os.environ["OANDA_TOKEN"],
    "Content-Type": "application/json",
}
body = {"order": {}}
resp = requests.post(BASE_URL + "/v3/accounts/" + os.environ["OANDA_ACCOUNT_ID"] + "/orders", headers=headers, json=body, timeout=10)
resp.raise_for_status()
print(resp.json())
```

### JavaScript

```javascript
// Set OANDA_TOKEN, OANDA_ACCOUNT_ID as environment variables first. Never paste real values into code.
// Optional and not shown: headers Accept-Datetime-Format.
// Run as a module, for example a .mjs file, on a Node version that has fetch built in.
const BASE_URL = "https://api-fxpractice.oanda.com"; // the demo host
const res = await fetch(BASE_URL + "/v3/accounts/" + process.env.OANDA_ACCOUNT_ID + "/orders", {
  method: "POST",
  headers: {
    "Authorization": "Bearer " + process.env.OANDA_TOKEN,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({"order": {}}),
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
console.log(await res.json());
```

### curl

```bash
# Set OANDA_TOKEN, OANDA_ACCOUNT_ID as environment variables first. Never paste real values into code.
# Optional and not shown: headers Accept-Datetime-Format.
curl -X POST "https://api-fxpractice.oanda.com/v3/accounts/$OANDA_ACCOUNT_ID/orders" \
  -H "Authorization: Bearer $OANDA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"order": {}}'
```

## Response

A mock response. The values are invented, so check field names against the [official reference](https://developer.oanda.com/rest-live-v20/order-ep/).

```json
{
  "_mock": true,
  "orderCreateTransaction": {
    "id": "9002",
    "type": "MARKET_ORDER",
    "instrument": "EUR_USD",
    "units": "1000",
    "timeInForce": "FOK",
    "positionFill": "DEFAULT",
    "reason": "CLIENT_ORDER",
    "accountID": "101-004-MOCK-001",
    "time": "2026-09-18T08:00:02.000000000Z"
  },
  "orderFillTransaction": {
    "id": "9003",
    "type": "ORDER_FILL",
    "orderID": "9002",
    "instrument": "EUR_USD",
    "units": "1000",
    "price": "1.10020",
    "tradeOpened": {
      "tradeID": "9003",
      "units": "1000"
    },
    "accountID": "101-004-MOCK-001",
    "time": "2026-09-18T08:00:02.000000000Z"
  },
  "relatedTransactionIDs": [
    "9002",
    "9003"
  ],
  "lastTransactionID": "9003"
}
```

## Response schema, HTTP 201

Every field this site's OpenAPI file for OANDA (https://openbrokerapi.com/specs/oanda.json) declares for this response.

- `orderCreateTransaction` (object): Not recorded
  - `id` (string): Not recorded
  - `type` (string): Not recorded
  - `instrument` (string): Not recorded
  - `units` (string): Not recorded
  - `timeInForce` (string): Not recorded
  - `positionFill` (string): Not recorded
  - `reason` (string): Not recorded
  - `accountID` (string): Not recorded
  - `time` (string): Not recorded
- `orderFillTransaction` (object): Not recorded
  - `id` (string): Not recorded
  - `type` (string): Not recorded
  - `orderID` (string): Not recorded
  - `instrument` (string): Not recorded
  - `units` (string): Not recorded
  - `price` (string): Not recorded
  - `tradeOpened` (object): Not recorded
    - `tradeID` (string): Not recorded
    - `units` (string): Not recorded
  - `accountID` (string): Not recorded
  - `time` (string): Not recorded
- `relatedTransactionIDs` (array of string): Not recorded
- `lastTransactionID` (string): Not recorded

Status: unverified. No source opened. This schema is not sourced to a page of the provider's own that we opened, so check field names against the official reference.

## Limits that apply at OANDA

- Headline limit: 120/s per IP address, HTTP 429 above it
  - Scope: ip
  - Status: verified. Source: [developer.oanda.com](https://developer.oanda.com/rest-live-v20/development-guide/), checked 2026-10-03.
  - Note: Best practices. Also 2 new connections a second. The development guide separately states 120 requests a second per IP address, read 24 Sep 2026; the two figures are in different units and neither replaces the other.

## More on the OANDA API

- [All OANDA API endpoints](https://openbrokerapi.com/brokers/oanda/endpoints): 33 documented, grouped by what they do.
- [OANDA API quickstart](https://openbrokerapi.com/brokers/oanda/quickstart)
- [All OANDA API error codes](https://openbrokerapi.com/errors/oanda)
- [OANDA API page](https://openbrokerapi.com/brokers/oanda): The full record: access, authentication, limits and the source for each.
- [OANDA API as an OpenAPI file](https://openbrokerapi.com/specs/oanda.json): Generated from these endpoint records. Independent and unofficial.

## Licence and how to cite

The records behind this page are all rights reserved. This file is the page itself, at its own address, in another format. It is not part of the CC BY 4.0 downloads listed at https://openbrokerapi.com/data. Quote from it with a link to the page.

Cite as: OANDA API POST /v3/accounts/{accountID}/orders. Broker API Hub, https://openbrokerapi.com/brokers/oanda/endpoints/post-orders, newest check 2026-10-12.

Where you rely on a single figure, cite the source and the checked date printed beside it as well. Where this page and a broker's own documentation differ, the documentation wins.
