# Google Organic SERP: Task Post

> **Beta:** the parser for this endpoint has not yet been checked against a live response. Field shapes may change.

`POST /v1/serp/google/organic/task_post`

Queue Google organic searches on the standard or priority queue, then collect them with tasks_ready and task_get.

Family: SERP API · Mode: Task Post

## Price

Unit: SERP page of up to 10 results

| Mode | Price (USD) |
|---|---|
| Standard queue | $0.00054 |
| Priority queue | $0.00108 |

`standard` is `priority: 1`, `priority` is `priority: 2`. A task served by the live fallback bills at the live price.

## Description

Post up to 100 tasks in one request. Each comes back at once with status 20100 and a task id; nothing is charged yet. When a task finishes it appears in `tasks_ready`, and we call your `pingback_url` or `postback_url` if you set one. Read the result with `task_get`.

`priority: 1` uses the standard queue, `priority: 2` the priority queue, which runs sooner and is priced higher.

**Billing.** Billed per 10 results returned (so `ceil(items / 10)` units), at the price of the mode the task ran in. A search with no results, or one that returned no data, costs $0. With `auto_upgrade` on (the default), a standard or priority task that the included search path can't serve is answered by the live path and billed at the live price; the task shows `upgraded: true` and an `upgrade_reason`. Queued results reuse the shared cache: 6 h on the standard queue, 1 h on the priority queue. `max_age: 0` forces a fresh search.

The wallet check at post time reserves the worst case each task can cost (the live price when Auto-upgrade is on), so the post is refused with 40210 if the balance can't cover it.

**Beta.** The parsers that read this engine's results were written from the upstream documentation and haven't been checked against live responses yet. Field names and the response shape are fixed; expect some fields to be null more often than they should be until that check is done.

## Authentication

HTTP Basic auth: any login, with your `dg_` API key as the password. A `Bearer` token header with the key also works.

## Request

Send a JSON array of task objects (up to 100 per request).

| Field | Type | Required | Description |
|---|---|---|---|
| `keyword` | string | yes | The search query, up to 700 characters. Leading and trailing spaces are trimmed. max 700 |
| `location_code` | integer | no | Country location code from `/v1/serp/google/locations`, for example `2840` for the United States. City and region codes aren't served yet. Send this, `location_name` or `location_coordinate`. |
| `location_name` | string | no | A country name (`United States`), or a comma-separated place that ends in a country (`Boulder,Colorado,United States`) to search from that place. |
| `location_coordinate` | string | no | `latitude,longitude` or `latitude,longitude,zoom` for a search centered on a point. Used when neither `location_code` nor `location_name` is sent. |
| `language_code` | string | no | Language code from `/v1/serp/google/languages`, for example `en`. Send this or `language_name`. |
| `language_name` | string | no | Language name, for example `English`, used when `language_code` is not sent. |
| `device` | string | no | Device the results are for. default `desktop`; one of `desktop`, `mobile` |
| `os` | string | no | Operating system for the device: `windows` or `macos` on desktop, `android` or `ios` on mobile. Defaults to `windows` on desktop and `android` on mobile. one of `windows`, `macos`, `android`, `ios` |
| `depth` | integer | no | Results to return, 1 to 200. Billed per 10 results returned, so `depth: 100` with 100 results costs 10 units. default `10`; min 1; max 200 |
| `se_domain` | string | no | Search engine domain to report in the result's `se_domain`, for example `google.co.uk`. It's echoed back only: the location and language fields decide where the search runs. default `google.com` |
| `auto_upgrade` | boolean | no | If the included search path can't return the page, the task is served by the live path and billed at the live price, with `upgraded: true`. `false` returns the failure at $0 instead. default `true` |
| `max_cost` | number | no | The most this task may cost, in USD. The wallet check reserves this instead of the worst case, and the task doesn't upgrade to the live price when that would go over it. min 0 |
| `max_age` | integer | no | Accept a cached result up to this many seconds old, 0 to 86,400. `0` always searches fresh. Default window: none on live (always fresh), 6 h on the standard queue, 1 h on the priority queue. Leave it out to use the default. min 0; max 86400 |
| `priority` | integer | no | Queue for this task: `1` is the standard queue, `2` the priority queue (faster, priced higher). default `1`; one of `1`, `2` |
| `tag` | string | no | Your own label for the task, up to 255 characters. Returned by tasks_ready. max 255 |
| `pingback_url` | string | no | We send a GET to this http(s) URL when the task finishes. `$id` and `$tag` in the URL are replaced with the task id and tag. Only public hosts are called and redirects aren't followed. max 2000 |
| `postback_url` | string | no | We POST the finished task, in the task_get envelope, to this http(s) URL. Only public hosts are called and redirects aren't followed. max 2000 |
| `postback_data` | string | no | Result format sent to `postback_url`. Defaults to `advanced` when `postback_url` is set. one of `regular`, `advanced`, `html` |

### Example request

```bash
curl -X POST "https://api.dataforgaio.com/v1/serp/google/organic/task_post" \
  -u "api:$DATAFORGAIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '[
  {
    "keyword": "trail running shoes",
    "location_code": 2840,
    "language_code": "en",
    "device": "desktop",
    "depth": 10,
    "priority": 1,
    "tag": "weekly-rank-check",
    "pingback_url": "https://hooks.example.com/done?id=$id&tag=$tag"
  }
]'
```

## Response

