Guides
Guides

Square off

Close an entire open position immediately.

Request

curl -X POST "https://trade.mudrex.com/fapi/v1/futures/positions/{position_id}/close" \
  -H "Content-Type: application/json" \
  -H "X-Authentication: your-secret-key"

Parameters

ParameterTypeRequiredDescription
position_idstringYesThe unique identifier of the position (path parameter)

Response

{
    "success": true,
    "data": {
        "position_id": "0199be9e-21f3-74c3-9439-dc826109223e",
        "status": "CREATED",
        "message": "OK"
    }
}

Parameters

ParameterDescription
position_idID of the position being closed
statusStatus of the close operation (e.g., CREATED)
messageStatus message

Common errors

Position is not open

{
    "success": false,
    "errors": [
        {
            "code": 400,
            "text": "position is not open"
        }
    ]
}

Status: 400 Bad Request

Occurs when attempting to close a position that is not currently open.