# Atomically validate and enqueue a batch (/api-reference/data-api/postDataBatches)

Atomically validates and enqueues a batch of requests: either every item is accepted and the batch id is returned, or nothing is created. Use it for many URLs in one call and data_create_request for a single one. Follow up with data_wait_batch or data_get_batch. Send an Idempotency-Key so an exact-body retry replays the original batch instead of enqueuing a duplicate.

## POST /api/v1/data/batches

Atomically validate and enqueue a batch

- Operation ID: `postDataBatches`

- Tags: `Data API`

Atomically validates and enqueues a batch of requests: either every item is accepted and the batch id is returned, or nothing is created. Use it for many URLs in one call and data_create_request for a single one. Follow up with data_wait_batch or data_get_batch. Send an Idempotency-Key so an exact-body retry replays the original batch instead of enqueuing a duplicate.

### Security

- Required scope: `scrape:write`

- `ApiKey` (apiKey, X-API-Key)

- `ApiKeyBearer` (http)

### Parameters

- `Idempotency-Key` (header) — string; Optional. Generate a unique value before a write and retain it for an exact-body retry; replay is free and a different body returns 409 IDEMPOTENCY_CONFLICT.; example="rh-docs-01J2QG-unique"

### Request body

- `application/json`: object required=jobs

### Responses

- **202** — Batch accepted or idempotently replayed Error body uses the documented PublicError DTO.

  - `application/json`: #/components/schemas/CreateBatchResponse

  - Example: `{
  "id": "9a20bd58-ed33-4a5b-b63f-b52bb1a62248",
  "status": "pending"
}`

- **400** — Invalid batch or idempotency key Error body uses the documented PublicError DTO.

  - `application/json`: #/components/schemas/PublicError

  - Example: `{
  "error": "Request failed",
  "code": "VALIDATION_ERROR",
  "message": "Invalid batch or idempotency key Error body uses the documented PublicError DTO.",
  "requestId": "req_01J2QG"
}`

- **409** — Idempotency conflict Error body uses the documented PublicError DTO.

  - `application/json`: #/components/schemas/PublicError

  - Example: `{
  "error": "Request failed",
  "code": "RESULT_NOT_READY",
  "message": "Idempotency conflict Error body uses the documented PublicError DTO.",
  "requestId": "req_01J2QG"
}`

- **503** — Launch pricing is unavailable Error body uses the documented PublicError DTO.

  - `application/json`: #/components/schemas/PublicError

  - Example: `{
  "error": "Request failed",
  "code": "PRICING_NOT_ACTIVE",
  "message": "Launch pricing is unavailable Error body uses the documented PublicError DTO.",
  "requestId": "req_01J2QG"
}`

### Referenced OpenAPI components

#### `#/components/parameters/IdempotencyKey`

```json

{
  "name": "Idempotency-Key",
  "in": "header",
  "required": false,
  "description": "Optional. Generate a unique value before a write and retain it for an exact-body retry; replay is free and a different body returns 409 IDEMPOTENCY_CONFLICT.",
  "schema": {
    "type": "string",
    "minLength": 8,
    "maxLength": 200
  },
  "example": "rh-docs-01J2QG-unique"
}

```

#### `#/components/schemas/ScrapeRequest`

```json

{
  "type": "object",
  "allOf": [
    {
      "$ref": "#/components/schemas/RequestTransport"
    }
  ],
  "unevaluatedProperties": false
}

```

#### `#/components/schemas/CreateBatchResponse`

```json

{
  "type": "object",
  "required": [
    "batch_id",
    "status",
    "jobs",
    "charged_tokens",
    "pricing_version",
    "route_mode",
    "idempotent_replay"
  ],
  "properties": {
    "batch_id": {
      "type": "string",
      "format": "uuid"
    },
    "status": {
      "type": "string",
      "enum": [
        "pending",
        "completed"
      ]
    },
    "jobs": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/PublicJobCreated"
      }
    },
    "charged_tokens": {
      "type": "integer",
      "minimum": 0,
      "description": "Base credits charged by this submission operation; dynamic protected/CAPTCHA debits occur later. Zero on an idempotent replay."
    },
    "pricing_version": {
      "type": "integer",
      "minimum": 1
    },
    "route_mode": {
      "$ref": "#/components/schemas/DataRouteMode"
    },
    "idempotent_replay": {
      "type": "boolean",
      "example": false,
      "description": "True only when this response replays a previous submission with the same idempotency key and payload."
    }
  }
}

```

#### `#/components/headers/X-Credits-Charged`

