SERP API
Query structured Google results with localization, device, browser, pagination, safe-search, and unified search-type controls.
Endpoint
GET https://api.goanyapi.com/api/v1/serpWith the current configuration, each successful request costs 2 credits.
Authentication
Authorization: Bearer YOUR_API_KEYRequest Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
q | string | Yes | Search query, up to 200 characters |
gl | string | No | Two-letter search country code, such as us or gb |
hl | string | No | Two-letter result language code, such as en or zh |
start | integer | No | Result offset from 0 to 990; use 10 for the second page |
device | string | No | desktop, mobile, ios, iphone, ipad, ios_tablet, android, or android_tablet |
browser | string | No | chrome, safari, or firefox; Firefox requires a desktop device |
safe | string | No | Safe Search mode: active or off |
search_type | string | No | web (default), news, videos, local, places, shopping, short_videos, or jobs |
search_type is the single public control for Google result categories. The API performs the required parameter mapping, so clients do not need to know Google-specific parameters. Google deprecated num; use start for pagination. Unlisted parameters are rejected with invalid_params.
Example
GET /api/v1/serp?q=ai%20image&gl=us&hl=en&search_type=web&device=desktop&browser=chrome&safe=off
Authorization: Bearer YOUR_API_KEYSuccessful Response
This example is based on the ai image response in the project demo. Arrays and long URLs are shortened, and Base64 image bodies are marked as omitted.
{
"code": "ok",
"message": "ok",
"data": {
"endpoint": "serp",
"remainingCredits": 1035,
"query": {
"q": "ai image",
"gl": "us",
"hl": "en",
"search_type": "web",
"device": "desktop",
"browser": "chrome",
"safe": "off"
},
"result": {
"general": {
"search_engine": "google",
"query": "ai image",
"detected_query": "ai image",
"results_cnt": 134,
"search_time": 0.19,
"language": "en",
"country_code": "US",
"location": "United States",
"gl": "US",
"mobile": false,
"basic_view": false,
"search_type": "text",
"page_title": "ai image - Google Search",
"timestamp": "2026-08-18T09:06:26.895Z"
},
"input": {
"original_url": "https://www.google.com/search?q=ai+image",
"request_id": "hl_ff4e75aa_80fd5475533"
},
"navigation": [
{
"title": "Images",
"href": "https://www.google.com/search?q=ai+image&..."
}
],
"organic": [
{
"link": "https://felo.ai/tools/ai-image",
"source": "Felo",
"display_link": "https://felo.ai › tools › ai-image",
"title": "Free AI Image Generator - Text to Image | Felo AI",
"description": "Felo AI Image generates stunning photos, illustrations, and art in 30 seconds.",
"snippet_highlighted_words": ["Felo AI Image"],
"extensions": [
{
"type": "rating",
"rating": 4.9,
"reviews_cnt": 1709394,
"rank": 2
}
],
"icon": "data:image/jpeg;base64,[omitted]",
"rank": 5,
"global_rank": 11
}
],
"images": [
{
"link": "https://ai.plainenglish.io/ai-image-generation-shocking-insights-99-dont-know-37948a8a02b0",
"source": "Artificial Intelligence in Plain English",
"source_logo": "data:image/png;base64,[omitted]",
"image": "data:image/jpeg;base64,[omitted]",
"image_alt": "AI Image Generation — SHOCKING Insights",
"image_base64": "data:image/jpeg;base64,[omitted]",
"rank": 1,
"global_rank": 5
}
],
"pagination": {
"pages": [
{
"page": 2,
"start": 10,
"link": "https://www.google.com/search?q=ai+image&start=10"
}
],
"current_page": 1,
"next_page": 2,
"next_page_start": 10,
"next_page_link": "https://www.google.com/search?q=ai+image&start=10"
},
"related": [
{
"text": "AI image generator free",
"link": "https://www.google.com/search?q=AI+image+generator+free",
"rank": 1,
"global_rank": 16
}
]
}
}
}Response Fields
Google returns different result modules for different queries. Treat fields and arrays under data.result as optional unless your integration has verified that a module is consistently present.
Response Envelope
| Field | Type | Description |
|---|---|---|
code | string | ok when the request succeeds |
message | string | Request status message |
data.endpoint | string | Fixed value: serp |
data.costCredits | number | Credits charged for this request |
data.remainingCredits | number | Credit balance after the successful request |
data.query | object | Validated public request parameters used by the API |
data.query.q | string | Search query |
data.result | object | Filtered structured Google response |
Result Modules
| Field | Type | Description |
|---|---|---|
data.result.general | object | Search metadata, detected query, locale, result count, and timing |
data.result.input | object | Request trace information |
data.result.navigation | array | Google result-category navigation links |
data.result.organic | array | Organic web results in display order |
data.result.images | array | Image-result cards when an image module is present |
data.result.pagination | object | Current page, next page, and available page links |
data.result.related | array | Related search suggestions |
General and Input
| Field | Type | Description |
|---|---|---|
data.result.general.search_engine | string | Search engine identifier, normally google |
data.result.general.query | string | Query displayed by Google |
data.result.general.detected_query | string | Query detected or normalized by Google |
data.result.general.results_cnt | number | Approximate result count reported by Google |
data.result.general.search_time | number | Search processing time in seconds |
data.result.general.language | string | Result language code |
data.result.general.country_code | string | Resolved two-letter country code |
data.result.general.location | string | Human-readable resolved location |
data.result.general.gl | string | Google country targeting value |
data.result.general.mobile | boolean | Whether Google rendered a mobile result page |
data.result.general.basic_view | boolean | Whether the parser used Google's basic result view |
data.result.general.search_type | string | Detected result page type |
data.result.general.page_title | string | Browser title of the Google result page |
data.result.general.timestamp | string | ISO 8601 timestamp produced by the response |
data.result.input.original_url | string | Requested Google URL |
data.result.input.request_id | string | Request identifier for troubleshooting |
Navigation and Organic Results
| Field | Type | Description |
|---|---|---|
data.result.navigation[].title | string | Navigation label, such as Images or Videos |
data.result.navigation[].href | string | Google URL for that result category |
data.result.organic[].link | string | Destination URL |
data.result.organic[].source | string | Source or publisher name |
data.result.organic[].display_link | string | Breadcrumb-style URL shown in the result |
data.result.organic[].title | string | Result title |
data.result.organic[].description | string | Result snippet |
data.result.organic[].snippet_highlighted_words | array | Snippet fragments highlighted by Google |
data.result.organic[].icon | string | Site icon, commonly returned as a Base64 data URI |
data.result.organic[].rank | number | Position within the organic-results module |
data.result.organic[].global_rank | number | Position among all modules on the result page |
data.result.organic[].extensions | array | Optional badges, ratings, or other result metadata |
data.result.organic[].extensions[].type | string | Extension type, such as text or rating |
data.result.organic[].extensions[].text | string | Text extension value, when present |
data.result.organic[].extensions[].rating | number | Rating value, when present |
data.result.organic[].extensions[].reviews_cnt | number | Review count, when present |
data.result.organic[].extensions[].rank | number | Extension order within the result |
Images, Pagination, and Related Searches
| Field | Type | Description |
|---|---|---|
data.result.images[].link | string | Page that contains the image |
data.result.images[].source | string | Image source or publisher |
data.result.images[].source_logo | string | Source logo, commonly a Base64 data URI |
data.result.images[].image | string | Image URL or data URI |
data.result.images[].image_alt | string | Image alternative text |
data.result.images[].image_base64 | string | Inline Base64 image data when available |
data.result.images[].rank | number | Position within the image module |
data.result.images[].global_rank | number | Position among all modules on the result page |
data.result.pagination.pages | array | Available subsequent page descriptors |
data.result.pagination.pages[].page | number | Human-readable page number |
data.result.pagination.pages[].start | number | start offset required to request that page |
data.result.pagination.pages[].link | string | Google link for that page |
data.result.pagination.current_page | number | Current page number |
data.result.pagination.next_page | number | Next page number |
data.result.pagination.next_page_start | number | start offset for the next page |
data.result.pagination.next_page_link | string | Google link for the next page |
data.result.related[].text | string | Related search text |
data.result.related[].link | string | Google link for the related search |
data.result.related[].rank | number | Position within the related-search module |
data.result.related[].global_rank | number | Position among all modules on the result page |
Response Filtering
The structured JSON is preserved under data.result, except that advertising modules, hotel results, AI Overviews, knowledge panels, and source HTML are recursively removed. Server credentials, internal configuration, and request headers are never returned.
The exact module set is controlled by Google and may change by query, country, language, device, and time. Clients should ignore unknown fields and tolerate documented optional modules being absent.
Billing
The configured SERP credit cost is deducted only after the query returns valid structured JSON. Authentication failures, invalid parameters, failed queries, and invalid JSON responses do not consume credits.