Skip to content

Document the SERP task request body and expected_serp (DAT-1175) - #3

Merged
mikhail-liubushkin merged 1 commit into
mainfrom
ft/DAT-1175-serp-expected-serp
Nov 17, 2026
Merged

mikhail-liubushkin merged 1 commit into
mainfrom
ft/DAT-1175-serp-expected-serp

Conversation

@mikhail-liubushkin

Copy link
Copy Markdown
Contributor

What

Updates POST /v1/serp/classic/tasks in openapi/data-api.yaml and the generated openapi/data-api.json.

Request body schema

Before this PR the request body had only an example. It now also has a schema, with the fields from the public docs:

  • Required: search_engine (google), device (desktop | mobile), language_code, and query (strings of at most 255 characters each; up to 10 keywords per request by default).
  • Location: location_id or google_ads_location_id. One of them must be provided; the schema description says so.
  • Optional: tag and pingback_url (with literal $id / $tag placeholders).

New optional expected_serp

expected_serp is new in SERP API v2. It is an array parallel to query: item i applies to keyword i. Each item is an object or null, with no other fields allowed:

  • top10_domains: up to 10 domains expected in the top 10;
  • domain: a domain expected in the results;
  • position: an integer from 1 to 100, which requires domain.

How the API treats it:

  • The array may be shorter than query, but not longer.
  • Domains are checked by syntax only, then stored in lower case and punycode, without www and duplicates.
  • Any invalid value returns 400 with the path of the field, and no tasks are created.

The example now shows a three-keyword request with null for the keyword in the middle.

Not changed

  • The responses still have no schemas, and the operation still uses the old apikey query parameter. Both are left for a separate refresh of the whole spec.

Validation

  • redocly lint openapi/data-api.yaml passes with the same 86 warnings as main (84 × operation-4xx-response, info-license, tag-description). Adding only the expected_serp property would have raised 7 new no-invalid-schema-examples warnings for the other example fields; describing them fixes that.
  • The CI's JSON-vs-YAML check passes: data-api.json was regenerated from the YAML, and only this operation changed.

Linear: DAT-1175

🤖 Generated with Claude Code

https://claude.ai/code/session_01Hqw2DQwrLyJXtdtoxsUQVB

POST /v1/serp/classic/tasks had a request body example but no schema.
It now has one, with the fields from the public docs: search_engine,
device, language_code, location_id or google_ads_location_id, query,
tag and pingback_url.

It also adds the new optional expected_serp array (SERP API v2): per
query, up to 10 domains expected in the top 10, and a domain with an
optional expected position (1-100). Items are strict, may be null, and
the array must not be longer than query. The example shows a
three-keyword request with a null in the middle.

JSON and YAML stay in sync. Redocly reports the same 86 warnings as on
main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hqw2DQwrLyJXtdtoxsUQVB
@linear-code

linear-code Bot commented Nov 16, 2026

Copy link
Copy Markdown

DAT-1175

@mikhail-liubushkin
mikhail-liubushkin merged commit 4b741af into main Nov 17, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant