Authentication
How to authenticate BestSERP requests: send your API key in the X-API-KEY header or as a Bearer token, keep it secret, and revoke a leaked key.
Updated View as Markdown
Every request to the API needs a key. Send it in the X-API-KEY header:
curl -X POST 'https://api.bestserp.com/search' \
-H 'X-API-KEY: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"q":"coffee"}'Authorization: Bearer YOUR_API_KEY works too. Keys in the URL (?api_key=) are refused: URLs end up in logs, proxies and browser history.
Keys
- Create, name and revoke keys in Dashboard > API keys. A key is shown once; we store only a hash.
- All keys of an account share its credits and its rate limit.
- If a key leaks, revoke it: requests with it fail at once with
401 invalid_api_key. - Call the API from your server, never from a browser or mobile app where the key would be visible.
Errors
| Status | Code | Meaning |
|---|---|---|
| 401 | missing_api_key |
No key in the request. |
| 401 | invalid_api_key |
The key is wrong or revoked. |
| 403 | account_suspended |
The account is suspended. |
The full list is on the errors page.