SerpBase
Back to Blog

SERP API Key: How to Get One, Send It and Check It

Get a SERP API key with 500 free credits, send it in the X-API-Key header, and check it with a free balance call. Includes the exact errors a missing or wrong key returns.

November 28, 2026
By SerpBase Team3 min read

Short answer: create a free account, copy the key from the API keys page of the dashboard, and send it in the X-API-Key header of every request. The account comes with 500 free credits and needs no card, so the key works straight away.

Getting the key

  1. Sign up at serpbase.dev/register.
  2. Open the API keys page in the dashboard and create a key. You can create several, name them, and revoke one without touching the others.
  3. Put it in the X-API-Key header.
curl -X POST 'https://api.serpbase.dev/google/search' \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -d '{"q":"coffee","gl":"us","hl":"en"}'

The same key works on every endpoint: Google search, images, news, maps, YouTube, Amazon and the rest.

What a wrong key looks like

We ran these on 28 November 2026. All three answered HTTP 200 with a non-zero status, credits_charged 0 and the response header X-SerpBase-Retryable: false.

What we sentstatuserror
No key at all1001no API key presented; pass it in the X-API-Key header
A made-up key in the header1001invalid API key
A key in the URL (?api_key=...) and no header1001no API key presented; pass it in the X-API-Key header

The third row is the one people hit when moving from another provider: on the standard endpoints a key in the query string is not read at all. That is deliberate. Addresses end up in server logs, browser history and proxy logs; headers do not.

Check the key and the balance in one call

curl 'https://api.serpbase.dev/account/credits' \
  -H 'X-API-Key: YOUR_API_KEY'

This costs 0 credits. In our test the answer had status 0 and four balance fields:

FieldWhat it holds
creditsTotal credits you can spend now
permanent_creditsCredits that do not expire on a date
expiring_creditsLimited-time credits
expiring_expires_atUnix time when those expire; 0 when there are none

Python: fail early on a bad key

import os, requests

API = "https://api.serpbase.dev"
HEADERS = {"X-API-Key": os.environ["SERPBASE_API_KEY"]}

me = requests.get(API + "/account/credits", headers=HEADERS, timeout=30).json()
if me["status"] != 0:
    raise SystemExit("key problem: " + me.get("error", "unknown"))
print("credits left:", me["credits"])

r = requests.post(
    API + "/google/search",
    headers=HEADERS,
    json={"q": "coffee", "gl": "us", "hl": "en"},
    timeout=60,
).json()
if r["status"] == 0:
    print(r["organic"][0]["title"])
else:
    print("search failed:", r["status"], r.get("error"))

Things that trip people up

  • An HTTP 200 is not a success. Every row in the table above was a 200. Read status: 0 is success, 1001 is a key problem, 1020 is an empty balance.
  • Do not retry a 1001. The X-SerpBase-Retryable: false header says the request itself has to change.
  • Keep the key out of code. Read it from an environment variable, as the script does, and never commit it. If a key leaks, revoke it in the dashboard and create another.
  • Do not call the API from a web page. Anyone can read a key shipped to the browser. Call from your server and pass the results on.
  • More keys do not mean more speed. All keys on an account share one requests-per-second limit.
  • The balance endpoint has its own limit. The docs put it at 60 requests a minute per account. Check before a batch, not before every search.

What the free credits cover

A Google search is 1 credit, so 500 credits is 500 searches. More on what you get before paying is in Is there a free Google search API?

Cost and limits

After the free credits, credits cost $0.25–$0.50 per 1,000 depending on the plan. Failed requests are not charged.