```json

{
  "description": "Credits charged by the current submission operation. Idempotent replays return 0.",
  "schema": {
    "type": "integer",
    "minimum": 0
  }
}

```

#### `#/components/headers/X-Credits-Remaining`

```json

{
  "description": "Current tenant token balance after the operation.",
  "schema": {
    "type": "integer",
    "minimum": 0
  }
}

```

#### `#/components/headers/X-Credit-Pricing-Version`

```json

{
  "description": "Public pricing version used for the operation.",
  "schema": {
    "type": "integer",
    "minimum": 1
  }
}

```

#### `#/components/headers/X-Route-Mode`

```json

{
  "description": "Effective route mode used by the operation; batch responses may be mixed.",
  "schema": {
    "type": "string",
    "enum": [
      "direct",
      "auto",
      "browser",
      "http",
      "residential",
      "residential_browser",
      "mixed"
    ]
  }
}

```

#### `#/components/schemas/PublicError`

```json

{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "error",
    "code",
    "message",
    "requestId"
  ],
  "properties": {
    "error": {
      "type": "string"
    },
    "code": {
      "type": "string",
      "description": "Stable public error code. PROXY_QUOTE_EXPIRED means the optional quote_version supplied at admission is no longer current; refresh the pricing view and submit again."
    },
    "message": {
      "type": "string"
    },
    "requestId": {
      "type": "string"
    }
  }
}

```

#### `#/components/schemas/RequestTransport`

