pipsocketDOCS
API reference / Control

Kill switch

Block new exposure and flatten the account.

Get the kill switch

GET/v1/accounts/{account}/kill-switch

Whether the account's kill switch is engaged.

Path

accountstringrequired

The account's id, acc_ and 26 characters, as the dashboard shows it.

Response

engagedboolean
sinceintegeror null

When it was engaged: seconds since 1970 (UTC). Null when it is not engaged.

deviationintegeror null

The deviation, in points, its closing deals carry. Null when it is not engaged.

Errors

401invalid_api_key

The key is not a workspace's current key (a rolled key stops working within about a minute).

401missing_api_key

No API key: send it as Authorization: Bearer <key>.

404no_such_account

No such account, or one the key's workspace doesn't have: the two look the same.

503engine_busy

The account's engine host has too many calls in flight (256). Nothing was done; try again.

503engine_unavailable

The account's engine host is not connected to Pipsocket, or disconnected while the call waited. A trade it already had is still settled: look it up.

504engine_timeout

The account's engine did not answer within 30 seconds.

Engage the kill switch

POST/v1/accounts/{account}/kill-switch

Blocks new exposure first (new orders and changes to pending orders are refused with 423 until it is lifted; the block survives restarts), then deletes every pending order and closes every position, each as one request sent once. It first waits up to 6 seconds for trades still being sent. Engaging it again retries whatever is left. Closing, close by, cancelling and setting stops still work while it is engaged.

Path

accountstringrequired

The account's id, acc_ and 26 characters, as the dashboard shows it.

Body

Left out: MT5's empty values
deviationintegeroptional
MT5 · deviation

The largest difference from the current price the closing deals accept, in points, for instant or request execution. 0 if left out.

Response

flatboolean

No positions or pending orders in a fresh read of the account, and no trade that could add exposure without a known outcome (unknown included).

cancelledobject[]

Each pending order and the removal sent for it (or the one already waiting for its answer).

Fields of cancelled
orderinteger

The pending order's ticket.

requestobject

A trade request: the request as recorded for the terminal (sent), its state, and MT5's answer.

Fields of request
requeststring

The request's id (req_...): look it up with GET /requests/{request}.

stateenum

A trade request's state: pending (sent, no answer yet: never sent again), done (MT5 answered: filled, placed or rejected, as result.retcode says), unknown (no answer within 130 seconds; it becomes done if the terminal reports the answer later) or refused (the terminal did not send it).

pendingdoneunknownrefused
sentobject

MT5's MqlTradeRequest, field for field, exactly as recorded to send to the terminal: the request's state and result say whether it reached MT5. Fields the call does not use carry MT5's empty values (0, "", fok, gtc).

resultobjector null

MT5's MqlTradeResult once done; why it was not sent once refused; otherwise null.

messagestring

What the answer means, in a sentence.

closedobject[]

Each position and the close sent for it (or the one already waiting for its answer).

Fields of closed
positioninteger

The position's ticket.

requestobject

A trade request: the request as recorded for the terminal (sent), its state, and MT5's answer.

Fields of request
requeststring

The request's id (req_...): look it up with GET /requests/{request}.

stateenum

A trade request's state: pending (sent, no answer yet: never sent again), done (MT5 answered: filled, placed or rejected, as result.retcode says), unknown (no answer within 130 seconds; it becomes done if the terminal reports the answer later) or refused (the terminal did not send it).

pendingdoneunknownrefused
sentobject

MT5's MqlTradeRequest, field for field, exactly as recorded to send to the terminal: the request's state and result say whether it reached MT5. Fields the call does not use carry MT5's empty values (0, "", fok, gtc).

resultobjector null

MT5's MqlTradeResult once done; why it was not sent once refused; otherwise null.

messagestring

What the answer means, in a sentence.

remainingobjector null

What a fresh read found afterwards; null if the terminal did not answer it.

Fields of remaining
positionsinteger
ordersinteger
unansweredstring[]

Ids of requests sent before the switch engaged that could add exposure and have no known outcome. If one fills and the terminal reports it, the switch closes what it opened.

kill_switchobject

Whether the account's kill switch is engaged.

Fields of kill_switch
engagedboolean
sinceintegeror null

When it was engaged: seconds since 1970 (UTC). Null when it is not engaged.

deviationintegeror null

The deviation, in points, its closing deals carry. Null when it is not engaged.

messagestring

What the outcome means, in a sentence.

Errors

401invalid_api_key

The key is not a workspace's current key (a rolled key stops working within about a minute).

401missing_api_key

No API key: send it as Authorization: Bearer <key>.

404no_such_account

No such account, or one the key's workspace doesn't have: the two look the same.

422invalid_request

A field, query parameter or header is missing, malformed or not allowed, or the body is not JSON. Nothing was sent.

503account_not_connected

the switch is engaged (and stays engaged), but the terminal stopped answering: no position was closed, though pending orders may already have been deleted. Engage it again once the terminal is connected; a sweep also runs when it reconnects.

503engine_busy

The account's engine host has too many calls in flight (256). Nothing was done; try again.

503engine_unavailable

The account's engine host is not connected to Pipsocket, or disconnected while the call waited. A trade it already had is still settled: look it up.

504engine_timeout

The account's engine did not answer within 30 seconds.

Lift the kill switch

DELETE/v1/accounts/{account}/kill-switch

Lifts the account's kill switch: new orders and changes to pending orders are accepted again. Lifting a switch that is not engaged changes nothing.

Path

accountstringrequired

The account's id, acc_ and 26 characters, as the dashboard shows it.

Response

engagedboolean
sinceintegeror null

When it was engaged: seconds since 1970 (UTC). Null when it is not engaged.

deviationintegeror null

The deviation, in points, its closing deals carry. Null when it is not engaged.

Errors

401invalid_api_key

The key is not a workspace's current key (a rolled key stops working within about a minute).

401missing_api_key

No API key: send it as Authorization: Bearer <key>.

404no_such_account

No such account, or one the key's workspace doesn't have: the two look the same.

422invalid_request

A field, query parameter or header is missing, malformed or not allowed, or the body is not JSON. Nothing was sent.

503engine_busy

The account's engine host has too many calls in flight (256). Nothing was done; try again.

503engine_unavailable

The account's engine host is not connected to Pipsocket, or disconnected while the call waited. A trade it already had is still settled: look it up.

504engine_timeout

The account's engine did not answer within 30 seconds.