CFDs are complex instruments and come with a high risk of losing money rapidly due to leverage. 82.67% of retail investor accounts lose money when trading CFDs. You should consider whether you understand how CFDs work and whether you can afford to take the high risk of losing your money

API Documentation

Request examples

POST ​/session

Login to the account and start the session.

Request:
curl -L -X POST 'https://api-capital.backend-capital.com/api/v1/session' \
-H 'X-CAP-API-KEY: evSl********S26P' \
-H 'Content-Type: application/json' \
--data-raw '{
 "encryptedPassword": "false", 
 "identifier": "test@gmail.com",
 "password": "Xxxx9999_"
}'
Request parameters
ParameterFormatMandatory?Description
encryptedPasswordbooleanNOShows whether the mentioned password is encrypted with the AES encryption method.
This parameter value = FALSE by default.
identifierstringYESLogin value.
passwordstringYESPassword value.
Response:
{
 "accountType": "CFD",
 "accountInfo": {
 "balance": 602.63,
 "deposit": 602.35,
 "profitLoss": -7.72,
 "available": 600.78
 },
 "currencyIsoCode": "USD",
 "currencySymbol": "$",
 "currentAccountId": "23116495826791396",
 "streamingHost": "wss://api-streaming-capital.backend-capital.com/",
 "accounts": [
 {
 "accountId": "23116495826791396",
 "accountName": "USD",
 "preferred": true,
 "accountType": "CFD"
 },
 {
 "accountId": "24550935676066052",
 "accountName": "secondAcc",
 "preferred": false,
 "accountType": "CFD"
 }
],
 "clientId": "1111111",
 "timezoneOffset": 3,
 "hasActiveDemoAccounts": false,
 "hasActiveLiveAccounts": true,
 "trailingStopsEnabled": false
}
POST ​/positions

Open a position.

Response:
curl -L -X POST 'https://api-capital.backend-capital.com/api/v1/positions' \
-H 'X-SECURITY-TOKEN: Flg82****kk9313' \
-H 'CST: Lp3e5WLALdkfsfN2MNdr7vk5' \
-H 'Content-Type: application/json' \
--data-raw '{
 "epic": "NATURALGAS",
 "direction": "BUY",
 "size": 100
}'
Request parameters
ParameterFormatMandatory?Description
directionenumYESDirection of the trade: BUY or SELL.
epicstringYESThe market in which the trade should take place.
guaranteedStopbooleanNOGuaranteed or normal stop loss.
trailingStopbooleanNOTrailing or normal stop loss.
profitAmountnumberNOTake profit amount.
profitDistancenumberNOTake profit distance from the current asset price.
profitLevelnumberNOTake profit price.
sizenumberYESSize of the trade.
stopAmountnumberNOStop loss amount.
stopDistancenumberNOStop loss distance from the current asset price.
stopLevelnumberNOStop loss price.
Response:
{
 "dealReference": "o_43839486-f53j-478o-8162-193j7kcd509i"
}
POST ​/workingorders

Create a limit/stop order.

Response:
curl -L -X POST 'https://api-capital.backend-capital.com/api/v1/workingorders' \
-H 'X-SECURITY-TOKEN: Flg82****kk9313' \
-H 'CST: Lp3e5WLALdkfsfN2MNdr7vk5'\
-H 'Content-Type: application/json' \
--data-raw '{
 "epic": "NATURALGAS",
 "direction": "BUY",
 "size": 1,
 "level": 2300,
 "type": "LIMIT",
 "stopLevel": 2000
}'
ParameterFormatMandatory?Description
directionenumYESDirection of the trade: BUY or SELL.
epicstringYESThe market in which the trade should take place.
goodTillDatestringNOOrder expiration date. Format: YYYY-MM-DDTHH:MM:SS (e.g. 2022-04-01T01:01:00)
guaranteedStopbooleanNOGuaranteed or normal stop loss.
Set to normal by default.
trailingStopbooleanNOTrailing or normal stop loss.
levelnumberYESOrder price level.
profitAmountnumberNOTake profit amount.
profitDistancenumberNOTake profit distance from the current asset price.
profitLevelnumberNOTake profit price.
sizenumberYESSize of the trade.
stopAmountnumberNOStop loss amount.
stopDistancenumberNOStop loss distance from the current asset price.
stopLevelnumberNOStop loss price.
typeenumYESOrder type: LIMIT or STOP.
Response:
{
 "dealReference": "o_da3727b2-eafb-4efa-a05a-63f8a632ab58"
}

Still looking for a broker you can trust?

Join the 660,000+ traders worldwide that chose to trade with Capital.com

1. Create & verify your account 2. Make your first deposit 3. You’re all set. Start trading