Tradesync
Browse API reference
API reference

Create close command

POSThttps://api.tradesync.com/commands

Queue a close command for a full account. HTTP success confirms creation of the command; inspect its status, result, or command events for execution.

Last updated

Request body

account_idType: integerRequired: Yes
Full account belonging to the authenticated userAccepted values / limits: 1 to 4294967295Default: —
commandType: stringRequired: Yes
Command to queueAccepted values / limits: close_full, close_partialDefault: —
byType: stringRequired: Yes
Identifier used to select the tradeAccepted values / limits: ticket, magicDefault: —
trade_idType: integerRequired: Yes
Platform ticket if by is ticket; linkage identifier if by is magic. This is not the Tradesync trade resource ID.Accepted values / limits: 1 to 9999999999999999999Default: —
percentageType: numberRequired: No
Percentage to close when command is close_partialAccepted values / limits: —Default: Not set

Response example

See response field definitions for field types and conditional fields.

{
    "result": "success",
    "status": 200,
    "data": {
        "id": 915068854,
        "created_at": "2025-04-28T13:15:11Z",
        "updated_at": "2025-04-28T13:15:11Z",
        "account_id": 1242495,
        "application": "mt5",
        "group": "user",
        "event": null,
        "event_id": null,
        "copier_id": null,
        "lead_id": null,
        "command": "close_full",
        "status": "working",
        "retry_rate": "millisecond",
        "result": null,
        "by": "magic",
        "trade_id": 1213753146,
        "command_duration": null,
        "broker_duration": null,
        "total_duration": null,
        "error": null
    }
}

Errors

Code HTTP status Condition
account_is_readonly 422 The target account is readonly.

See also common response codes.