eToro API POST /api/v2/trading/execution/demo/orders
Places an order on the demo account, by amount or units, with optional leverage, stop loss and take profit. The real account version is POST /api/v2/trading/execution/orders.
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.
Needs a Write key (OAuth scope etoro-public:demo:write or etoro-public:trade.demo:write). referenceId echoes your x-request-id, which you can later pass to the orders lookup. Shared quota of 20 requests per 60 seconds across the order execution endpoints. Also documented on the page: triggerRate, limitRate, contracts, additionalMargin and positionIds. Method, path and parameters, with their required flags, were re-read on eToro's reference page for this call on 12 Oct 2026 and agree with this record; the mock reply was not compared field by field.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
| x-request-idrequired | header | string (uuid) | A fresh UUID for every request. |
| actionrequired | body | string | open or close; eToro says only open is currently supported here. |
| transactionrequired | body | string | buy, sell, sellShort or buyToCover; eToro says buy and sellShort are currently supported. |
| instrumentId | body | integer | eToro instrument ID. For open orders give exactly one of instrumentId or symbol. |
| symbol | body | string | Ticker symbol, as the alternative to instrumentId. |
| orderType | body | string | mkt (market), mit (market if touched, needs triggerRate) or limitIOC (needs limitRate). |
| amount | body | number | Amount to invest in the order currency. Mutually exclusive with units and contracts. |
| units | body | number | Number of units. Mutually exclusive with amount and contracts. |
| orderCurrency | body | string | Currency of the amount; eToro says only USD is currently supported. |
| leverage | body | integer | Leverage multiplier; defaults to 1. |
| stopLossRate | body | number | Rate at which the position closes to limit a loss. |
| takeProfitRate | body | number | Rate at which the position closes to take profit. |
| stopLossType | body | string | fixed or trailing. |
| settlementType | body | string | cfd, real, realFutures or marginTrade; optional on v2. |
Authentication headers
| Name | Type | Description |
|---|---|---|
| x-api-keyrequired | string | Your public API key, which identifies the application. Sent with x-user-key; eToro's reference says an OAuth 2.0 bearer token can be used instead of the key pair, not alongside it. Placeholder only: never paste a real key into this site. |
| x-user-keyrequired | string | Your user key from Settings > Trading > API Key Management. Each key is tied to one environment (Demo or Real) and to Read or Write permission. Placeholder only. |
Request
Written from the method, path and parameters recorded on this page. No demo host is recorded as a plain address for this API, so the samples read the base address from an environment variable. 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 writes these same snippets, from the same record.
This call takes a request body. The samples send it as JSON with a Content-Type of application/json (in Python, passing json= sets that header) and a placeholder for each of the 2 body fields the record marks as required. Each placeholder has to be replaced with a real value before the request can succeed.
Python
# Set ETORO_BASE_URL, ETORO_API_KEY, ETORO_USER_KEY as environment variables first. Never paste real values into code.
# No demo host is recorded as a plain address for this API, so the base address is read from ETORO_BASE_URL.
# Replace each {placeholder}, "..." and 0 with a real value before running.
# Optional and not shown: body fields instrumentId, symbol, orderType, amount, units, orderCurrency, leverage, stopLossRate, takeProfitRate, stopLossType, settlementType.
import os
import requests
BASE_URL = os.environ["ETORO_BASE_URL"]
headers = {
"x-api-key": os.environ["ETORO_API_KEY"],
"x-user-key": os.environ["ETORO_USER_KEY"],
"x-request-id": "...",
}
body = {"action": "...", "transaction": "..."}
resp = requests.post(BASE_URL + "/api/v2/trading/execution/demo/orders", headers=headers, json=body, timeout=10)
resp.raise_for_status()
print(resp.json())JavaScript
// Set ETORO_BASE_URL, ETORO_API_KEY, ETORO_USER_KEY as environment variables first. Never paste real values into code.
// No demo host is recorded as a plain address for this API, so the base address is read from ETORO_BASE_URL.
// Replace each {placeholder}, "..." and 0 with a real value before running.
// Optional and not shown: body fields instrumentId, symbol, orderType, amount, units, orderCurrency, leverage, stopLossRate, takeProfitRate, stopLossType, settlementType.
// Run as a module, for example a .mjs file, on a Node version that has fetch built in.
const BASE_URL = process.env.ETORO_BASE_URL;
const res = await fetch(BASE_URL + "/api/v2/trading/execution/demo/orders", {
method: "POST",
headers: {
"x-api-key": process.env.ETORO_API_KEY,
"x-user-key": process.env.ETORO_USER_KEY,
"x-request-id": "...",
"Content-Type": "application/json",
},
body: JSON.stringify({"action": "...", "transaction": "..."}),
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
console.log(await res.json());curl
# Set ETORO_BASE_URL, ETORO_API_KEY, ETORO_USER_KEY as environment variables first. Never paste real values into code.
# No demo host is recorded as a plain address for this API, so the base address is read from ETORO_BASE_URL.
# Replace each {placeholder}, "..." and 0 with a real value before running.
# Optional and not shown: body fields instrumentId, symbol, orderType, amount, units, orderCurrency, leverage, stopLossRate, takeProfitRate, stopLossType, settlementType.
curl -X POST "$ETORO_BASE_URL/api/v2/trading/execution/demo/orders" \
-H "x-api-key: $ETORO_API_KEY" \
-H "x-user-key: $ETORO_USER_KEY" \
-H "x-request-id: ..." \
-H "Content-Type: application/json" \
-d '{"action": "...", "transaction": "..."}'Response
A mock response. The values are invented, so check field names against the official reference.
{
"_mock": true,
"token": "00000000-0000-4000-8000-000000000001",
"orderId": 900001,
"referenceId": "00000000-0000-4000-8000-000000000002"
}Response schema, HTTP 200
Every field this site's OpenAPI file for eToro declares for this response.
| Field | Type | Description |
|---|---|---|
| token | string | Not recorded |
| orderId | integer | Not recorded |
| referenceId | string | Not recorded |
Unverifiedno 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 eToro
| Limit | Value | Scope | Source |
|---|---|---|---|
| Headline limit | 60/min reads per key | user | api-portal.etoro.comchecked |
eToro API errors you may meet
- ApiKeyRequiredThe Authenticate message was sent without the API key. eToro lists this among the error codes of an unsuccessful WebSocket Authenticate response.
- HTTP 400HTTP 400. Validation failed on the request as sent, for example a missing or malformed minDate or too many instrument IDs in one call.
- DataRequiredThe Authenticate message was sent without its data. eToro lists this among the error codes of an unsuccessful WebSocket Authenticate response.
- HTTP 403HTTP 403. The key or token is recognised but lacks the permission this call needs.
- InvalidKeyA key in the Authenticate message is not valid. eToro lists this among the error codes of an unsuccessful WebSocket Authenticate response.
- HTTP 404HTTP 404. The order, position or username in the request was not found. eToro also uses 404 for some upstream or validation failures.
All eToro API error codes, including 10 more not listed here.