JustSERPDocs

Authentication

Authenticate JustSERP API requests with your API key in the X-API-Key header, as an Authorization Bearer token or as the apikey query parameter, and see the 401 and 403 responses.

Every request needs your API key. Send it in one of two headers; both carry the same key.

The X-API-Key header

curl -G "https://api.justserp.com/v1/google/search" \
  -H "X-API-Key: YOUR_API_KEY" \
  --data-urlencode "q=coffee" \
  --data-urlencode "hl=en" \
  --data-urlencode "gl=us"

The Authorization: Bearer header

curl -G "https://api.justserp.com/v1/google/search" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "q=coffee" \
  --data-urlencode "hl=en" \
  --data-urlencode "gl=us"

The apikey query parameter

The key can also go in the query string:

curl "https://api.justserp.com/v1/google/search?q=coffee&hl=en&gl=us&apikey=YOUR_API_KEY"

A URL can end up in logs and browser history, so use a header when you can.

Keep the key private

Never put your key in code that runs in a browser: anyone can read it there. Call the API from your server.

When the key is missing or wrong

A request with no key answers 401:

{ "error": "API key required" }

A key that is not valid answers 403, as does a key whose call quota is used up (API call quota exceeded). Neither is charged. Do not retry with the same key: check that the header is present and the key is correct. See Errors & billing for every status code.

The one endpoint that needs no key is GET /v1/snapshots/{snapshot_id}: a snapshot's id is its own credential.

On this page