Authentication
Every request carries an API key. There are no sessions, cookies or OAuth flows.
Sending the key
Send the key as a bearer token. This is the preferred form.
curl "https://api.handlesapi.com/v1/directory/x/nasa" \
-H "Authorization: Bearer $HANDLES_API_KEY"const res = await fetch("https://api.handlesapi.com/v1/directory/x/nasa", {
headers: { Authorization: `Bearer ${process.env.HANDLES_API_KEY}` },
});import os
import requests
res = requests.get(
"https://api.handlesapi.com/v1/directory/x/nasa",
headers={"Authorization": f"Bearer {os.environ['HANDLES_API_KEY']}"},
)If your HTTP client makes custom headers easier than the Authorization header, send it as x-api-key instead. The two are equivalent.
curl
curl "https://api.handlesapi.com/v1/directory/x/nasa" \
-H "x-api-key: $HANDLES_API_KEY"A missing, unknown, revoked or expired key returns 401 unauthorized in the error envelope.
Keys
Create and revoke keys in the dashboard. Live keys start with hk_live_; test keys start with hk_test_.
Scopes
A key is limited to the scopes it was created with. Each endpoint names the scope it needs. Calling an endpoint outside your key's scopes is refused with a 403 that names the missing scope.
| Scope | Endpoint groups |
|---|---|
| directory:read | Accounts, Directory, People, Trends, Identity |
| scrape:live | X, Live scrape, Verify |
| insights:read | Insights, Graph |
| research:read | Research |
| tools:use | Tools |
| leads:read | Leads |
Keys are not granted the scrape:live, leads:read and tools:use scopes by default; they are sensitive, and calls with them are audited.
Keeping keys safe
A key is a server-to-server credential
Never put it in front-end code, a mobile app or a public repository. Anyone who opens devtools can read it, and it spends your credits.- Keep keys in environment variables or a secrets manager, never in source control.
- Call the API from your backend and pass only the result to the browser.
- If a key leaks, revoke it in the dashboard right away and create a new one.