Authenticate

post
Authenticate

https://api.sandbox.co.in/authenticate
The API User Credentials authorization flow consists of exchanging an API key and API secret for an access token, which is to be provided when making calls to the Sandbox API. This type of authorization is used for the application to access resources about itself rather than another user.
Request
Response
Request
Headers
x-api-key
required
string
Public key required to authorize API access
x-api-secret
required
string
Private key required to authenticate API access.
x-api-version
optional
string
Response
200: OK
An access token is obtained and valid for 24 hours
{
"access_token": "eyJhbGciOiJIUzUxMiJ9.eyJhdWQiOiJBUEkiLCJyZWZyZXNoX3Rva2VuIjoiZXlKaGJHY2lPaUpJVXpVeE1pSjkuZXlKaGRXUWlPaUpCVUVraUxDSnpkV0lpT2lKclpYbGZiR2wyWlY5QlpHVXFLaW9xS2lvcUtpb3FLaW9xS2lvcUtpb3FLaW9xS2lvcUtsVjRjeUlzSW1Gd2FWOXJaWGtpT2lKclpYbGZiR2wyWlY5QlpHVXFLaW9xS2lvcUtpb3FLaW9xS2lvcUtpb3FLaW9xS2lvcUtsVjRjeUlzSW1semN5STZJbUZ3YVM1eGRXbGphMjh1WTI5dElpd2laWGh3SWpveE5Ua3dPVFk1TmpBd0xDSnBiblJsYm5RaU9pSlNSVVpTUlZOSVgxUlBTMFZPSWl3aWFXRjBJam94TlRVNU16UTNNakF3ZlEueHNmYkhQTERFRlRvTy1OUWdaUUpLM25OUjFxdlhvWmhaOHRqS3gzSExydjZiVkJaMHpJZEZ5ai1MUTg1YnJZS0xXQnFnZHlzZ1NDSXlDUXNtV2VOYkEiLCJzdWIiOiJqb2huQGRvZS5jb20iLCJhcGlfa2V5Ijoia2V5X2xpdmVfQWRlKioqKioqKioqKioqKioqKioqKioqKioqKipVeHMiLCJpc3MiOiJhcGkucXVpY2tvLmNvbSIsImV4cCI6MTU5MTA1NjAwMCwiaW50ZW50IjoiQUNDRVNTX1RPS0VOIiwiaWF0IjoxNTkwOTY5NjAwfQ.nH23CR5RHGQ0U19I_vq3vyJ_85A1a2iEMQij5QHgJQdDuS9x7FmTidsr1CQabSFF5ujE40SFxHv1gJM20TauUw"
}
403: Forbidden
Error is thrown when the API key has expired
{
"code": 403
"message": "Bad Credentials"
}Y

You can find your API key and API secret from your API dashboard, click the below link to see how!

Example Request

cURL
Java
Node.js
Python
cURL
curl --location --request POST 'https://api.sandbox.co.in/authenticate' \
--header 'x-api-key: key_live_Ade**************************Uxs' \
--header 'x-api-secret: secret_live_Ade**************************Uxs' \
--header 'x-api-version: 3.4.0'
Java
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://api.sandbox.co.in/authenticate")
.header("x-api-key", "key_live_Ade**************************Uxs")
.header("x-api-secret", "secret_live_Ade**************************Uxs")
.header("x-api-version", "3.4.0")
.asString();
Node.js
var https = require('follow-redirects').https;
var fs = require('fs');
var options = {
'method': 'POST',
'hostname': 'api.sandbox.co.in',
'path': '/authenticate',
'headers': {
'x-api-key': 'key_live_Ade**************************Uxs',
'x-api-secret': 'secret_live_Ade**************************Uxs',
'x-api-version': '3.4.0'
},
'maxRedirects': 20
};
var req = https.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
req.end();
Python
import requests
url = "https://api.sandbox.co.in/authenticate"
payload = {}
headers = {
'x-api-key': 'key_live_Ade**************************Uxs',
'x-api-secret': 'secret_live_Ade**************************Uxs',
'x-api-version': '3.4.0'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))