# IG API POST /working-orders/otc

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/ig/endpoints/post-workingorders-otc, 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 a working order (LIMIT or STOP) that triggers at a level.

- Request: `POST /working-orders/otc`
- Version: 2
- Group: Dealing
- Status: conflicting. Source: [labs.ig.com](https://labs.ig.com/reference/working-orders-otc.html), checked 2026-10-12.
- Official reference: https://labs.ig.com/reference/working-orders-otc.html

Note: The method, path, version and parameters were re-read on IG's own reference page on 12 Oct 2026. That page lists no request headers: the headers recorded here are the general ones in IG's REST trading API guide (labs.ig.com/rest-trading-api-guide.html), read the same day. The mock reply is carried over from an earlier reading and was not compared field by field with the page. IG's reference page prints this path with a hyphen. IG's own Java sample (RestAPI.java on GitHub, read the same day and marked deprecated) calls workingorders/otc without one, and that was the value recorded here until 12 Oct 2026. The two disagree and neither was tested against a host here, so the record is marked conflicting. Required is recorded for the fields the page marks as not null. The page does not mark direction, type or timeInForce as not null: that describes the page, not a test of what the host accepts. The page also lists optional dealReference, forceOpen, limitLevel and stopLevel body fields, which are not recorded here.

## Parameters

- `VERSION` (in header, type string, required): Endpoint version. Send 2.
- `epic` (in body, type string, required): Instrument epic.
- `direction` (in body, type string, not marked by the vendor): BUY or SELL.
- `size` (in body, type number, required): Order size.
- `level` (in body, type number, required): Trigger level.
- `type` (in body, type string, not marked by the vendor): LIMIT or STOP.
- `expiry` (in body, type string, required): DFB, a dash, or a contract month.
- `currencyCode` (in body, type string, required): Currency code.
- `timeInForce` (in body, type string, not marked by the vendor): GOOD_TILL_CANCELLED or GOOD_TILL_DATE.
- `guaranteedStop` (in body, type boolean, required): Guaranteed stop flag.
- `goodTillDate` (in body, type string, optional): Expiry time when timeInForce is GOOD_TILL_DATE.
- `stopDistance` (in body, type number, optional): Stop distance.
- `limitDistance` (in body, type number, optional): Limit distance.

3 fields are tagged not marked by the vendor: direction, type, timeInForce. The vendor's page lists them and marks them neither required nor optional. That describes the page, not a test of what the host accepts, so the samples send them with a placeholder.

### Authentication headers

- `X-IG-API-KEY` (type string, required): Your API key, from your IG account settings. Placeholder only here.
- `CST` (type string, required): Client session token returned by POST /session.
- `X-SECURITY-TOKEN` (type string, required): Account security token returned by POST /session.

## 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 6 body fields the record marks as required, and a placeholder for each of the 3 body fields the vendor's page marks neither required nor optional, named in the sample's own comment. Each placeholder has to be replaced with a real value before the request can succeed.

### Python

```python
# Set IG_API_KEY, IG_CST, IG_SECURITY_TOKEN as environment variables first. Never paste real values into code.
# IG_CST and IG_SECURITY_TOKEN hold the CST and X-SECURITY-TOKEN headers that POST /session returns: step 3 of the quickstart (/brokers/ig/quickstart#step-3) captures them and this sample reads them back.
# Replace each {placeholder}, "..." and 0 with a real value before running.
# Not marked required or optional on the vendor's page, so sent here with a placeholder: direction, type, timeInForce. Leave out any the call does not need.
# Optional and not shown: body fields goodTillDate, stopDistance, limitDistance.
import os
import requests

BASE_URL = "https://demo-api.ig.com/gateway/deal"  # the demo host
headers = {
    "X-IG-API-KEY": os.environ["IG_API_KEY"],
    "CST": os.environ["IG_CST"],
    "X-SECURITY-TOKEN": os.environ["IG_SECURITY_TOKEN"],
    "VERSION": "2",
}
body = {"epic": "...", "direction": "...", "size": 0, "level": 0, "type": "...", "expiry": "...", "currencyCode": "...", "timeInForce": "...", "guaranteedStop": False}
resp = requests.post(BASE_URL + "/working-orders/otc", headers=headers, json=body, timeout=10)
resp.raise_for_status()
print(resp.json())
```

### JavaScript

```javascript
// Set IG_API_KEY, IG_CST, IG_SECURITY_TOKEN as environment variables first. Never paste real values into code.
// IG_CST and IG_SECURITY_TOKEN hold the CST and X-SECURITY-TOKEN headers that POST /session returns: step 3 of the quickstart (/brokers/ig/quickstart#step-3) captures them and this sample reads them back.
// Replace each {placeholder}, "..." and 0 with a real value before running.
// Not marked required or optional on the vendor's page, so sent here with a placeholder: direction, type, timeInForce. Leave out any the call does not need.
// Optional and not shown: body fields goodTillDate, stopDistance, limitDistance.
// Run as a module, for example a .mjs file, on a Node version that has fetch built in.
const BASE_URL = "https://demo-api.ig.com/gateway/deal"; // the demo host
const res = await fetch(BASE_URL + "/working-orders/otc", {
  method: "POST",
  headers: {
    "X-IG-API-KEY": process.env.IG_API_KEY,
    "CST": process.env.IG_CST,
    "X-SECURITY-TOKEN": process.env.IG_SECURITY_TOKEN,
    "VERSION": "2",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({"epic": "...", "direction": "...", "size": 0, "level": 0, "type": "...", "expiry": "...", "currencyCode": "...", "timeInForce": "...", "guaranteedStop": false}),
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
console.log(await res.json());
```

### curl

```bash
# Set IG_API_KEY, IG_CST, IG_SECURITY_TOKEN as environment variables first. Never paste real values into code.
# IG_CST and IG_SECURITY_TOKEN hold the CST and X-SECURITY-TOKEN headers that POST /session returns: step 3 of the quickstart (/brokers/ig/quickstart#step-3) captures them and this sample reads them back.
# Replace each {placeholder}, "..." and 0 with a real value before running.
# Not marked required or optional on the vendor's page, so sent here with a placeholder: direction, type, timeInForce. Leave out any the call does not need.
# Optional and not shown: body fields goodTillDate, stopDistance, limitDistance.
curl -X POST "https://demo-api.ig.com/gateway/deal/working-orders/otc" \
  -H "X-IG-API-KEY: $IG_API_KEY" \
  -H "CST: $IG_CST" \
  -H "X-SECURITY-TOKEN: $IG_SECURITY_TOKEN" \
  -H "VERSION: 2" \
  -H "Content-Type: application/json" \
  -d '{"epic": "...", "direction": "...", "size": 0, "level": 0, "type": "...", "expiry": "...", "currencyCode": "...", "timeInForce": "...", "guaranteedStop": false}'
```

## Response

A mock response. The values are invented, so check field names against the [official reference](https://labs.ig.com/reference/working-orders-otc.html).

```json
{
  "_mock": true,
  "dealReference": "MOCKREF0004"
}
```

## Response schema, HTTP 200

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

- `dealReference` (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 IG

- Historical price data points a week: 10,000 data points per week
  - Scope: Per account, price history endpoints only
  - Status: verified. Source: [labs.ig.com](https://labs.ig.com/faq.html), checked 2026-10-12.
- Non trading requests a minute: 30 requests per minute
  - Scope: Per account, non trading calls only
  - Status: verified. Source: [labs.ig.com](https://labs.ig.com/faq.html), checked 2026-10-12.
- Non trading requests a minute: 60 requests per minute
  - Scope: Per application, that is per API key, non trading calls only
  - Status: verified. Source: [labs.ig.com](https://labs.ig.com/faq.html), checked 2026-10-12.
- Concurrent streaming subscriptions: 40 subscriptions
  - Scope: Per streaming connection
  - Status: verified. Source: [labs.ig.com](https://labs.ig.com/faq.html), checked 2026-10-12.
  - Corroborated by [labs.ig.com/streaming-api-guide.html](https://labs.ig.com/streaming-api-guide.html)
- Trading requests a minute: 100 requests per minute
  - Scope: Per account, trading calls only
  - Sources conflict: [ig.com](https://www.ig.com/en/trading-platforms/trading-apis/how-to-use-ig-api) states around 40 trade requests per minute, checked 2026-10-05. IG's own pages disagree. The conflict is labelled, not resolved. Pace against 40.
  - Status: conflicting. Source: [labs.ig.com](https://labs.ig.com/faq.html), checked 2026-10-12.

## More on the IG API

- [All IG API endpoints](https://openbrokerapi.com/brokers/ig/endpoints): 49 documented, grouped by what they do.
- [IG API quickstart](https://openbrokerapi.com/brokers/ig/quickstart)
- [All IG API error codes](https://openbrokerapi.com/errors/ig)
- [IG API page](https://openbrokerapi.com/brokers/ig): The full record: access, authentication, limits and the source for each.
- [IG API as an OpenAPI file](https://openbrokerapi.com/specs/ig.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: IG API POST /working-orders/otc. Broker API Hub, https://openbrokerapi.com/brokers/ig/endpoints/post-workingorders-otc, 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.
