Skip to Content
HTTP APITrading

Cancel an order

Build your request

Change the values and the command follows. The token is never typed here: the command reads it from the SPECTRE_LOCAL_API_TOKEN environment variable. Run it in your own terminal.

Command
curl -X DELETE 'http://127.0.0.1:48180/v1/orders/t-173029440000000001?connection_id=12&instrument=binance:futures:BTCUSDT' \
  -H "Authorization: Bearer $SPECTRE_LOCAL_API_TOKEN"
DELETE
/orders/{id}

Sends the cancel to the exchange. The confirmation arrives in the stream.

Authorization

bearerToken trading:write
headerAuthorizationBearer <token>

The Local API token: spt_ and 64 hex characters. Copy it from Settings App → General → Local API. It is accepted only in the Authorization header. The names listed with an operation are the scopes it requires. The token of the terminal carries all of them.

Scope: trading:write

Path Parameters

id*string

The order key of the terminal, t-…, or the order id of the exchange.

Query Parameters

connection_id*integer

The connection of the instrument.

Formatint64
instrument*string

Instrument address, exchange:market:symbol.

Response Body

The terminal accepted the command. key is null.

application/json
  1. response

The answer of every trading, trigger and leverage command.

accepted*boolean

Accepted by the terminal, not by the exchange.

operation_id*string

The id of the operation in the trading operations log of the terminal. The key of a placed order is t- and this id.

key*|

The key of the placed order, t-…, or of the placed trigger: sl_…, tp_… or stop_…. null for cancels, amendments and leverage.

connection_id*integer
Formatint64
instrument*string
Example Request
curl -X DELETE 'http://127.0.0.1:48180/v1/orders/t-173029440000000001?connection_id=12&instrument=binance:futures:BTCUSDT' \  -H "Authorization: Bearer $SPECTRE_LOCAL_API_TOKEN"
Example Response
{  "accepted": true,  "operation_id": "173029440000000003",  "key": null,  "connection_id": 12,  "instrument": "binance:futures:BTCUSDT"}