Guides
Guides

Square off

Close an entire open position immediately.

Close an entire open position immediately, by UUID. The currency is inherited from the position.

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

Status: 200 OK

{
    "success": true,
    "data": {
        "position_id": "019ecc5b-406a-7d43-be8b-c161aecf9c81",
        "status": "CREATED",
        "message": "OK"
    }
}

Response fields

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

Errors

Common errors

Position is not open

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

Status: 400 Bad Request