Authentication
How to authenticate API requests.
All /v1/ data endpoints require an API key. Get one at
madjik.io/pricing — after checkout your key is
provisioned automatically and sent to your inbox.
Using your key
Send it in the X-API-Key header (preferred) or as a bearer token — both work:
curl -H "X-API-Key: YOUR_API_KEY" "https://api.madjik.io/v1/metrics/M10004"
curl -H "Authorization: Bearer YOUR_API_KEY" "https://api.madjik.io/v1/metrics/M10004"
Python
import requests
BASE = "https://api.madjik.io/v1"
headers = {"X-API-Key": "YOUR_API_KEY"}
r = requests.get(f"{BASE}/metrics/M10004", headers=headers)
r.raise_for_status()
print(r.json())
JavaScript
const r = await fetch("https://api.madjik.io/v1/metrics/M10004", {
headers: { "X-API-Key": "YOUR_API_KEY" }
});
const data = await r.json();
Error responses
| Code | Meaning | Example detail |
|---|---|---|
401 | Missing or invalid key | API key required. Provide via X-API-Key header or Authorization: Bearer <key> |
403 | Subscription inactive, trial expired, or metric above your tier | Metric M50021 requires enterprise tier or higher |
429 | Rate or usage limit exceeded | Rate limit exceeded. Your plan allows 30 requests per minute. |
Keep your key server-side. Never ship it in client-side code or commit it to a repository.