Analyze a public URL with Python by sending a one-task JSON array to https://dataseo.dev/api/v3/on_page/instant_pages. Keep the Bearer key on your server. Check HTTP, root and task status before reading the first result item’s meta and checks. The operation analyzes public HTML up to 2 MB without JavaScript rendering or external resource loading.
Scope and secure setup
For HTML metadata analysis with Python, keep the request narrow to one URL in a one-object task array sent to POST https://dataseo.dev/api/v3/on_page/instant_pages, and keep the API key only in a server-side environment variable as Authorization: Bearer. The request object uses url with enable_javascript, load_resources, enable_xhr and enable_browser_rendering set to false, which matches the HTML-only scope of public HTML up to 2 MB without JavaScript rendering or external-resource loading. Install the requests package in your server environment for this Python example. It is a general HTTP client, not a DataSEO SDK. Treat a retry, snapshot or diff strategy as client design guidance rather than guaranteed API behavior.
DataSEO API contract · DataSEO agent integration instructions
Primary evidence and response parsing
Read the response in order by first checking the HTTP response, including an explicit branch for HTTP 402 that stops without initiating a purchase, then root status_code and tasks[0].status_code, and only then reading metadata from tasks[0].result[0].items[0].meta, including its nested field at tasks[0].result[0].items[0].meta.content, with checks from tasks[0].result[0].items[0].checks. On a controlled successful response the root and task status_code are 20000, and transport success alone does not establish usable results. The code example defensively checks that the payload, tasks, result, items, meta and checks exist before indexing, because the documented paths describe the expected shape for a usable successful result rather than guaranteeing every response contains them.
DataSEO API contract · Controlled runtime and arithmetic checks · DataSEO prepaid pricing · DataSEO agent integration instructions
Worked example from the executed controlled fixture
The executed controlled fixture passed 6 cases on 2026-11-14 using injected self-authored HTML, with no production API, customer data, provider request, billing event or live performance measurement. Its original case returned HTTP 200, root and task status_code 20000, title Trail Notes, a 47-character description, canonical https://fixture.example/trail, one internal link, four plain-text words in meta.content, and fixture-specific checks including low_content_rate, low_character_count, small_page_size and title_too_short as true. Its updated case returned title Trail Notes: updated checklist, a null description and no_description true, showing that a missing description is reported through checks rather than causing a transport failure.
Failure case and handling
The controlled rendering_rejected case sent enable_javascript: true and returned HTTP 400 with a message stating that only HTML analysis is supported. It did not perform a rendered-page analysis. In a client, handle the HTTP failure before reading business result fields. Correct invalid options before submitting the request again. That handling strategy is client design guidance; the rejection is the tested behavior. Failed requests are free under the billing policy.
DataSEO API contract · Controlled runtime and arithmetic checks · DataSEO prepaid pricing
Cost boundary
Page analysis consumes $0.001 per successful request from prepaid credit. Failed requests and account connection checks are free under the current billing policy. Insufficient prepaid credit raises HTTP 402 before the paid operation; stop rather than initiating an unapproved purchase. Keep the API key and request on your server.
DataSEO prepaid pricing · DataSEO agent integration instructions
Useful next steps
For a server-side monitoring workflow, keep the verified metadata fields from each successful result and compare the same field set after a release. Treat that snapshot/diff approach as client design guidance, not a built-in monitoring guarantee. The API reference and On-Page playground are available navigation destinations; the request and parsing instructions in this article come from the contract and controlled execution above.
DataSEO API contract · Controlled runtime and arithmetic checks · DataSEO public navigation
Secure server-side Python reference example with explicit HTTP 402 handling and defensive checks before reading tasks[0].result[0].items[0].meta and its nested meta.content
Server-side reference example. python
# Reference request code only; not a live API run and not an executed production call.
# General Python client setup (not a product-specific requirement): install the requests dependency, for example with pip install requests, and set DATASEO_API_KEY in server-side environment variables.
import os
import requests
url = "https://example.com/traffic-guide"
api_key = os.environ["DATASEO_API_KEY"] # server-side only; never hard-code or ship to browser
response = requests.post(
"https://dataseo.dev/api/v3/on_page/instant_pages",
headers={"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"},
json=[{"url": url, "enable_javascript": False, "load_resources": False, "enable_xhr": False, "enable_browser_rendering": False}],
timeout=30,
)
if response.status_code == 402:
# Client design guidance: stop processing; do not automatically purchase credit.
print("Insufficient prepaid credit; stopping without purchase", response.text)
raise SystemExit(1)
if not 200 <= response.status_code < 300:
# Client design guidance: log status and body, do not retry with the same invalid flags, and do not treat a failed request as billed.
print(response.status_code, response.text)
raise SystemExit(1)
payload = response.json()
if not isinstance(payload, dict) or payload.get("status_code") != 20000:
print("Root status not successful", payload.get("status_code") if isinstance(payload, dict) else type(payload))
raise SystemExit(1)
tasks = payload.get("tasks")
if not isinstance(tasks, list) or not tasks or not isinstance(tasks[0], dict):
print("Missing tasks")
raise SystemExit(1)
task = tasks[0]
if task.get("status_code") != 20000:
print("Task status not successful", task.get("status_code"))
raise SystemExit(1)
result = task.get("result")
if not isinstance(result, list) or not result or not isinstance(result[0], dict):
print("Missing result")
raise SystemExit(1)
items = result[0].get("items")
if not isinstance(items, list) or not items or not isinstance(items[0], dict):
print("Missing items")
raise SystemExit(1)
item = items[0]
meta = item.get("meta")
checks = item.get("checks")
if not isinstance(meta, dict) or not isinstance(checks, dict):
print("Missing meta or checks")
raise SystemExit(1)
content = meta.get("content") # nested inside meta, not a sibling of meta
print({
"title": meta.get("title"),
"description": meta.get("description"),
"h1": (meta.get("htags") or {}).get("h1"),
"canonical": meta.get("canonical"),
"plain_text_word_count": (content or {}).get("plain_text_word_count") if isinstance(content, dict) else None,
"no_description": checks.get("no_description"),
"is_broken": checks.get("is_broken"),
"is_redirect": checks.get("is_redirect"),
"is_4xx_code": checks.get("is_4xx_code"),
"is_5xx_code": checks.get("is_5xx_code"),
})Limits and interpretation
- Scope is public HTML up to 2 MB with no JavaScript rendering and no external-resource loading, so metadata that only appears after script execution is not represented.
- The controlled fixture is a synthetic test execution, not a production API observation, live benchmark, customer result or performance claim.
- HTTP response and task status establish whether a result was returned successfully. Page-condition checks such as redirects or missing descriptions are separate observations, not substitutes for task status.
- Invalid input returns HTTP 400 and a source failure or not-connected state returns HTTP 503.
- Stop on HTTP 402 and never purchase credit automatically without authorization.
Sources and verification
Reviewed against first-party documentation and the current DataSEO implementation. Worked scenarios are illustrative unless explicitly identified otherwise. Reviewed 14 November 2026.
- DataSEO prepaid pricing
- DataSEO API contract
- Controlled runtime and arithmetic checks — Synthetic fixtures and pure calculations; no production request or payment was executed.
- DataSEO agent integration instructions
