Authentication
Every request carries a key in the Authorization header. Here is how to send, scope and rotate one.
Sending the key
Send the key as a bearer token. Requests without one get 401 with the code missing_key.
curl https://api.warraq.dev/v1/collections \
-H "Authorization: Bearer wq_live_3f9a7c21"
const res = await fetch('https://api.warraq.dev/v1/collections', {
headers: { Authorization: `Bearer ${process.env.WARRAQ_KEY}` }
});
const body = await res.json();
import os, requests
res = requests.get(
"https://api.warraq.dev/v1/collections",
headers={"Authorization": f"Bearer {os.environ['WARRAQ_KEY']}"},
)
body = res.json()
Scopes
readlists and fetches records.writeadds scans and edits records.adminmanages keys and webhooks.
Rotating a key
Create the new key first, deploy it, then revoke the old one. Both work in the meantime, so nothing fails while you switch.