The Tradesync API uses API keys to authenticate requests. Each request uses a key and secret pair with Basic authorization. Your key:secret pair must be Base64 encoded and added to the header of each request.
Key and secret pairs can be generated and managed via the web application here.
Your application username and password for the web application are not used for API requests, however, they can be used to get a limited-time JWT token which can be used with Bearer authorization.
Authorization: Basic <base64-encoded credentials>
GET /account HTTP/1.0
Host: app.tradesync.com
Content-Type: application/json
Authorization: Basic dXNlcm5hbWddU6cGFzc3dvcmQ=
{
"result": "success",
"status": 200,
"meta": {
"count": 3,
"limit": 1000,
"order": "desc",
"last_id": 60
},
"data": [
{
"id": 66,
"..": ".........."
}
]
}
async function getAccounts(){
const response = await fetch("https://api.tradesync.com/accounts/",{
headers: {
'Authorization':'Basic ' + btoa('key:secret')
}
});
const accounts = await response.json();
console.log(accounts);
}
protected function getAccounts()
{
$curl = curl_init();
$curl_options = array(
CURLOPT_URL => 'https://api.tradesync.com/accounts',
CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
CURLOPT_USERPWD => 'key:secret'
);
curl_setopt_array($curl, $curl_options);
$result = curl_exec($curl);
dd($result);
}
Sign up to our newsletter to keep up-to-date.