Get started
Authentication
Every request carries an API key in a bearer header.
API keys#
Authorization: Bearer lb_key_your_api_key_here
Keep keys on the server. Anyone holding a key can spend your credits.
Example requests#
curl -X POST https://api.lexbharat.example/api/v1/us/statutes/search \
-H "Authorization: Bearer lb_key_..." \
-H "Content-Type: application/json" \
-d '{ "query": "fair use" }'
import requests
r = requests.post(
"https://api.lexbharat.example/api/v1/us/statutes/search",
headers={"Authorization": "Bearer lb_key_..."},
json={"query": "fair use"},
)
print(r.json())
const r = await fetch("https://api.lexbharat.example/api/v1/us/statutes/search", {
method: "POST",
headers: { Authorization: "Bearer lb_key_...", "Content-Type": "application/json" },
body: JSON.stringify({ query: "fair use" }),
});
Error codes#
| Status | Meaning |
|---|---|
| 401 | Missing or invalid key |
| 402 | Out of credits |
| 429 | Rate limit exceeded; honour Retry-After |
How many keys you can hold#
Each plan allows a fixed number of keys: for example one live and one test key on a smaller plan. Create a second key before revoking the first.
Rotating a key#
Create a new key, deploy it, confirm traffic is using it, then revoke the old one.
Last modified on October 20, 2026
Was this page helpful?