API Documentation

SERP API

Query structured Google results with localization, device, browser, pagination, safe-search, and unified search-type controls.

Test API

Endpoint

GET https://api.goanyapi.com/api/v1/serp

With the current configuration, each successful request costs 2 credits.

Authentication

Authorization: Bearer YOUR_API_KEY

Request Parameters

ParameterTypeRequiredDescription
qstringYesSearch query, up to 200 characters
glstringNoTwo-letter search country code, such as us or gb
hlstringNoTwo-letter result language code, such as en or zh
startintegerNoResult offset from 0 to 990; use 10 for the second page
devicestringNodesktop, mobile, ios, iphone, ipad, ios_tablet, android, or android_tablet
browserstringNochrome, safari, or firefox; Firefox requires a desktop device
safestringNoSafe Search mode: active or off
search_typestringNoweb (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_KEY

Successful 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

FieldTypeDescription
codestringok when the request succeeds
messagestringRequest status message
data.endpointstringFixed value: serp
data.costCreditsnumberCredits charged for this request
data.remainingCreditsnumberCredit balance after the successful request
data.queryobjectValidated public request parameters used by the API
data.query.qstringSearch query
data.resultobjectFiltered structured Google response

Result Modules

FieldTypeDescription
data.result.generalobjectSearch metadata, detected query, locale, result count, and timing
data.result.inputobjectRequest trace information
data.result.navigationarrayGoogle result-category navigation links
data.result.organicarrayOrganic web results in display order
data.result.imagesarrayImage-result cards when an image module is present
data.result.paginationobjectCurrent page, next page, and available page links
data.result.relatedarrayRelated search suggestions

General and Input

FieldTypeDescription
data.result.general.search_enginestringSearch engine identifier, normally google
data.result.general.querystringQuery displayed by Google
data.result.general.detected_querystringQuery detected or normalized by Google
data.result.general.results_cntnumberApproximate result count reported by Google
data.result.general.search_timenumberSearch processing time in seconds
data.result.general.languagestringResult language code
data.result.general.country_codestringResolved two-letter country code
data.result.general.locationstringHuman-readable resolved location
data.result.general.glstringGoogle country targeting value
data.result.general.mobilebooleanWhether Google rendered a mobile result page
data.result.general.basic_viewbooleanWhether the parser used Google's basic result view
data.result.general.search_typestringDetected result page type
data.result.general.page_titlestringBrowser title of the Google result page
data.result.general.timestampstringISO 8601 timestamp produced by the response
data.result.input.original_urlstringRequested Google URL
data.result.input.request_idstringRequest identifier for troubleshooting
FieldTypeDescription
data.result.navigation[].titlestringNavigation label, such as Images or Videos
data.result.navigation[].hrefstringGoogle URL for that result category
data.result.organic[].linkstringDestination URL
data.result.organic[].sourcestringSource or publisher name
data.result.organic[].display_linkstringBreadcrumb-style URL shown in the result
data.result.organic[].titlestringResult title
data.result.organic[].descriptionstringResult snippet
data.result.organic[].snippet_highlighted_wordsarraySnippet fragments highlighted by Google
data.result.organic[].iconstringSite icon, commonly returned as a Base64 data URI
data.result.organic[].ranknumberPosition within the organic-results module
data.result.organic[].global_ranknumberPosition among all modules on the result page
data.result.organic[].extensionsarrayOptional badges, ratings, or other result metadata
data.result.organic[].extensions[].typestringExtension type, such as text or rating
data.result.organic[].extensions[].textstringText extension value, when present
data.result.organic[].extensions[].ratingnumberRating value, when present
data.result.organic[].extensions[].reviews_cntnumberReview count, when present
data.result.organic[].extensions[].ranknumberExtension order within the result
FieldTypeDescription
data.result.images[].linkstringPage that contains the image
data.result.images[].sourcestringImage source or publisher
data.result.images[].source_logostringSource logo, commonly a Base64 data URI
data.result.images[].imagestringImage URL or data URI
data.result.images[].image_altstringImage alternative text
data.result.images[].image_base64stringInline Base64 image data when available
data.result.images[].ranknumberPosition within the image module
data.result.images[].global_ranknumberPosition among all modules on the result page
data.result.pagination.pagesarrayAvailable subsequent page descriptors
data.result.pagination.pages[].pagenumberHuman-readable page number
data.result.pagination.pages[].startnumberstart offset required to request that page
data.result.pagination.pages[].linkstringGoogle link for that page
data.result.pagination.current_pagenumberCurrent page number
data.result.pagination.next_pagenumberNext page number
data.result.pagination.next_page_startnumberstart offset for the next page
data.result.pagination.next_page_linkstringGoogle link for the next page
data.result.related[].textstringRelated search text
data.result.related[].linkstringGoogle link for the related search
data.result.related[].ranknumberPosition within the related-search module
data.result.related[].global_ranknumberPosition 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.