Authentication
All API requests must include your API key in the Authorization header.
Authentication Method
Section titled “Authentication Method”The Prediko API uses Bearer token authentication. Include your API key in every request:
Authorization: Bearer pk_live_YOUR_API_KEYAPI Key Format
Section titled “API Key Format”API keys follow a predictable format:
| Format | Example |
|---|---|
pk_live_* | pk_live_8x9kL2mP4nQ7rS1tU3vW5xY6 |
Creating API Keys
Section titled “Creating API Keys”- Log into your Prediko Dashboard
- Navigate to Settings > API Keys
- Click Create API Key
- Name your key descriptively (e.g., “ERP Integration - Production”)
- Copy and securely store the key
Authentication Examples
Section titled “Authentication Examples”curl -X GET "https://api.prediko.io/api/v1/orders" \ -H "Authorization: Bearer pk_live_YOUR_API_KEY"import requests
headers = { "Authorization": "Bearer pk_live_YOUR_API_KEY"}
response = requests.get( "https://api.prediko.io/api/v1/orders", headers=headers)const headers = { "Authorization": "Bearer pk_live_YOUR_API_KEY"};
const response = await fetch( "https://api.prediko.io/api/v1/orders", { headers });Security Best Practices
Section titled “Security Best Practices”- Store API keys in environment variables
- Rotate keys periodically
- Monitor API key usage in the dashboard
- Commit API keys to version control
- Share keys via email or chat
- Use production keys in client-side code
- Embed keys in mobile apps
Error Responses
Section titled “Error Responses”| Status | Error | Description |
|---|---|---|
| 401 | Missing Authorization header | No API key provided |
| 401 | Invalid API key format | Key doesn’t match expected format |
| 401 | Invalid or expired API key | Key not found or has been revoked |
Example error response:
{ "detail": "Invalid or expired API key"}