Quickstart

Create an API key, send your first Google SERP request with cURL, Python or Node, and read the response.
Open as Markdown
On this page

This page takes you from no key to a parsed Google results page in a few minutes.

1. Create an API key

  1. Sign in and open Dashboard → Developers. You need a verified email address to create keys.
  2. Create a key. It starts with dg_ and is shown once, so copy it now. We store only a SHA-256 hash of it.
  3. Put it in an environment variable so it stays out of your code:
export DATAFORGAIO_API_KEY="dg_..."

Your organization's wallet needs a balance for paid requests. Top it up under Dashboard → Billing. A request the wallet can't cover returns 40210 and costs nothing.

2. Send a request

This asks for the top 10 Google results for one keyword in the United States, in English, and returns them in the same response (the live mode).

cURL
curl -X POST "https://api.dataforgaio.com/v1/serp/google/organic/live/advanced" \
  -u "api:$DATAFORGAIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '[{
    "keyword": "trail running shoes",
    "location_code": 2840,
    "language_code": "en",
    "depth": 10
  }]'

location_code 2840 is the United States. Country codes are 2000 plus the ISO 3166-1 numeric code; see Locations and languages.

3. Read the response

Every compatible endpoint returns the same envelope: request-level fields, then one entry in tasks per task you sent. Trimmed:

{
  "version": "0.1.20261203",
  "status_code": 20000,
  "status_message": "Ok.",
  "time": "1.8412 sec.",
  "cost": 0.0018,
  "tasks_count": 1,
  "tasks_error": 0,
  "tasks": [
    {
      "id": "a275cdb0-8d25-40eb-b309-367a10f0bd5a",
      "status_code": 20000,
      "status_message": "Ok.",
      "time": "1.8398 sec.",
      "cost": 0.0018,
      "result_count": 1,
      "path": ["v1", "serp", "google", "organic", "live", "advanced"],
      "data": { "keyword": "trail running shoes", "location_code": 2840, "language_code": "en", "depth": 10 },
      "result": [
        {
          "keyword": "trail running shoes",
          "type": "organic",
          "se_domain": "google.com",
          "location_code": 2840,
          "language_code": "en",
          "check_url": "https://www.google.com/search?q=trail+running+shoes&num=10&hl=en&gl=US",
          "datetime": "2026-12-03 09:00:00 +00:00",
          "item_types": ["organic"],
          "se_results_count": 1234000,
          "pages_count": 1,
          "items_count": 10,
          "items": [
            {
              "type": "organic",
              "rank_group": 1,
              "rank_absolute": 1,
              "page": 1,
              "domain": "example.com",
              "title": "Trail running shoes",
              "url": "https://example.com/trail",
              "description": "..."
            }
          ],
          "fetched_at": "2026-12-03T09:00:00Z"
        }
      ],
      "receipt_id": "e572ab4c-3591-4e05-823f-86fb9d563688",
      "fetch_level": null,
      "upgraded": false,
      "upgrade_reason": null,
      "cache_hit": false
    }
  ]
}

What to check, in order:

  1. tasks[].status_code. 20000 means the task returned data. Anything from 40000 up is an error for that task, and it cost $0. The top-level status_code only describes the request as a whole, so a request can be 20000 while one of its tasks failed. tasks_error counts those.
  2. tasks[].result. The data, in the mirrored product's schema. Organic results are in result[0].items.
  3. tasks[].cost. What this task cost in USD. The top-level cost is the sum.
  4. The last five task fields are ours. receipt_id, fetch_level, upgraded, upgrade_reason and cache_hit explain how the data was fetched and billed. Clients that don't know them ignore them. See Receipts and fetch facts.

Next steps