Documentation

Transaction

AccountAuth Required

Subscribe to notifications of buy and sell contracts, deposits and withdrawals. The loginid parameter and some contract fields are removed, symbol is renamed to underlying_symbol, and action has fewer values.

Quick comparison

AspectLegacy APINew APIAction
EndpointtransactiontransactionNone
Auth RequiredYesYesNone
loginid parameterOptionalRemovedRemove from requests
Symbol fieldsymbolunderlying_symbolRename in your code
Barrier fieldsbarrier, high_barrier, low_barrierRemovedStop reading barrier fields
display_nameReturnedRemovedStop reading display_name
Limit order fieldsstop_loss, stop_out, take_profitRemovedStop reading these fields
action values8 values4 valuesHandle fewer values

Breaking changes

1. loginid parameter removed

In the Legacy API, loginid selected the account when you authorised several accounts. The New API does not accept it.

Required change: Remove loginid from your transaction requests. Your token selects the account.

2. symbol renamed to underlying_symbol

The transaction object returns the symbol as underlying_symbol instead of symbol.

Required change: Read underlying_symbol instead of symbol.

3. Barrier fields removed

barrier, high_barrier and low_barrier are no longer returned.

Required change: Get barriers from proposal_open_contract instead.

4. display_name removed

The display_name of the symbol is no longer returned.

Required change: Get the symbol's name from active_symbols instead.

5. stop_loss, stop_out and take_profit removed

stop_loss, stop_out and take_profit are no longer returned.

Required change: Get limit orders from proposal_open_contract instead.

6. Fewer action values

action is buy, sell, deposit or withdrawal. The New API no longer returns escrow, adjustment, virtual_credit or transfer.

Required change: Update code that handles the values the New API no longer returns.

Request structure

Legacy APIrequest example
{
  "transaction": 1,
  "subscribe": 1,
  "loginid": "CR123456",
  "req_id": 1
}
New APIrequest example
{
  "transaction": 1,
  "subscribe": 1,
  "req_id": 1
}

Response structure

Legacy APIresponse example
{
  "echo_req": {
    "transaction": 1,
    "subscribe": 1,
    "loginid": "CR123456",
    "req_id": 1
  },
  "msg_type": "transaction",
  "req_id": 1,
  "subscription": {
    "id": "c84a793b-8a87-7999-ce10-9b22f7ceead3"
  },
  "transaction": {
    "action": "buy",
    "amount": -10,
    "balance": 9990,
    "contract_id": 11542203588,
    "currency": "USD",
    "date_expiry": 1760000300,
    "id": "c84a793b-8a87-7999-ce10-9b22f7ceead3",
    "longcode": "Win payout if Volatility 100 Index is strictly higher than entry spot at 5 minutes after contract start time.",
    "purchase_time": 1760000000,
    "transaction_id": 11542203587,
    "transaction_time": 1760000000,
    "barrier": "S0P",
    "display_name": "Volatility 100 Index",
    "stop_loss": null,
    "stop_out": null,
    "symbol": "R_100",
    "take_profit": null
  }
}
New APIresponse example
{
  "echo_req": {
    "transaction": 1,
    "subscribe": 1,
    "req_id": 1
  },
  "msg_type": "transaction",
  "req_id": 1,
  "subscription": {
    "id": "c84a793b-8a87-7999-ce10-9b22f7ceead3"
  },
  "transaction": {
    "action": "buy",
    "amount": -10,
    "balance": 9990,
    "contract_id": 11542203588,
    "currency": "USD",
    "date_expiry": 1760000300,
    "id": "c84a793b-8a87-7999-ce10-9b22f7ceead3",
    "longcode": "Win payout if Volatility 100 Index is strictly higher than entry spot at 5 minutes after contract start time.",
    "purchase_time": 1760000000,
    "transaction_id": 11542203587,
    "transaction_time": 1760000000,
    "underlying_symbol": "R_100"
  }
}

Code examples

function watchTransactions(loginId) {
  ws.send(JSON.stringify({ transaction: 1, subscribe: 1, loginid: loginId }));

  ws.onmessage = (event) => {
    const response = JSON.parse(event.data);
    if (response.msg_type !== "transaction" || !response.transaction) return;

    const tx = response.transaction;
    console.log(tx.action, tx.amount, tx.symbol, tx.display_name, tx.barrier);
  };
}
Click to open live chat support. Get instant help from our support team.