API Documentation

Everything you need to integrate the SerpBase Google web, images, news, and videos APIs.

Authentication

Pass your API key in the X-API-Key header.

bash
curl -X POST https://api.serpbase.dev/google/search   -H "Content-Type: application/json"   -H "X-API-Key: your_api_key"   -d '{
    "q": "python asyncio",
    "hl": "en",
    "gl": "us",
    "page": 1
  }'
Each successful request consumes 1 credit. Failed dispatches and upstream timeouts are refunded.

Endpoints

POST
/google/search
search

Default Google search results with organic links and rich SERP modules.

POST
/google/images
images

Google Images results with image URLs, thumbnails, and source domains.

POST
/google/news
news

Google News results with publisher, time, snippet, and thumbnail when available.

POST
/google/videos
videos

Google Videos results with source, channel, duration, and thumbnails.

Parameters

qrequired
string
Search query string.
hl
string
Language code, default `en`.
gl
string
Country code, default `us`.
page
number
1-based page number, default `1`.

The same request body is accepted by all four endpoints. The endpoint itself determines the returned result type.

Response Schema

All search endpoints return HTTP 200. Use the status field to determine business success.

statusnumber

Business status code. `0` means success.

search_typestring

Resolved response type: `search`, `images`, `news`, or `videos`.

querystring

Normalized query string from the request.

pagenumber

Current page number.

session_idstring

Worker session identifier used to serve the request.

elapsed_msnumber

Total request duration in milliseconds.

organicOrganicResult[]?

Web-only organic results.

imagesImageResult[]?

Image search results.

newsNewsResult[]?

News search results.

videosVideoResult[]?

Video search results.

top_storiesTopStory[]?

Top stories module on web SERPs.

people_also_askPAA[]?

People Also Ask data on web SERPs.

knowledge_graphKnowledgeGraph?

Knowledge panel data on web SERPs.

related_searchesstring[]?

Related searches on web SERPs.

Examples

Web Search Request

bash
curl -X POST https://api.serpbase.dev/google/search   -H "Content-Type: application/json"   -H "X-API-Key: your_api_key"   -d '{
    "q": "python asyncio",
    "hl": "en",
    "gl": "us",
    "page": 1
  }'

Web Search Response

json
{
  "status": 0,
  "search_type": "search",
  "query": "python asyncio",
  "page": 1,
  "organic": [
    {
      "rank": 1,
      "title": "Async IO in Python",
      "link": "https://realpython.com/async-io-python/",
      "display_link": "realpython.com",
      "snippet": "A practical guide to asyncio in Python..."
    }
  ],
  "people_also_ask": [
    {
      "question": "What is asyncio in Python?",
      "answer": "asyncio is Python's asynchronous I/O framework...",
      "title": "asyncio docs",
      "link": "https://docs.python.org/3/library/asyncio.html"
    }
  ],
  "session_id": "7f2e5a8c4b",
  "elapsed_ms": 423
}

Images Request

bash
curl -X POST https://api.serpbase.dev/google/images   -H "Content-Type: application/json"   -H "X-API-Key: your_api_key"   -d '{"q":"iphone 15 pro blue","hl":"en","gl":"us","page":1}'

Images Response

json
{
  "status": 0,
  "search_type": "images",
  "query": "iphone 15 pro blue",
  "page": 1,
  "images": [
    {
      "title": "iPhone 15 Pro blue",
      "link": "https://store.example.com/iphone-15-pro-blue",
      "image_url": "https://img.example.com/iphone-blue.jpg",
      "thumbnail_url": "https://img.example.com/iphone-blue-thumb.jpg",
      "source": "Store Example",
      "domain": "store.example.com"
    }
  ],
  "session_id": "7f2e5a8c4b",
  "elapsed_ms": 388
}

News Response

json
{
  "status": 0,
  "search_type": "news",
  "query": "apple event",
  "page": 1,
  "news": [
    {
      "title": "Apple announces new chips at spring event",
      "link": "https://www.theverge.com/apple-launch-event",
      "source": "The Verge",
      "time": "Apr 9, 2026",
      "snippet": "Apple used the event to introduce faster laptop and desktop silicon.",
      "thumbnail_url": "https://cdn.theverge.com/apple-event.jpg"
    }
  ],
  "session_id": "7f2e5a8c4b",
  "elapsed_ms": 401
}

Videos Response

json
{
  "status": 0,
  "search_type": "videos",
  "query": "python asyncio tutorial",
  "page": 1,
  "videos": [
    {
      "title": "Python asyncio tutorial for beginners",
      "link": "https://www.youtube.com/watch?v=abc123",
      "source": "Corey Schafer",
      "duration": "23:45",
      "time": "1 week ago",
      "thumbnail_url": "https://i.ytimg.com/vi/abc123/hqdefault.jpg"
    }
  ],
  "session_id": "7f2e5a8c4b",
  "elapsed_ms": 417
}

JavaScript / Node.js

javascript
const response = await fetch("https://api.serpbase.dev/google/news", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "X-API-Key": "your_api_key",
  },
  body: JSON.stringify({ q: "apple event", gl: "us", hl: "en", page: 1 }),
});

const data = await response.json();
if (data.status !== 0) throw new Error(data.error || "search failed");
for (const item of data.news ?? []) {
  console.log(item.source, item.title);
}

Status Codes

0
SUCCESS
Request completed successfully.
1000
INVALID_REQUEST
Missing or invalid request body or parameters.
1001
UNAUTHORIZED
Missing, invalid, or revoked API key.
1020
INSUFFICIENT_CREDITS
Account balance is not enough to run the request.
1029
RATE_LIMITED
Account QPS or concurrency limit exceeded.
1502
UPSTREAM_FAILED
Worker returned an upstream parsing or fetch error.
1503
SERVICE_UNAVAILABLE
No worker session is currently available.
1504
UPSTREAM_TIMEOUT
Gateway timed out while waiting for a worker result.
1500
INTERNAL_ERROR
Unexpected internal server error.