Search results

The top 10 organic results for one search, with a receipt recording the search URL, fetch time and a hash of the results.
POST/v1/serp
Open as Markdown
On this page

Price

Pricerequest
Live
$0.00054

Per search that returned results.

Description

One search, run inline. For locations, maps, more depth or queued tasks, use the SERP API routes.

Billing. $0.00054 per search that returned results. A search that fails or returns nothing costs $0.

Request

Endpoint
POST https://api.dataforgaio.com/v1/serp
Authentication
HTTP Basic auth: any login, with your dg_ API key as the password. A Bearer header with the key also works. Create a key.
Body
JSON object

Fields

  • keywordstringrequired
    The search, up to 700 characters. query and q are accepted too.
    Max700Exampletrail running shoes boulder
  • search_enginestringoptional
    Search engine.
    DefaultgoogleOne ofgooglebingExamplegoogle
  • countrystringoptional
    Two-letter country to search from.
    ExampleUS
  • languagestringoptional
    Language code, for example en or en-US.
    Exampleen
  • devicestringoptional
    Device type.
    DefaultdesktopOne ofdesktopmobileExampledesktop
  • include_receiptbooleanoptional
    Include the receipt.
    DefaulttrueExampletrue
  • project_idstring|nulloptional
    A project in your organization to file this under.
  • auto_upgradebooleanoptional
    When the included route returns nothing, retry on the live route (billed at the same price). false stops at the included route and the search fails at $0.
    DefaulttrueExampletrue
  • max_costnumber|nulloptional
    The most this search may cost, USD. Below the search price, nothing runs (422 max_cost_exceeded). The charge never exceeds it.
  • max_ageinteger|nulloptional
    Accept a cached result up to this many seconds old (0 to 86400). Default: always fetch fresh.
    Min0Max86400

Response

Shape: Native. Expand a field to see its children; every field has a link anchor.

  • statusstring
    Always ok for a 2xx response.
    Exampleok
  • costnumber
    What the search was charged, USD.
    Example0.00054
  • Always 1.
    Example1
  • 1 when the search failed.
    Example0
  • tasksarray<object>
    The search.
    Show 36 child fields
    • idstring
      Search id, sr_….
      Examplesr_8cbb5b5c8e155c82995945f93cdad009
    • statusstring
      completed or failed.
      One ofcompletedfailedprocessingExamplecompleted
    • 200, or 502/503 when it failed.
      Example200
    • Plain-language status.
      ExampleOk.
    • costnumber
      Charged, USD.
      Example0.00054
    • contentobject
      The results. Present when completed.
      Show 12 child fields
      • querystring
        The search.
        Exampletrail running shoes boulder
      • Search engine.
        Examplegoogle
      • countrystring|null
        Country, lowercase.
        Exampleus
      • languagestring|null
        Language.
        Exampleen
      • devicestring
        Device.
        Exampledesktop
      • Entries in organic.
        Example2
      • organicarray<object>
        Organic results in rank order.
        Show 5 child fields
        • positioninteger
          Rank, starting at 1.
          Example1
        • titlestring
          Result title.
          ExampleTrail running shoes | Summit Running Co.
        • urlstring
          Result URL.
          Examplehttps://summitrunning.example/trail-shoes
        • domainstring
          Result domain.
          Examplesummitrunning.example
        • snippetstring
          Result snippet.
          ExampleEvery trail shoe we stock, fitted after a free gait analysis.
    • errorobject
      Present when failed.
      Show 2 child fields
    • receiptobject
      Provenance and cost. Present unless include_receipt is false.
      Show 14 child fields
      • Receipt id, rc_….
        Examplerc_8cbb5b5c8e155c82995945f93cdad009
      • source_urlstring|null
        The public search URL the results correspond to.
        Examplehttps://www.google.com/search?q=trail+running+shoes+boulder&num=10&gl=us&hl=en
      • fetched_atstring|null
        When the results were fetched, ISO 8601 UTC.
        Example2026-12-03T10:42:18Z
      • http_statusinteger|null
        HTTP status of the search.
        Example200
      • content_sha256string|null
        SHA-256 of the results we returned.
        Exampleb085e457d70d4053268da555d16037247e5d54ee16e182e7fca462347c269520
      • Always null for a search.
      • Always null for a search.
      • Always null for a search.
      • Always serp_api.
        Exampleserp_api
      • cache_hitboolean
        True when a cached result (within max_age) answered.
        Examplefalse
      • upgradedboolean
        True when the live route answered after the included route didn't.
        Examplefalse
      • unit_cost_usdnumber|null
        Charged, USD.
        Example0.00054
      • billed_usdnumber|null
        Same as unit_cost_usd.
        Example0.00054
      • currencystring
        Always USD.
        ExampleUSD

Errors

CodeWhen
invalid_requestHTTP 400. The body failed validation. error.details maps each field to its problem.
unauthorizedHTTP 401. Missing, malformed or revoked API key.
balance_requiredHTTP 402. Your wallet balance is below the most this request could cost. Nothing ran.
max_cost_exceededHTTP 422. max_cost is below the price of one search.
rate_limitedHTTP 429. Too many requests, or too many inline requests in flight for your organization. Honor Retry-After.
upstream_errorHTTP 502. The target or search timed out or returned an error we couldn't recover from. You weren't billed.
not_configuredHTTP 503. The service behind this route isn't set up on this server. You weren't billed.
Tasks that end in an error are not billed. All status codes