```json

{
  "type": "object",
  "required": [
    "url"
  ],
  "properties": {
    "quote_version": {
      "$ref": "#/components/schemas/ProxyQuoteVersion",
      "description": "Optional opaque pricing version for this individual request. For a batch, pass the quote_version on each job. Older clients may omit it."
    },
    "url": {
      "type": "string",
      "format": "uri",
      "maxLength": 4096
    },
    "mode": {
      "type": "string",
      "enum": [
        "direct",
        "auto",
        "browser",
        "http",
        "residential",
        "residential_browser"
      ],
      "description": "Optional route mode. When omitted, javascript=true resolves to browser and javascript=false resolves to http. direct uses bounded HTTP, auto uses HTTP then browser rendering, and browser starts in the browser. http, residential, and residential_browser remain supported explicit route modes. direct and http use the selected network class's HTTP tariff, browser uses its browser tariff, residential uses the residential HTTP tariff, and residential_browser uses the residential browser tariff. auto bills the terminal HTTP or browser stage after execution."
    },
    "geo_country": {
      "type": "string",
      "minLength": 2,
      "maxLength": 2,
      "example": "US",
      "description": "Requested ISO 3166-1 alpha-2 proxy exit country; input is normalized to uppercase. The effective proxy route is verified before the target is requested; browser contexts then apply timezone/geolocation. An unavailable or mismatched route fails with PROXY_GEO_VERIFICATION_FAILED."
    },
    "max_credits_per_request": {
      "type": "integer",
      "minimum": 1,
      "description": "Hard ceiling for total whole tokens charged to this newly accepted request. It includes HTTP or browser execution, CAPTCHA and measured traffic from a successful result. The limit is shared by immediate and deferred billing stages. If execution must stop before producing a complete result, the request ends with budget_exhausted."
    },
    "proxy": {
      "type": "string",
      "enum": [
        "random",
        "off",
        "own"
      ],
      "default": "random",
      "description": "random uses RunHarvester proxies, off connects directly, own leaves only through your own nodes (computers and proxies) with proxy_type and geo_country as filters by their probe results; own traffic is not charged. A failing node is retried on up to two other nodes."
    },
    "own_pool": {
      "$ref": "#/components/schemas/OwnPool"
    },
    "own_strategy": {
      "type": "string",
      "enum": [
        "random",
        "sticky"
      ],
      "description": "With proxy own, random picks any usable node; sticky keeps one node per batch and host, or per own_session."
    },
    "own_session": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128,
      "description": "With proxy own and sticky, requests with the same value use the same node while it stays usable."
    },
    "fallback": {
      "type": "string",
      "enum": [
        "platform"
      ],
      "description": "With proxy own, use the platform proxy (charged as usual) when none of your nodes can carry the request; without it the request fails with NO_OWN_PROXY_AVAILABLE and is not charged."
    },
    "proxy_type": {
      "type": "string",
      "enum": [
        "datacenter",
        "residential",
        "premium"
      ],
      "description": "Requested proxy network type. If omitted, the route mode determines the legacy default. This selects the datacenter, residential or premium tariff independently of transport mode. Premium requires explicit selection, a configured plan price and an available connection, and cannot be combined with proxy off. Provider selection and tariff resolution are internal and are not returned in public responses."
    },
    "headers": {
      "type": "object",
      "default": {},
      "description": "Transport-controlled and hop-by-hop headers are rejected; names and values cannot contain control characters.",
      "additionalProperties": {
        "type": "string",
        "maxLength": 16384
      }
    },
    "cookies": {
      "type": "object",
      "default": {},
      "description": "Cookie names and values are validated and cannot contain control characters.",
      "additionalProperties": {
        "type": "string",
        "maxLength": 16384
      }
    },
    "timeout_ms": {
      "type": "integer",
      "minimum": 5000,
      "maximum": 300000,
      "default": 45000
    },
    "javascript": {
      "type": "boolean",
      "default": true
    },
    "resource_policy": {
      "type": "string",
      "enum": [
        "compatible",
        "adaptive"
      ],
      "default": "adaptive",
      "description": "Browser resource loading policy. adaptive starts in full mode, promotes back to full on challenges, and switches to site-light only after the page is usable. site-light blocks media, images, manifests and a conservative known advertising/analytics denylist while preserving documents, scripts, XHR/fetch, WASM, service workers, styles and fonts. compatible always uses full mode; adaptive enables site-light only after the page is usable."
    },
    "wait_for_selector": {
      "type": [
        "string",
        "null"
      ],
      "minLength": 1,
      "maxLength": 500,
      "description": "CSS selector that must appear when supplied; if it does not appear before min(timeout_ms, 30000), the job fails."
    },
    "user_agent": {
      "type": [
        "string",
        "null"
      ],
      "minLength": 1,
      "maxLength": 1000
    },
    "result_text_selector": {
      "type": [
        "string",
        "null"
      ],
      "minLength": 1,
      "maxLength": 500
    },
    "wait_for_text": {
      "anyOf": [
        {
          "type": "null"
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "selector"
          ],
          "properties": {
            "selector": {
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            },
            "min_length": {
              "type": "integer",
              "minimum": 0,
              "maximum": 10000,
              "default": 1
            },
            "stable_ms": {
              "type": "integer",
              "minimum": 0,
              "maximum": 60000,
              "default": 2500
            },
            "timeout_ms": {
              "type": "integer",
              "minimum": 5000,
              "maximum": 300000
            },
            "poll_interval_ms": {
              "type": "integer",
              "minimum": 100,
              "maximum": 10000,
              "default": 500
            },
            "end_text": {
              "type": "string",
              "minLength": 1,
              "maxLength": 10000,
              "description": "Optional literal completion marker. The text must still meet min_length; once the marker appears the wait completes without waiting for stable_ms."
            },
            "on_timeout": {
              "type": "string",
              "enum": [
                "return_last",
                "fail"
              ],
              "default": "return_last",
              "description": "return_last preserves the last non-empty text and records an unsatisfied result_meta.wait.text outcome; fail marks the request failed with WAIT_FOR_TEXT_TIMEOUT."
            }
          }
        }
      ]
    },
    "browser_actions": {
      "type": "array",
      "maxItems": 20,
      "default": [],
      "description": "Ordered, declarative browser-only actions. Any non-empty list promotes HTTP routes to their browser equivalent, enables JavaScript, uses a fresh isolated browser context, and bypasses the result cache. The full ordered list is persisted for a request retry and returned by clone-input. A click that changes the page URL, opens a popup, or starts a download is blocked. Only aggregate action diagnostics are included in result_meta.",
      "items": {
        "$ref": "#/components/schemas/BrowserAction"
      }
    },
    "debug_artifacts": {
      "type": "boolean",
      "default": false,
      "description": "Opt in to short-lived, encrypted, tenant-private diagnostics only if the request terminally fails. Enabling it promotes HTTP routes to browser execution, enables JavaScript, uses an isolated context, and bypasses cache. Diagnostics exclude page HTML, response bodies, headers, cookies, credentials, and raw browser traces; the screenshot endpoint may show target-page content despite masked known form controls."
    },
    "skip_cache": {
      "type": "boolean",
      "default": false
    },
    "cache_ttl_seconds": {
      "type": "integer",
      "minimum": 0,
      "maximum": 3600,
      "default": 300
    }
  }
}

```

#### `#/components/schemas/PublicJobCreated`

