Authentication
Every call carries your API key in the X-API-Key header.
The X-API-Key header
Send your key in the X-API-Key header on every request. Never send it over plain HTTP, and keep it secret.
Authenticated request
cURL
curl "https://api.central.pranisheba.com.bd/cows" \
-H "X-API-Key: YOUR_API_KEY"
Python
import requests
response = requests.get(
"https://api.central.pranisheba.com.bd/cows",
headers={"X-API-Key": "YOUR_API_KEY"},
timeout=(10, 180),
)
JavaScript
const response = await fetch("https://api.central.pranisheba.com.bd/cows", {
headers: { "X-API-Key": "YOUR_API_KEY" },
});
Live and sandbox keys
| Key | Looks like | What it does |
|---|---|---|
| Live | psk_ then 8 letters, then 32 more | Calls the identification model and uses tokens. |
| Sandbox | psk_test_ then 8 letters, then 32 more | Returns sample answers. Uses no tokens and is never logged. |
Creating and revoking keys
- Create keys on the API access page of your dashboard. The full key is shown once, so copy it then.
- You can have up to 5 active live keys and 5 active sandbox keys. Live keys need an approved account; sandbox keys do not.
- Revoke a key you no longer use, or one that leaked, on the same page and create a new one.
When authentication fails
No key sent (401)
Response body.
{
"is_success": false,
"message": "Missing API key.",
"data": null
}
Key not recognised or revoked (403)
Response body.
{
"is_success": false,
"message": "Invalid API key.",
"data": null
}
| Status | Meaning |
|---|---|
| 401 | The X-API-Key header is missing. |
| 403 | The API key is invalid or revoked, or your account is suspended. |