| Field | Type | Description |
|---|---|---|
| `version` | string | Response format version, for example `0.1.20261203`. |
| `status_code` | integer | Status of the request as a whole. 20000 when it was accepted; each task has its own `status_code`. |
| `status_message` | string | Plain-language request status. |
| `time` | string | Time the whole request took, for example `1.8410 sec.` |
| `cost` | number | Sum of every task's `cost`, in USD. |
| `tasks_count` | integer | Number of tasks in `tasks`. |
| `tasks_error` | integer | Tasks whose `status_code` is 40000 or higher. |
| `tasks` | array<object> | One entry per task you sent, in the order you sent them. |
| `tasks.id` | string | Task id (a UUID). For task_post, use it with task_get. |
| `tasks.status_code` | integer | Outcome of this task. 20000 means data came back; 20100 means queued. See the status codes table. |
| `tasks.status_message` | string | Plain-language status. For 40501 it names the field that failed. |
| `tasks.time` | string | Time this task took on our side, for example `1.8203 sec.` |
| `tasks.cost` | number | What this task was charged, in USD. 0 when it returned no data. |
| `tasks.result_count` | integer | Number of entries in `result`. |
| `tasks.path` | array<string> | The route this task ran on, split into segments, starting with `v1`. |
| `tasks.data` | object | The task you sent, echoed back. Utility routes echo their query parameters. |
| `tasks.result` | null | Always null for task_post. Read the result with task_get. |
| `tasks.receipt_id` | string\|null | Id of the ledger receipt for this task: what was fetched, at which level, and what was charged. Null for utility routes and failed checks. |
| `tasks.fetch_level` | string\|null | The fetch level that delivered the data: `standard`, `rendered` or `protected`. Null when the route doesn't fetch pages or nothing was fetched. one of `standard`, `rendered`, `protected` |
| `tasks.upgraded` | boolean | True when Auto-upgrade moved the request past the included level (or, for SERP, to the live path) and the charge reflects that. |
| `tasks.upgrade_reason` | string\|null | Why the request upgraded, in our level names and HTTP facts, for example `403 at standard; challenge page at rendered`. Null when it didn't upgrade. |
| `tasks.cache_hit` | boolean | True when the data came from the shared result cache instead of a new fetch. |

### Example response

```json
{
  "version": "0.1.20261203",
  "status_code": 20000,
  "status_message": "Ok.",
  "time": "0.4210 sec.",
  "cost": 0,
  "tasks_count": 1,
  "tasks_error": 0,
  "tasks": [
    {
      "id": "8cbb5b5c-8e15-5c82-9959-45f93cdad009",
      "status_code": 20100,
      "status_message": "Task Created.",
      "time": "0.4210 sec.",
      "cost": 0,
      "result_count": 0,
      "path": [
        "v1",
        "serp",
        "google",
        "organic",
        "task_post"
      ],
      "data": {
        "keyword": "trail running shoes",
        "location_code": 2840,
        "language_code": "en",
        "device": "desktop",
        "depth": 10,
        "priority": 1,
        "tag": "weekly-rank-check",
        "pingback_url": "https://hooks.example.com/done?id=$id&tag=$tag"
      },
      "result": null,
      "receipt_id": null,
      "fetch_level": null,
      "upgraded": false,
      "upgrade_reason": null,
      "cache_hit": false
    }
  ]
}
```

## Errors

| Code | When |
|---|---|
| 40100 | No credentials were sent (HTTP 401). |
| 40101 | The API key is missing, malformed or revoked (HTTP 401). |
| 40202 | Too many requests for this key (HTTP 429, with `Retry-After`). |
| 40503 | The body isn't a JSON array of task objects, or the method isn't POST (HTTP 400 or 405). |
| 40006 | More than 100 tasks in one POST (HTTP 400). |
| 40210 | Wallet balance below the worst case this POST could cost (HTTP 402). |
| 40501 | A task field failed validation. Returned per task; other tasks still run. |
| 40501 | `pingback_url` or `postback_url` isn't an http(s) URL, `postback_data` isn't regular, advanced or html, or `priority` isn't 1 or 2. |

## Migrating

Replaces DataForSEO `/v3/serp/google/organic/task_post`. Same request body and response envelope; change the base URL and the key.

## Related

- [Google Organic SERP: Live Advanced](https://dataforgaio.com/docs/api/serp-google-organic-live-advanced.md): Google organic results for a keyword, location, language and device. Returned in the same call, in the advanced format.
- [Google Organic SERP: Live Regular](https://dataforgaio.com/docs/api/serp-google-organic-live-regular.md): Google organic results for a keyword, location, language and device. Returned in the same call, in the regular format.
- [Google Organic SERP: Tasks Ready](https://dataforgaio.com/docs/api/serp-google-organic-tasks-ready.md): List your finished tasks for this endpoint that you haven't collected yet.
- [Google Organic SERP: Tasks Fixed](https://dataforgaio.com/docs/api/serp-google-organic-tasks-fixed.md): Same list as tasks_ready, kept for clients that call tasks_fixed.
- [Google Organic SERP: Task Get Advanced](https://dataforgaio.com/docs/api/serp-google-organic-task-get-advanced.md): Read one queued task's result in the advanced format.
- [Google Organic SERP: Task Get Regular](https://dataforgaio.com/docs/api/serp-google-organic-task-get-regular.md): Read one queued task's result in the regular format.