```json

{
  "type": "object",
  "required": [
    "id",
    "status",
    "cached",
    "protected",
    "pricing_version",
    "route_mode",
    "base_tokens",
    "protected_tokens",
    "captcha_tokens",
    "created_at"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "url": {
      "type": "string",
      "format": "uri",
      "description": "Target origin only; path and query are stored in the encrypted short-retention payload."
    },
    "status": {
      "$ref": "#/components/schemas/DataJobStatus"
    },
    "cached": {
      "type": "boolean"
    },
    "protected": {
      "type": "boolean",
      "description": "True after server-side anti-bot protection detection."
    },
    "pricing_version": {
      "type": "integer",
      "minimum": 1
    },
    "route_mode": {
      "$ref": "#/components/schemas/DataRouteMode"
    },
    "proxy_type": {
      "$ref": "#/components/schemas/ProxyNetworkType",
      "description": "Requested proxy network class. Present on new submissions; historical idempotent replays may omit this field."
    },
    "base_tokens": {
      "type": "integer",
      "minimum": 0
    },
    "protected_tokens": {
      "type": "integer",
      "minimum": 0,
      "description": "Historical compatibility field; built-in protection is included in the selected pricing-v2 request mode."
    },
    "captcha_tokens": {
      "type": "integer",
      "minimum": 0
    },
    "quote": {
      "$ref": "#/components/schemas/EconomicQuote",
      "description": "Provider-neutral admission quote. Null when the guarded pricing policy is disabled."
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}

```

#### `#/components/schemas/DataRouteMode`

```json

{
  "type": "string",
  "enum": [
    "direct",
    "auto",
    "browser",
    "http",
    "residential",
    "residential_browser",
    "mixed"
  ]
}

```

#### `#/components/schemas/ProxyQuoteVersion`

```json

{
  "type": "string",
  "minLength": 64,
  "maxLength": 64,
  "description": "Opaque pricing quote version. Send it with admission to detect changed prices."
}

```

#### `#/components/schemas/OwnPool`

```json

{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "node_ids"
  ],
  "description": "Narrows proxy own to these nodes; without it every usable node of yours is in the pool.",
  "properties": {
    "node_ids": {
      "type": "array",
      "minItems": 1,
      "maxItems": 50,
      "items": {
        "type": "string",
        "format": "uuid"
      }
    }
  }
}

```

#### `#/components/schemas/BrowserAction`

```json

{
  "description": "A bounded declarative browser action. Arbitrary JavaScript, navigation, form input, keyboard events, file transfer, coordinate clicks, and arbitrary delays are not supported. A non-empty action list always executes in order in a fresh isolated browser context and cannot use a cached result.",
  "oneOf": [
    {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "type",
        "delta_y"
      ],
      "properties": {
        "type": {
          "type": "string",
          "const": "scroll"
        },
        "delta_y": {
          "type": "integer",
          "minimum": -10000,
          "maximum": 10000,
          "not": {
            "const": 0
          },
          "description": "Required non-zero vertical scroll delta in CSS pixels."
        },
        "steps": {
          "type": "integer",
          "minimum": 1,
          "maximum": 25,
          "default": 1,
          "description": "Number of bounded wheel steps used to apply delta_y."
        },
        "interval_ms": {
          "type": "integer",
          "minimum": 0,
          "maximum": 1000,
          "default": 250,
          "description": "Delay between scroll steps."
        }
      }
    },
    {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "type",
        "selector"
      ],
      "properties": {
        "type": {
          "type": "string",
          "const": "click"
        },
        "selector": {
          "type": "string",
          "minLength": 1,
          "maxLength": 500,
          "description": "CSS selector for the target element."
        },
        "timeout_ms": {
          "type": "integer",
          "minimum": 100,
          "maximum": 30000,
          "default": 10000,
          "description": "Per-action upper bound, additionally limited by the request deadline."
        }
      }
    },
    {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "type",
        "selector"
      ],
      "properties": {
        "type": {
          "type": "string",
          "const": "wait_for_selector"
        },
        "selector": {
          "type": "string",
          "minLength": 1,
          "maxLength": 500,
          "description": "CSS selector to wait for."
        },
        "state": {
          "type": "string",
          "enum": [
            "attached",
            "visible"
          ],
          "default": "visible"
        },
        "timeout_ms": {
          "type": "integer",
          "minimum": 100,
          "maximum": 30000,
          "default": 10000,
          "description": "Per-action upper bound, additionally limited by the request deadline."
        }
      }
    }
  ],
  "discriminator": {
    "propertyName": "type"
  }
}

```

#### `#/components/schemas/DataJobStatus`

```json

{
  "type": "string",
  "enum": [
    "pending",
    "running",
    "solving_captcha",
    "completed",
    "failed",
    "cancelled"
  ]
}

```

#### `#/components/schemas/ProxyNetworkType`

```json

{
  "type": "string",
  "enum": [
    "datacenter",
    "residential",
    "premium"
  ]
}

```

