Response format .

The Tradesync API responses are in JavaScript Object Notation (JSON) format. All responses include result, status and data attributes. Success responses can also include the meta attribute and fail responses can include a code and message attribute.

Successful response
{
    "result": "success",
    "status": 200,
    "meta": {
        "count": 9,
        "limit": 1000,
        "order": "desc",
        "last_id": 1
    },
    "data": {
        "id": 1,
        "created_at": "2023-04-21T10:34:23Z",
        "updated_at": "2023-04-28T13:32:35Z",
        "restored_at": null,
        "mt_version": 4,
        "account_name": "Test account",
        "account_number": 12345,
        "password": "122345",
        "broker_server_id": 119,
        "status": "connection_ok",
        "login_response": null,
        "last_ping": "2023-04-28T13:32:35Z",
        "broker": "Test broker",
        "client_name": "test user",
        "server": "Broker-Demo",
        "trade_mode": "demo",
        "leverage": 30,
        "is_demo": "no",
        "suffix": "",
        "equity_protect": "off",
        "equity_protect_value": null,
        "currency": "GBP",
        "balance": 100000.15,
        "credit": 0,
        "equity": 100064.39,
        "free_margin": 97491.73,
        "used_margin": 2572.66,
        "open_trades": 1,
        "pending_orders": 0,
        "open_trades_lots": 0.97,
        "pending_orders_lots": 0,
        "daily_profit": 0,
        "weekly_profit": 0.15,
        "monthly_profit": 0.15,
        "total_profit": 0.15
    }
}
Fail response
{
    "result": "fail",
    "status": 404,
    "code": "not_found",
    "message": "The resource does not exist.",
    "data": []
}
Error response
500 (Internal Server Error)
Body format
Field Description
Result Success, fail or error
Status Http status code
Code A parsable string
Message Code description
Data Array of data (if applicable)
Result

There are 3 types of results

  • success - 200 status code
  • fail - 400 to 429 status code
  • error - 500 & 503 status code
Status

The HTTP status code displayed for reference.

Code

A parsable string that can be used programmatically detect certain results.

Message

A description of the parsable code.

Data

An array of data that relates to the specific request.

Meta

An array of options for the response to be returned, only on multiples.

Key Value Description
count integer The total records in the data array
limit integer Record limit per response
order asc or desc The order of the records
last_id integer The last id of the record set

Stay in the loop.

Sign up to our newsletter to keep up-to-date.