Get an Access Token

To access the Clazar platform's APIs, you need to retrieve an access token. The access token serves as a secure authorization mechanism to authenticate your application's requests.

Prerequisites

Before retrieving an access token, ensure that you have completed the following prerequisites:

  1. Created API credentials by following the steps outlined in the "Create API Credentials" section.
  2. Have the necessary Client ID and Client Secret available for authentication.

Steps to Retrieve an Access Token

To retrieve an access token, please follow these steps:

  1. Make a POST request to the Clazar Authentication API endpoint https://api.clazar.io/authenticate/ with the required parameters.
  2. Include the Client ID and Client Secret in the request body.
curl -X POST "https://api.clazar.io/authenticate/" \
  -H "Content-Type: application/json" \
  -d '{
    "client_id": "<your_client_id>",
    "client_secret": "<your_client_secret>"
  }'
import axios from "axios";

const options = {
  method: 'POST',
  url: 'https://api.clazar.io/authenticate/',
  headers: {'Content-Type': 'application/json'},
  data: {client_id: '<your_client_id>', client_secret: '<your_client_secret>'}
};

axios.request(options).then(function (response) {
  console.log(response.data);
}).catch(function (error) {
  console.error(error);
});
import requests

url = "https://api.clazar.io/authenticate/"

payload = {
    "client_id": "<your_client_id>",
    "client_secret": "your_client_secret"
}
headers = {
    "Content-Type": "application/json"
}

response = requests.request("POST", url, json=payload, headers=headers)

print(response.json())

Replace <your_client_id> and <your_client_secret> with your actual Client ID and Client Secret values.

  1. Upon successful authentication, the API will respond with an access token.
{
    "access_token": "access_token",
    "token_type": "bearer",
    "expires_in": 86400
}
  1. Store the access token securely for subsequent API requests.

Using the Access Token

Once you have retrieved the access token, you can use it to authorize your API requests. Include the access token in the Authorization header of your API requests as a bearer token.

Authorization: Bearer <access_token>

Replace <access_token> with the actual access token obtained in the previous step.