Setting up your account
Don't have credentials yet? Reach out to support@pleevi.ai!
Fetching an access token
To obtain an API access token, you need to send your client_id and client_secret to
POST https://api.pleevi.ai/v1/identity/client-login
Headers
Basic authentication header containing your client_id:client_secret base64 encoded.
The request must include the following parameters in the body using the application/x-www-form-urlencoded format with UTF-8 encoding:
Request Body
Possible values: [client_credentials]
Request Example
Response
On successful authentication, the response will contain an OAuth2 access token.
{
"access_token": "your_access_token",
"expires_in": 3600,
"type": "bearer"
}
Make sure to securely store your client_id and client_secret, and never expose them in your client-side code.
For any issues or further assistance, feel free to contact us at support@pleevi.ai.
Authenticating
All of our endpoints require this access_token. It should be included in the Authorization header in the Bearer format
For example, to retrieve a site (see later):
- cURL
- Python
- JavaScript
curl -X 'GET' \
'https://api.pleevi.ai/v1/sites/<SITE_ID>' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <YOUR_ACCESS_TOKEN>'
import requests
url = "https://api.pleevi.ai/v1/sites/<SITE_ID>"
headers = {
"accept": "application/json",
"Content-Type": "application/json",
"Authorization": "Bearer <YOUR_ACCESS_TOKEN>"
}
response = requests.get(url, headers=headers)
print(response.json()) # Print the response
const axios = require("axios");
const url = "https://api.pleevi.ai/v1/sites/<SITE_ID>";
const headers = {
accept: "application/json",
"Content-Type": "application/json",
Authorization: "Bearer <YOUR_ACCESS_TOKEN>",
};
axios
.get(url, { headers })
.then((response) => console.log(response.data))
.catch((error) => console.error(error.response?.data || error.message));