The DataForSEO API is a set of REST APIs that return raw SEO data as JSON: live search results, keyword metrics, backlinks, on-page audits, business listings and more. There is no dashboard to log in to for analysis. You send a request, you get structured data, and you build your own tool, report or AI agent on top. This guide explains which of its APIs does what, how Live and Standard requests differ, and how to make your first request in Python, with error handling for the mistakes most people hit first.
Disclosure: some links in this article are affiliate links. If you sign up through them, scientyficworld.org may earn a commission at no extra cost to you. It does not change our recommendations.
What the DataForSEO API Is (and Isn’t)
DataForSEO sells data, not an SEO platform. Its current API version is v3, and every endpoint follows the same pattern: send a JSON array of tasks over HTTPS and read the JSON response. On 5 November 2026, its APIs page listed about 8.4 billion Google keywords and 514 million Google SERPs in its databases.
That makes it a good fit if you are building a rank tracker, an internal SEO report or a keyword workflow. It is a poor fit if you want charts and reports ready to use, because you have to build that layer yourself. SEO platforms such as Semrush and Ahrefs start from the dashboard and offer an API alongside it; with DataForSEO, the API is the product.
Which DataForSEO API Do You Need?
DataForSEO has eleven main APIs. Most projects need only one or two, so start from the job you want to do:
| Your job | API | A good first endpoint |
|---|---|---|
| Check who ranks for a keyword | SERP API | /v3/serp/google/organic/live/advanced |
| Get search volume from Google Ads | Keywords Data API | /v3/keywords_data/google_ads/search_volume/live |
| See Google Trends data | Keywords Data API | /v3/keywords_data/google_trends/explore/live |
| Get volume, difficulty and intent together | DataForSEO Labs API | /v3/dataforseo_labs/google/keyword_overview/live |
| Score keyword difficulty in bulk | DataForSEO Labs API | /v3/dataforseo_labs/google/bulk_keyword_difficulty/live |
| Analyse a site’s backlinks | Backlinks API | /v3/backlinks/summary/live |
| Audit a page or run Lighthouse | On-Page API | /v3/on_page/lighthouse/live/json |
| See how AI assistants answer a prompt | AI Optimization API | /v3/ai_optimization/chat_gpt/llm_responses/live |
The others are Domain Analytics, Business Data, Merchant, App Data and Content Analysis. The API documentation covers every endpoint and its parameters.
A common point of confusion is the difference between the SERP API and DataForSEO Labs. The SERP API fetches a results page for your query at request time. Labs answers from DataForSEO’s own keyword and SERP databases, so it suits research across many keywords. The keyword overview docs note that its keyword metrics, based on the Google Ads API, update once a month, so do not expect them to reflect today’s search results.
Live vs Standard Requests
Many DataForSEO APIs offer two ways to get data, and mixing them up is one of the most common first errors.
| Live | Standard | |
|---|---|---|
| How it works | Results come back in the same response | Post with task_post, collect later with task_get |
| Best for | User-facing tools and instant answers | Batch jobs and scheduled collection |
| Tasks per request | Usually one | Up to 100 |
| Results stored | Not stored | 30 days |
| Availability | Labs and Backlinks are Live only | Not offered on every API |
If you call task_post and get status 20100 (Task Created) with no data, nothing is wrong. The task was accepted, and you collect the result with task_get using the returned task ID.
Getting Your API Credentials
Create a DataForSEO account, then open the API Access tab in the dashboard. Two details cause most authentication failures:
- Your API password is not your dashboard password. DataForSEO generates it at registration. It stays visible for 24 hours, and after that you can have it sent by email.
- Copy your API login from the same tab. DataForSEO’s help pages describe it as your registration email, but it can be a generated string, as it was on the account we tested.
Authentication is HTTP Basic: the Authorization header contains Basic, a space and the Base64 encoding of login:password. A stray space or line break in the encoded string makes the request fail.
Your First DataForSEO API Request in Python
This script uses only the Python standard library. It defaults to the DataForSEO sandbox, which accepts the same requests on sandbox.dataforseo.com and returns generic sample data, so you can test your integration before requesting real data. It calls two endpoints: the Live Google Organic SERP endpoint and the Labs keyword overview.
First, set your credentials as environment variables:
export DATAFORSEO_LOGIN="[email protected]"
export DATAFORSEO_PASSWORD="your_api_password"Then save this as first_request.py and run it with python3 first_request.py:
import base64
import json
import os
import urllib.error
import urllib.request
# Sandbox returns generic sample data. Change to https://api.dataforseo.com for real results.
BASE_URL = os.environ.get("DATAFORSEO_BASE_URL", "https://sandbox.dataforseo.com")
LOGIN = os.environ["DATAFORSEO_LOGIN"]
PASSWORD = os.environ["DATAFORSEO_PASSWORD"]
TOKEN = base64.b64encode(f"{LOGIN}:{PASSWORD}".encode()).decode()
def call(path, task):
"""POST one task to a Live endpoint and return its result list."""
request = urllib.request.Request(
BASE_URL + path,
data=json.dumps([task]).encode(), # The body is always an array of tasks
headers={"Authorization": f"Basic {TOKEN}", "Content-Type": "application/json"},
method="POST",
)
try:
with urllib.request.urlopen(request, timeout=120) as response:
body = json.load(response)
except urllib.error.HTTPError as error: # 401, 402, 404 and 500 still carry JSON
body = json.load(error)
if body["status_code"] != 20000:
raise RuntimeError(f"Request failed: {body['status_code']} {body['status_message']}")
task_result = body["tasks"][0]
if task_result["status_code"] != 20000: # HTTP 200 can still hide a task-level error
raise RuntimeError(f"Task failed: {task_result['status_code']} {task_result['status_message']}")
return task_result["result"]
def top_results(keyword, location_code=2840, language_code="en", depth=10):
result = call(
"/v3/serp/google/organic/live/advanced",
{"keyword": keyword, "location_code": location_code, "language_code": language_code, "depth": depth},
)
return [
(item["rank_group"], item.get("website_name"), item.get("breadcrumb"))
for item in result[0]["items"]
if item["type"] == "organic" # Skip AI Overviews, People Also Ask and other SERP features
]
def keyword_metrics(keywords, location_code=2840, language_code="en"):
result = call(
"/v3/dataforseo_labs/google/keyword_overview/live",
{"keywords": keywords, "location_code": location_code, "language_code": language_code},
)
return [
(
item["keyword"],
item["keyword_info"]["search_volume"],
item["keyword_properties"]["keyword_difficulty"],
item["search_intent_info"]["main_intent"],
)
for item in result[0]["items"]
]
if __name__ == "__main__":
for rank, site, address in top_results("serp api"):
print(rank, site, address)
for row in keyword_metrics(["serp api", "keyword research api"]):
print(row)Three things in this script are worth copying into your own code:
- The body is an array, even for one task. Sending a single object returns error
40503. - It checks status codes at two levels. DataForSEO returns HTTP 200 for almost everything, so a request can report
20000while the task inside it failed. - It filters by item type. A SERP response mixes organic results with AI Overviews, People Also Ask and other features, each with a different structure.
- It reads the site from
website_nameandbreadcrumb. In our tests,domainandurlheld Google redirect links (google.com/goto?url=...) instead of the ranking site, so check these fields in your own responses before you rely on them for rank tracking.
Before writing code, you can also try any endpoint in the API Playground inside the dashboard, which shows the full JSON response. Location 2840 is the United States. Location codes can differ between APIs, so look them up in each API’s locations endpoint rather than reusing a list.
How this was tested: on 6 November 2026 we sent both requests through the API Playground in the DataForSEO dashboard and confirmed that the real responses contain the fields this script reads. We also ran the script itself against a local mock of those responses, including a task-level error, and against the real sandbox to confirm how an authentication error is handled.
Common DataForSEO API Errors
| Code | Meaning | Fix |
|---|---|---|
40100 | Credentials not recognised | Use the API password, not the dashboard one, and check the encoding |
40104 | Account not verified | Complete verification in the dashboard |
40207 | IP address not whitelisted | Add your IP in the API Access section |
40000 | More than one task sent to a Live endpoint | Send one task per Live request |
40501 | Missing or invalid field | Read the field name in the message and check that endpoint’s docs |
40503 | Invalid request structure | Send an array of tasks, not a single object |
40506 | Unknown field | Check for a typo in the field name |
40601, 40602 | Task not ready yet | Wait and call task_get again |
For rate limits, read the X-RateLimit-Limit and X-RateLimit-Remaining response headers rather than hardcoding a number, because the limit varies by endpoint.
Using an Official Client Library
Plain HTTP keeps the example easy to follow, but DataForSEO also maintains official clients for Python, TypeScript, PHP, C# and Java. The Python client on GitHub installs with pip install dataforseo-client and gives you typed request and response models, which helps if you use many endpoints. Its examples cover both Live and task-based requests.
Using the API Without Writing Code
- n8n: DataForSEO provides a verified node for n8n Cloud and a community node (
n8n-nodes-dataforseo) for self-hosted instances. It works well inside larger workflow automation, and if you are choosing where to run it, see our n8n self-hosting guide. - Google Sheets: the DataForSEO API Connector pulls data into a spreadsheet.
- AI assistants: the official MCP server lets Claude, ChatGPT or Cursor read the docs and call the API for you. We cover the setup in our DataForSEO MCP server guide.
If this fits what you are building, you can create a DataForSEO account here and start in the sandbox.
Conclusion
The DataForSEO API is a building block rather than a finished SEO tool. Pick the API that matches your job, use Live for instant answers and Standard for batches, test in the sandbox, and always check both levels of status codes. Once your first request works, the same pattern applies to every other endpoint.
What is DataForSEO?
DataForSEO is a provider of SEO data delivered through REST APIs. It offers search results, keyword metrics, backlinks, on-page audits, business data and more as JSON, for developers and agencies to build their own tools.
What is the difference between the SERP API and DataForSEO Labs?
The SERP API fetches a search results page for your query at request time. DataForSEO Labs answers from DataForSEO’s own keyword and SERP databases, which suits research across many keywords.
How do I authenticate with the DataForSEO API?
Use HTTP Basic authentication with the API login and API password shown on the API Access tab. The API password is different from your dashboard password.
Does DataForSEO have a Python library?
Yes. The official client installs with pip install dataforseo-client, and you can also call the REST API directly with any HTTP library.
Can I test the DataForSEO API without using real data?
Yes. Send the same requests to sandbox.dataforseo.com instead of api.dataforseo.com. The sandbox returns generic sample responses, which is useful for testing your integration.
Why did I get a 200 response but no data?
DataForSEO returns HTTP 200 for almost every request, so check the status_code field at both the request level and the task level. If you called task_post, you also need a separate task_get call to collect the results.