#### `#/components/schemas/EconomicQuote`

```json

{
  "type": [
    "object",
    "null"
  ],
  "additionalProperties": false,
  "required": [
    "status",
    "pricing_version",
    "customer_cap_credits",
    "outcomes"
  ],
  "properties": {
    "status": {
      "type": "string",
      "const": "accepted"
    },
    "pricing_version": {
      "type": "integer",
      "minimum": 1
    },
    "customer_cap_credits": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 0,
      "description": "Customer consent limit, not attributed revenue."
    },
    "outcomes": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/components/schemas/EconomicQuoteOutcome"
      },
      "description": "Provider-neutral charge outcomes admitted by the economic guard."
    }
  }
}

```

#### `#/components/schemas/EconomicQuoteOutcome`

```json

{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "action",
    "charge_credits"
  ],
  "properties": {
    "action": {
      "type": "string",
      "description": "Opaque action identifier for a quoted outcome. Internal tariff categories are omitted from this reference and should not be used as integration constants."
    },
    "charge_credits": {
      "type": "integer",
      "minimum": 0
    }
  }
}

```

### Complete operation object

```json

{
  "operationId": "postDataBatches",
  "tags": [
    "Data API"
  ],
  "summary": "Atomically validate and enqueue a batch",
  "x-required-scope": "scrape:write",
  "x-mcp-name": "data_create_batch",
  "x-mcp-annotations": {
    "readOnlyHint": false,
    "destructiveHint": false,
    "idempotentHint": false,
    "openWorldHint": true
  },
  "parameters": [
    {
      "$ref": "#/components/parameters/IdempotencyKey"
    }
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "jobs"
          ],
          "properties": {
            "jobs": {
              "type": "array",
              "minItems": 1,
              "items": {
                "$ref": "#/components/schemas/ScrapeRequest"
              },
              "description": "Raw scrape requests only; structured extraction is not accepted in a batch."
            }
          }
        }
      }
    }
  },
  "responses": {
    "202": {
      "description": "Batch accepted or idempotently replayed Error body uses the documented PublicError DTO.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/CreateBatchResponse"
          },
          "example": {
            "id": "9a20bd58-ed33-4a5b-b63f-b52bb1a62248",
            "status": "pending"
          }
        }
      },
      "headers": {
        "X-Credits-Charged": {
          "$ref": "#/components/headers/X-Credits-Charged"
        },
        "X-Credits-Remaining": {
          "$ref": "#/components/headers/X-Credits-Remaining"
        },
        "X-Credit-Pricing-Version": {
          "$ref": "#/components/headers/X-Credit-Pricing-Version"
        },
        "X-Route-Mode": {
          "$ref": "#/components/headers/X-Route-Mode"
        }
      }
    },
    "400": {
      "description": "Invalid batch or idempotency key Error body uses the documented PublicError DTO.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/PublicError"
          },
          "example": {
            "error": "Request failed",
            "code": "VALIDATION_ERROR",
            "message": "Invalid batch or idempotency key Error body uses the documented PublicError DTO.",
            "requestId": "req_01J2QG"
          }
        }
      },
      "x-docs-retryable": false
    },
    "409": {
      "description": "Idempotency conflict Error body uses the documented PublicError DTO.",
      "unavailable route": null,
      "or plan credit limit": null,
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/PublicError"
          },
          "example": {
            "error": "Request failed",
            "code": "RESULT_NOT_READY",
            "message": "Idempotency conflict Error body uses the documented PublicError DTO.",
            "requestId": "req_01J2QG"
          }
        }
      },
      "x-docs-retryable": true
    },
    "503": {
      "description": "Launch pricing is unavailable Error body uses the documented PublicError DTO.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/PublicError"
          },
          "example": {
            "error": "Request failed",
            "code": "PRICING_NOT_ACTIVE",
            "message": "Launch pricing is unavailable Error body uses the documented PublicError DTO.",
            "requestId": "req_01J2QG"
          }
        }
      },
      "x-docs-retryable": true
    }
  },
  "description": "Atomically validates and enqueues a batch of requests: either every item is accepted and the batch id is returned, or nothing is created. Use it for many URLs in one call and data_create_request for a single one. Follow up with data_wait_batch or data_get_batch. Send an Idempotency-Key so an exact-body retry replays the original batch instead of enqueuing a duplicate.",
  "security": [
    {
      "ApiKey": []
    },
    {
      "ApiKeyBearer": []
    }
  ],
  "servers": [
    {
      "url": "https://api.runharvester.com",
      "description": "RunHarvester public API"
    }
  ]
}

```