Quickstart
Create an API key, send your first Google SERP request with cURL, Python or Node, and read the response.
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
- Sign in and open Dashboard → Developers. You need a verified email address to create keys.
- Create a key. It starts with
dg_and is shown once, so copy it now. We store only a SHA-256 hash of it. - 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 -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
}]'import os
import requests
res = requests.post(
"https://api.dataforgaio.com/v1/serp/google/organic/live/advanced",
auth=("api", os.environ["DATAFORGAIO_API_KEY"]), # any login, your key as the password
json=[{
"keyword": "trail running shoes",
"location_code": 2840,
"language_code": "en",
"depth": 10,
}],
timeout=120,
)
body = res.json()
task = body["tasks"][0]
print(task["status_code"], task["status_message"], task["cost"])
if task["status_code"] == 20000:
for item in task["result"][0]["items"]:
print(item["rank_absolute"], item["domain"], item["url"])const auth = Buffer.from(`api:${process.env.DATAFORGAIO_API_KEY}`).toString("base64");
const res = await fetch("https://api.dataforgaio.com/v1/serp/google/organic/live/advanced", {
method: "POST",
headers: { Authorization: `Basic ${auth}`, "Content-Type": "application/json" },
body: JSON.stringify([
{ keyword: "trail running shoes", location_code: 2840, language_code: "en", depth: 10 },
]),
});
const body = await res.json();
const task = body.tasks[0];
console.log(task.status_code, task.status_message, task.cost);
if (task.status_code === 20000) {
for (const item of task.result[0].items) console.log(item.rank_absolute, item.domain, item.url);
}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:
tasks[].status_code.20000means the task returned data. Anything from40000up is an error for that task, and it cost $0. The top-levelstatus_codeonly describes the request as a whole, so a request can be20000while one of its tasks failed.tasks_errorcounts those.tasks[].result. The data, in the mirrored product's schema. Organic results are inresult[0].items.tasks[].cost. What this task cost in USD. The top-levelcostis the sum.- The last five task fields are ours.
receipt_id,fetch_level,upgraded,upgrade_reasonandcache_hitexplain how the data was fetched and billed. Clients that don't know them ignore them. See Receipts and fetch facts.
Next steps
- Send up to 100 tasks per request: Making requests.
- Pay less for scheduled work with the standard queue: Live and queued tasks.
- Set a ceiling on what one task may cost: Fetch levels and Auto-upgrade.
- Look up every field of this endpoint: POSTGoogle Organic SERP: Live Advanced.