curl --request POST \
--url https://public-api.etoro.com/api/v2/trading/execution/demo/orders \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--header 'x-request-id: <x-request-id>' \
--header 'x-user-key: <api-key>' \
--data '
{
"action": "open",
"transaction": "buy",
"symbol": null,
"instrumentId": 101,
"settlementType": null,
"orderType": "mkt",
"triggerRate": null,
"leverage": 2,
"amount": 1000,
"orderCurrency": "usd",
"units": null,
"contracts": null,
"stopLossRate": 1.2,
"takeProfitRate": 1.5,
"stopLossType": "fixed",
"additionalMargin": null,
"positionIds": null
}
'import requests
url = "https://public-api.etoro.com/api/v2/trading/execution/demo/orders"
payload = {
"action": "open",
"transaction": "buy",
"symbol": None,
"instrumentId": 101,
"settlementType": None,
"orderType": "mkt",
"triggerRate": None,
"leverage": 2,
"amount": 1000,
"orderCurrency": "usd",
"units": None,
"contracts": None,
"stopLossRate": 1.2,
"takeProfitRate": 1.5,
"stopLossType": "fixed",
"additionalMargin": None,
"positionIds": None
}
headers = {
"x-request-id": "<x-request-id>",
"x-api-key": "<api-key>",
"x-user-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-request-id': '<x-request-id>',
'x-api-key': '<api-key>',
'x-user-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
action: 'open',
transaction: 'buy',
symbol: null,
instrumentId: 101,
settlementType: null,
orderType: 'mkt',
triggerRate: null,
leverage: 2,
amount: 1000,
orderCurrency: 'usd',
units: null,
contracts: null,
stopLossRate: 1.2,
takeProfitRate: 1.5,
stopLossType: 'fixed',
additionalMargin: null,
positionIds: null
})
};
fetch('https://public-api.etoro.com/api/v2/trading/execution/demo/orders', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://public-api.etoro.com/api/v2/trading/execution/demo/orders",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'action' => 'open',
'transaction' => 'buy',
'symbol' => null,
'instrumentId' => 101,
'settlementType' => null,
'orderType' => 'mkt',
'triggerRate' => null,
'leverage' => 2,
'amount' => 1000,
'orderCurrency' => 'usd',
'units' => null,
'contracts' => null,
'stopLossRate' => 1.2,
'takeProfitRate' => 1.5,
'stopLossType' => 'fixed',
'additionalMargin' => null,
'positionIds' => null
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>",
"x-request-id: <x-request-id>",
"x-user-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://public-api.etoro.com/api/v2/trading/execution/demo/orders"
payload := strings.NewReader("{\n \"action\": \"open\",\n \"transaction\": \"buy\",\n \"symbol\": null,\n \"instrumentId\": 101,\n \"settlementType\": null,\n \"orderType\": \"mkt\",\n \"triggerRate\": null,\n \"leverage\": 2,\n \"amount\": 1000,\n \"orderCurrency\": \"usd\",\n \"units\": null,\n \"contracts\": null,\n \"stopLossRate\": 1.2,\n \"takeProfitRate\": 1.5,\n \"stopLossType\": \"fixed\",\n \"additionalMargin\": null,\n \"positionIds\": null\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-request-id", "<x-request-id>")
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("x-user-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://public-api.etoro.com/api/v2/trading/execution/demo/orders")
.header("x-request-id", "<x-request-id>")
.header("x-api-key", "<api-key>")
.header("x-user-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"action\": \"open\",\n \"transaction\": \"buy\",\n \"symbol\": null,\n \"instrumentId\": 101,\n \"settlementType\": null,\n \"orderType\": \"mkt\",\n \"triggerRate\": null,\n \"leverage\": 2,\n \"amount\": 1000,\n \"orderCurrency\": \"usd\",\n \"units\": null,\n \"contracts\": null,\n \"stopLossRate\": 1.2,\n \"takeProfitRate\": 1.5,\n \"stopLossType\": \"fixed\",\n \"additionalMargin\": null,\n \"positionIds\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://public-api.etoro.com/api/v2/trading/execution/demo/orders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-request-id"] = '<x-request-id>'
request["x-api-key"] = '<api-key>'
request["x-user-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"action\": \"open\",\n \"transaction\": \"buy\",\n \"symbol\": null,\n \"instrumentId\": 101,\n \"settlementType\": null,\n \"orderType\": \"mkt\",\n \"triggerRate\": null,\n \"leverage\": 2,\n \"amount\": 1000,\n \"orderCurrency\": \"usd\",\n \"units\": null,\n \"contracts\": null,\n \"stopLossRate\": 1.2,\n \"takeProfitRate\": 1.5,\n \"stopLossType\": \"fixed\",\n \"additionalMargin\": null,\n \"positionIds\": null\n}"
response = http.request(request)
puts response.read_body{
"token": "066faaee-e1e9-49d2-a568-c6e1cc336ad8",
"orderId": 13902598,
"referenceId": "1c94300c-90aa-4303-9d00-dec376d74efb"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>"
}Create an order
Rate limit: 20 requests per 60 seconds. This is a shared quota — the same budget is consumed by a group of related endpoints, so calling any of them reduces what is left for the others (you cannot call each at the full rate independently). Endpoints sharing this quota:
DELETE /api/v1/trading/execution/demo/limit-orders/{orderId}DELETE /api/v1/trading/execution/demo/market-close-orders/{orderId}DELETE /api/v1/trading/execution/demo/market-open-orders/{orderId}DELETE /api/v2/trading/execution/demo/orders/{orderId}DELETE /api/v3/trading/execution/demo/orders/{orderId}POST /api/v1/trading/execution/demo/limit-ordersPOST /api/v1/trading/execution/demo/market-close-orders/positions/{positionId}POST /api/v1/trading/execution/demo/market-open-orders/by-amountPOST /api/v1/trading/execution/demo/market-open-orders/by-unitsPOST /api/v3/trading/execution/demo/orders
This endpoint allows traders to place an order. Leverage, stop-loss, and take-profit settings can be applied. Order size must use exactly one of amount, units, or contracts. For open orders the instrument must be identified by exactly one of symbol or instrumentId - providing both is rejected. A stopLossRate is required when leverage is greater than 1, when transaction is sellShort, when settlementType is realFutures, or when stopLossType is trailing. Only the buy and sellShort transactions are currently supported. A unique X-Request-Id header (GUID) is required for idempotency. Currently only orders to open a position are supported. On this v2 create path, settlementType remains optional (stricter settlementType rules apply only on v3). A 200 response means the order was accepted for processing, not that it was executed. Confirm the outcome with GET /api/v2/trading/info/demo/orders:lookup, passing the returned orderId - or referenceId, which echoes your X-Request-Id and is the only handle you have if this response is lost. In that response, status.id 3 (Filled) and 5 (PartiallyFilled) mean the order executed; 4 (Rejected) and 10 (RejectedPartiallyFilled) carry the reason in status.errorCode and status.errorMessage; 1 (Received), 2 (Placed), 11 (WaitingForMarket) and 12 (PendingTriggeredRate) are still in flight and should be polled again. positionExecutions lists the positionId values the order produced.
curl --request POST \
--url https://public-api.etoro.com/api/v2/trading/execution/demo/orders \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--header 'x-request-id: <x-request-id>' \
--header 'x-user-key: <api-key>' \
--data '
{
"action": "open",
"transaction": "buy",
"symbol": null,
"instrumentId": 101,
"settlementType": null,
"orderType": "mkt",
"triggerRate": null,
"leverage": 2,
"amount": 1000,
"orderCurrency": "usd",
"units": null,
"contracts": null,
"stopLossRate": 1.2,
"takeProfitRate": 1.5,
"stopLossType": "fixed",
"additionalMargin": null,
"positionIds": null
}
'import requests
url = "https://public-api.etoro.com/api/v2/trading/execution/demo/orders"
payload = {
"action": "open",
"transaction": "buy",
"symbol": None,
"instrumentId": 101,
"settlementType": None,
"orderType": "mkt",
"triggerRate": None,
"leverage": 2,
"amount": 1000,
"orderCurrency": "usd",
"units": None,
"contracts": None,
"stopLossRate": 1.2,
"takeProfitRate": 1.5,
"stopLossType": "fixed",
"additionalMargin": None,
"positionIds": None
}
headers = {
"x-request-id": "<x-request-id>",
"x-api-key": "<api-key>",
"x-user-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-request-id': '<x-request-id>',
'x-api-key': '<api-key>',
'x-user-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
action: 'open',
transaction: 'buy',
symbol: null,
instrumentId: 101,
settlementType: null,
orderType: 'mkt',
triggerRate: null,
leverage: 2,
amount: 1000,
orderCurrency: 'usd',
units: null,
contracts: null,
stopLossRate: 1.2,
takeProfitRate: 1.5,
stopLossType: 'fixed',
additionalMargin: null,
positionIds: null
})
};
fetch('https://public-api.etoro.com/api/v2/trading/execution/demo/orders', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://public-api.etoro.com/api/v2/trading/execution/demo/orders",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'action' => 'open',
'transaction' => 'buy',
'symbol' => null,
'instrumentId' => 101,
'settlementType' => null,
'orderType' => 'mkt',
'triggerRate' => null,
'leverage' => 2,
'amount' => 1000,
'orderCurrency' => 'usd',
'units' => null,
'contracts' => null,
'stopLossRate' => 1.2,
'takeProfitRate' => 1.5,
'stopLossType' => 'fixed',
'additionalMargin' => null,
'positionIds' => null
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>",
"x-request-id: <x-request-id>",
"x-user-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://public-api.etoro.com/api/v2/trading/execution/demo/orders"
payload := strings.NewReader("{\n \"action\": \"open\",\n \"transaction\": \"buy\",\n \"symbol\": null,\n \"instrumentId\": 101,\n \"settlementType\": null,\n \"orderType\": \"mkt\",\n \"triggerRate\": null,\n \"leverage\": 2,\n \"amount\": 1000,\n \"orderCurrency\": \"usd\",\n \"units\": null,\n \"contracts\": null,\n \"stopLossRate\": 1.2,\n \"takeProfitRate\": 1.5,\n \"stopLossType\": \"fixed\",\n \"additionalMargin\": null,\n \"positionIds\": null\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-request-id", "<x-request-id>")
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("x-user-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://public-api.etoro.com/api/v2/trading/execution/demo/orders")
.header("x-request-id", "<x-request-id>")
.header("x-api-key", "<api-key>")
.header("x-user-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"action\": \"open\",\n \"transaction\": \"buy\",\n \"symbol\": null,\n \"instrumentId\": 101,\n \"settlementType\": null,\n \"orderType\": \"mkt\",\n \"triggerRate\": null,\n \"leverage\": 2,\n \"amount\": 1000,\n \"orderCurrency\": \"usd\",\n \"units\": null,\n \"contracts\": null,\n \"stopLossRate\": 1.2,\n \"takeProfitRate\": 1.5,\n \"stopLossType\": \"fixed\",\n \"additionalMargin\": null,\n \"positionIds\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://public-api.etoro.com/api/v2/trading/execution/demo/orders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-request-id"] = '<x-request-id>'
request["x-api-key"] = '<api-key>'
request["x-user-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"action\": \"open\",\n \"transaction\": \"buy\",\n \"symbol\": null,\n \"instrumentId\": 101,\n \"settlementType\": null,\n \"orderType\": \"mkt\",\n \"triggerRate\": null,\n \"leverage\": 2,\n \"amount\": 1000,\n \"orderCurrency\": \"usd\",\n \"units\": null,\n \"contracts\": null,\n \"stopLossRate\": 1.2,\n \"takeProfitRate\": 1.5,\n \"stopLossType\": \"fixed\",\n \"additionalMargin\": null,\n \"positionIds\": null\n}"
response = http.request(request)
puts response.read_body{
"token": "066faaee-e1e9-49d2-a568-c6e1cc336ad8",
"orderId": 13902598,
"referenceId": "1c94300c-90aa-4303-9d00-dec376d74efb"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>"
}Authorizations
API key of the application. Only valid together with the x-user-key header — the pair is an alternative to OAuth bearer authentication, never sent alongside it. The pair is granted the same permissions the operation's OAuth scopes describe.
Demo credential for trying the API from these docs: lhgfaslk21490FAScVPkdsb53F9dNkfHG4faZSG5vfjndfcfgdssdgsdHF4663
User-specific authentication key. Only valid together with the x-api-key header — the pair is an alternative to OAuth bearer authentication, never sent alongside it.
Demo credential for trying the API from these docs: eyJlYW4iOiJVbnJlZ2lzdGVyZWRBcHBsaWNhdGlvbiIsImVrIjoiOE5sZ2cwcW5EUVdROUFNWGpXT2lmOWktZnpidG5KcUlqWGJ3WHJZZkpZcldrbG90ZEhvLVBjSWhQaU8xU1ZtMW84aU1WZGZqN2xWNzFjLXFxLmcybXE1dnh4Q1hUT25xaWRUaTFlcEhmVk1fIn0_
Scopes
Headers
Body
Request payload for creating an order to open or close a position.
The transaction direction: buy opens a long position, sell closes a long position, sellShort opens a short position, and buyToCover closes a short position. Currently only buy and sellShort are supported; sell and buyToCover are rejected and will be enabled in a future release alongside the close action.
buy, sell, sellShort, buyToCover "buy"
The settlement type. Possible values: cfd, real, realFutures, marginTrade. Version rules: on Public API v2 create (POST /api/v2/trading/execution/demo/orders, Admin v1) settlementType remains optional. On Public API v3 create (POST /api/v3/trading/execution/demo/orders, Admin v2) it must NOT be set for MIT orders (the platform resolves it), and for all other order types it must be set to an eligible settlement type. A mismatch is rejected during execution after the order has already been accepted with an order id. The valid values differ per instrument, direction and leverage - call POST /api/v2/trading/info/demo/eligibility and read leverageConfigs[].settlementType for the relevant combinations of direction, leverage and settlementType before supplying them; that configuration changes rarely, so one call can be cached and reused for the whole session. real - the real instrument held in full value. realFutures - the real future contract, which is a derivative of an underlying instrument. Each future contract usually maintains a different number of underlying instrument units than 1. The number of units held in a single future contract is called the multiplier, which can be bigger, lower, or equal to 1. marginTrade - the real instrument held with only a portion of its value called margin (leveraged asset). cfd - contract for difference, which is a derivative following the underlying instrument.
cfd, real, realFutures, marginTrade The order execution type. Possible values: mkt (market), mit (market if touched), limitIOC. mkt - a market order that executes at the available market price. mit - a market-if-touched order that waits until the triggerRate or better is published in the market feed and then executes at the market price at that time. limitIOC - an immediate limit order that executes now at the limitRate or better if such a rate is available at the market, or gets cancelled immediately if no such rate is available now. mit is not supported when settlementType is realFutures.
mkt, mit, limitIOC "mkt"
The stop-loss type. Possible values: fixed, trailing. The default is fixed. fixed - the stop-loss rate does not change. trailing - the stop-loss rate moves up whenever the instrument rate goes up such that the stop loss is triggered from the same distance from the last peak rate as the distance of the stop-loss rate from the rate at the open. Setting trailing requires stopLossRate.
fixed, trailing "fixed"
Additional funds in the order currency added to the invested amount (margin), if the desire is for the stop-loss rate to be set lower than normally permitted. Only accepted when settlementType is realFutures - supplying it for any other settlement type is rejected. Must be greater than 0.
LimitRate should be set for LimitIOC orders only, where it is required and must be greater than zero; supplying it for any other order type is rejected. it is the client submitted price which will be routed to the exchange for execution. Please note that a client submitted price cannot exceed a 10% deviation from current market price otherwise it will be rejected on pre trade
1.5
Response
Order submitted successfully. Returns the created order details.
Response payload after successfully submitting an order.