Leveraged forex
Close a position
Close one position at the market. The margin comes back with the result.
curl --request POST \
--url "https://reirex.com/api/v1/margin/positions/LP-7K2M4QX3P9/close" \
--header "GX-API-KEY: $GX_API_KEY" \
--header "GX-API-TIMESTAMP: $TIMESTAMP" \
--header "GX-API-SIGN: $SIGNATURE"200 OKapplication/json
{
"reference": "LP-7K2M4QX3P9",
"symbol": "EURUSD",
"side": "long",
"units": "10000.00",
"leverage": 20,
"entryPrice": "1.17447",
"margin": "500.00",
"stopLoss": "1.16500",
"takeProfit": "1.18500",
"status": "closed",
"closePrice": "1.17712",
"pnl": "22.51",
"result": "22.51",
"financing": "0.00",
"fees": "20.00",
"closeReason": "owner",
"openedAt": "2026-10-14T16:14:15.412Z",
"closedAt": "2026-10-14T16:14:15.412Z",
"live": null,
"currency": "EUR"
}A loss never goes beyond the margin you put in. Closing works whenever the currency markets are open, even once your account can no longer open positions.
Path parameters
referencestringrequiredThe position's reference.
Response
referencestringThe position's reference, such as
LP-7K2M4QX3P9.symbolstringThe currency pair.
sidestringlongorshort.unitsstringIts size, in the pair's first currency.
leverageintegerThe leverage it was opened with.
entryPricestringThe price it opened at.
marginstringThe euro held for it.
stopLossstring | nullIts stop-loss, if one is set.
takeProfitstring | nullIts take-profit, if one is set.
statusstringopen,closed, orliquidatedwhen it was closed out.closePricestring | nullThe price it closed at;
nullwhile open.pnlstring | nullIts result less financing, in euro;
nullwhile open.resultstring | nullIts price result alone, in euro;
nullwhile open.financingstringThe overnight financing it has paid, in euro.
feesstringThe fees it has paid, in euro.
closeReasonstring | nullWhy it closed:
owner,stop_loss,take_profit,liquidationorstaff;nullwhile open.openedAtstringWhen it opened.
closedAtstring | nullWhen it closed;
nullwhile open.liveobject | nullWhere an open position stands now;
nullonce it has ended.currencystringThe currency of the euro figures: always
EUR.

