websearch.fast
ConsoleGet a key

Batch

Up to 100 calls in one request.

Runs many calls in one request. Each item names an endpoint and carries that endpoint's request body. Items for search, fetch, autocomplete, knowledge, geocode and reverse-geocode run. Items for places/details and extract answer 501 api_not_implemented each. An item for research, crawl, map, lens or batch refuses the whole batch with 400 invalid_request.

The sync mode takes 1 to 100 items with at most 100 URLs in total and answers within 60 seconds; items not finished by then come back as 504 timeout and are free. custom_id is optional, at most 64 bytes and unique within the batch. webhook_url and metadata are refused with 400 in sync mode.

The sync response lists results in request order, each with the HTTP status the call would have had alone and its response or error body. The batch itself is 200 whenever the outer body was valid. The async mode (up to 20,000 items as a job) is planned and answers 501 api_not_implemented.

What is charged

Each item is charged by the rule of its own endpoint. Items that failed are free.

Many calls in one request

POST https://api.websearch.fast/v1/web/batch

mode: sync is available; mode: async is planned.

Headers

NameTypeDescription
Idempotency-Keystring1 to 128 bytes; a retry with the same key and body within 24 hours returns the same job. 1 to 128 characters.

Body

NameTypeDescription
requestsrequiredarray of objectsync: 1 to 100 items; async: 1 to 20000. The fetch items of a sync batch name at most 100 URLs in total, otherwise 400. Items for endpoints that have not shipped answer 501 in their own result; mode async answers 501 until S3. 1 to 20,000 items.
Show fields
NameTypeDescription
custom_idstringYour id, at most 64 bytes and unique in the batch, otherwise 400. Defaults to the index as a string. At most 64 characters.
endpointrequiredstringOne of search, fetch, autocomplete, knowledge, geocode, reverse-geocode, places/details, extract.
bodyrequiredobjectThe request body of that endpoint.
modestringOne of sync, async. Default sync.
webhook_urlstringAsync only; refused with 400 in sync mode. Public https URL that receives the final job object, signed with webhook_secret. At most 500 characters.
metadataobjectAsync only; refused with 400 in sync mode. Your own string values, echoed on the job; at most 4 KB.

Example request

curl https://api.websearch.fast/v1/web/batch \
  -H "Authorization: Bearer $WEBSEARCH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "requests": [
      {
        "custom_id": "q1",
        "endpoint": "search",
        "body": {"q": "postgres 18 release notes", "num": 3}
      },
      {
        "custom_id": "q2",
        "endpoint": "fetch",
        "body": {"url": "https://www.example.org/changelog"}
      }
    ]
  }'
import os
import httpx

response = httpx.post(
    "https://api.websearch.fast/v1/web/batch",
    headers={"Authorization": f"Bearer {os.environ['WEBSEARCH_API_KEY']}"},
    json={
        "requests": [
            {
                "custom_id": "q1",
                "endpoint": "search",
                "body": {"q": "postgres 18 release notes", "num": 3},
            },
            {
                "custom_id": "q2",
                "endpoint": "fetch",
                "body": {"url": "https://www.example.org/changelog"},
            },
        ],
    },
    timeout=60,
)
response.raise_for_status()
print(response.json())
const response = await fetch("https://api.websearch.fast/v1/web/batch", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.WEBSEARCH_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    requests: [
      {
        custom_id: "q1",
        endpoint: "search",
        body: { q: "postgres 18 release notes", num: 3 },
      },
      {
        custom_id: "q2",
        endpoint: "fetch",
        body: { url: "https://www.example.org/changelog" },
      },
    ],
  }),
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(await response.json());

Example response

{
  "object": "web.batch",
  "request_id": "20261128120006123456789a1b2c3d4Kx7Qm2Pf",
  "created": 1795867206,
  "results": [
    {
      "index": 0,
      "custom_id": "q1",
      "status": 200,
      "body": {
        "object": "web.search",
        "results": [],
        "warnings": [{"code": "no_results"}]
      }
    },
    {
      "index": 1,
      "custom_id": "q2",
      "status": 422,
      "body": {
        "error": {
          "code": "fetch_failed",
          "message": "The page could not be read.",
          "type": "invalid_request_error",
          "param": "url"
        }
      }
    }
  ],
  "usage": {"charged": false, "items": []}
}

Response fields (200)

Sync batch (mode sync, S2): per-item status and body.

NameTypeDescription
objectrequiredstringAlways web.batch.
request_idrequiredstringSame as the X-Request-Id header.
createdrequiredintegerUnix seconds (UTC).
usagerequiredobject
Show fields
NameTypeDescription
chargedrequiredboolean
itemsrequiredarray of object
Show fields
NameTypeDescription
unitrequiredstringBillable unit, for example search_web, content_page, fetch_page, geocode, autocomplete, knowledge.
countrequiredinteger
warningsarray of object
Show fields
NameTypeDescription
coderequiredstringFor example no_results, content_partial, answer_unavailable, partial, all_failed, reach_reduced.
messagestring
paramstring
resultsrequiredarray of object
Show fields
NameTypeDescription
indexrequiredinteger
custom_idstring
statusrequiredintegerHTTP status the call would have had alone.
bodyrequiredobjectResponse or error body of the item.

Response fields (202)

Async batch job created (mode async, S3).

NameTypeDescription
objectrequiredstringAlways web.batch_job.
idrequiredstringAt most 64 characters. Starts with wb_.
statusrequiredstringOne of queued, running, succeeded, failed, cancelled.
stop_reasonstringOne of completed, budget, limit, cancelled, deadline, error.
created_atrequiredinteger
started_atinteger
completed_atinteger
inputrequiredobject
usagerequiredobject
Show fields
NameTypeDescription
itemsrequiredarray of object
Show fields
NameTypeDescription
unitrequiredstringBillable unit, for example search_web, content_page, fetch_page, geocode, autocomplete, knowledge.
countrequiredinteger
errorobject
Show fields
NameTypeDescription
coderequiredstring
messagestring
poll_after_msinteger
webhook_secretstringOnly in the create response, when webhook_url was set.
metadataobject
expires_atinteger
progressobject
Show fields
NameTypeDescription
totalinteger
doneinteger
okinteger
failedinteger

Errors

StatusCodes
400invalid_request, invalid_url, invalid_schema or invalid_image. Not charged.
401invalid_token. Not charged.
403pre_consume_token_quota_failed (the key's own spending limit), access_denied, web_not_allowed or model_not_in_plan (customer keys while plans cannot include the web tools). Not charged.
404not_found or invalid_endpoint. Not charged.
409idempotency_conflict or request_in_progress. Not charged.
413read_request_body_failed: the request body is over the limit. Not charged.
429rate_limited, concurrency_limited, api_key_temporarily_frozen, or the failure guard. Not charged.
500internal_error. Not charged.
501api_not_implemented: the endpoint, type or option has not shipped. Not charged.
503source_unavailable, web_api_disabled, token_cache_busy or billing_busy (the charge could not be prepared in time; retry after Retry-After). Not charged.
504timeout. Not charged.

Get an async batch

GET https://api.websearch.fast/v1/web/batch/{id}

Planned. Until it ships, calls return 501 api_not_implemented.

Path parameters

NameTypeDescription
idrequiredstringStarts with wb_.

Example request

curl https://api.websearch.fast/v1/web/batch/wb_01JD7S2N5T \
  -H "Authorization: Bearer $WEBSEARCH_API_KEY"
import os
import httpx

response = httpx.get(
    "https://api.websearch.fast/v1/web/batch/wb_01JD7S2N5T",
    headers={"Authorization": f"Bearer {os.environ['WEBSEARCH_API_KEY']}"},
    timeout=60,
)
response.raise_for_status()
print(response.json())
const response = await fetch("https://api.websearch.fast/v1/web/batch/wb_01JD7S2N5T", {
  method: "GET",
  headers: {
    Authorization: `Bearer ${process.env.WEBSEARCH_API_KEY}`,
  },
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(await response.json());

Response fields

The job.

NameTypeDescription
objectrequiredstringAlways web.batch_job.
idrequiredstringAt most 64 characters. Starts with wb_.
statusrequiredstringOne of queued, running, succeeded, failed, cancelled.
stop_reasonstringOne of completed, budget, limit, cancelled, deadline, error.
created_atrequiredinteger
started_atinteger
completed_atinteger
inputrequiredobject
usagerequiredobject
Show fields
NameTypeDescription
itemsrequiredarray of object
Show fields
NameTypeDescription
unitrequiredstringBillable unit, for example search_web, content_page, fetch_page, geocode, autocomplete, knowledge.
countrequiredinteger
errorobject
Show fields
NameTypeDescription
coderequiredstring
messagestring
poll_after_msinteger
webhook_secretstringOnly in the create response, when webhook_url was set.
metadataobject
expires_atinteger
progressobject
Show fields
NameTypeDescription
totalinteger
doneinteger
okinteger
failedinteger

Errors

StatusCodes
400invalid_request, invalid_url, invalid_schema or invalid_image. Not charged.
401invalid_token. Not charged.
403pre_consume_token_quota_failed (the key's own spending limit), access_denied, web_not_allowed or model_not_in_plan (customer keys while plans cannot include the web tools). Not charged.
404not_found or invalid_endpoint. Not charged.
413read_request_body_failed: the request body is over the limit. Not charged.
429rate_limited, concurrency_limited, api_key_temporarily_frozen, or the failure guard. Not charged.
500internal_error. Not charged.
501api_not_implemented: the endpoint, type or option has not shipped. Not charged.
503source_unavailable, web_api_disabled, token_cache_busy or billing_busy (the charge could not be prepared in time; retry after Retry-After). Not charged.
504timeout. Not charged.

Results of an async batch

GET https://api.websearch.fast/v1/web/batch/{id}/results

Planned. Until it ships, calls return 501 api_not_implemented.

Path parameters

NameTypeDescription
idrequiredstringStarts with wb_.

Query parameters

NameTypeDescription
starting_afterstringnext_cursor of the previous page.
limitinteger1 to 1000. Default 100.

Example request

curl "https://api.websearch.fast/v1/web/batch/wb_01JD7S2N5T/results?limit=100" \
  -H "Authorization: Bearer $WEBSEARCH_API_KEY"
import os
import httpx

response = httpx.get(
    "https://api.websearch.fast/v1/web/batch/wb_01JD7S2N5T/results",
    headers={"Authorization": f"Bearer {os.environ['WEBSEARCH_API_KEY']}"},
    params={
        "limit": 100,
    },
    timeout=60,
)
response.raise_for_status()
print(response.json())
const response = await fetch("https://api.websearch.fast/v1/web/batch/wb_01JD7S2N5T/results?limit=100", {
  method: "GET",
  headers: {
    Authorization: `Bearer ${process.env.WEBSEARCH_API_KEY}`,
  },
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(await response.json());

Response fields

Finished items in request order.

NameTypeDescription
objectrequiredstringAlways list.
datarequiredarray of object
Show fields
NameTypeDescription
indexrequiredinteger
custom_idstring
statusrequiredintegerHTTP status the call would have had alone.
bodyrequiredobjectResponse or error body of the item.
has_morerequiredboolean
next_cursorstring

Errors

StatusCodes
400invalid_request, invalid_url, invalid_schema or invalid_image. Not charged.
401invalid_token. Not charged.
403pre_consume_token_quota_failed (the key's own spending limit), access_denied, web_not_allowed or model_not_in_plan (customer keys while plans cannot include the web tools). Not charged.
404not_found or invalid_endpoint. Not charged.
413read_request_body_failed: the request body is over the limit. Not charged.
429rate_limited, concurrency_limited, api_key_temporarily_frozen, or the failure guard. Not charged.
500internal_error. Not charged.
501api_not_implemented: the endpoint, type or option has not shipped. Not charged.
503source_unavailable, web_api_disabled, token_cache_busy or billing_busy (the charge could not be prepared in time; retry after Retry-After). Not charged.
504timeout. Not charged.

Cancel an async batch

POST https://api.websearch.fast/v1/web/batch/{id}/cancel

Planned. Until it ships, calls return 501 api_not_implemented.

Path parameters

NameTypeDescription
idrequiredstringStarts with wb_.

Example request

curl -X POST https://api.websearch.fast/v1/web/batch/wb_01JD7S2N5T/cancel \
  -H "Authorization: Bearer $WEBSEARCH_API_KEY"
import os
import httpx

response = httpx.post(
    "https://api.websearch.fast/v1/web/batch/wb_01JD7S2N5T/cancel",
    headers={"Authorization": f"Bearer {os.environ['WEBSEARCH_API_KEY']}"},
    timeout=60,
)
response.raise_for_status()
print(response.json())
const response = await fetch("https://api.websearch.fast/v1/web/batch/wb_01JD7S2N5T/cancel", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.WEBSEARCH_API_KEY}`,
  },
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(await response.json());

Response fields

The job.

NameTypeDescription
objectrequiredstringAlways web.batch_job.
idrequiredstringAt most 64 characters. Starts with wb_.
statusrequiredstringOne of queued, running, succeeded, failed, cancelled.
stop_reasonstringOne of completed, budget, limit, cancelled, deadline, error.
created_atrequiredinteger
started_atinteger
completed_atinteger
inputrequiredobject
usagerequiredobject
Show fields
NameTypeDescription
itemsrequiredarray of object
Show fields
NameTypeDescription
unitrequiredstringBillable unit, for example search_web, content_page, fetch_page, geocode, autocomplete, knowledge.
countrequiredinteger
errorobject
Show fields
NameTypeDescription
coderequiredstring
messagestring
poll_after_msinteger
webhook_secretstringOnly in the create response, when webhook_url was set.
metadataobject
expires_atinteger
progressobject
Show fields
NameTypeDescription
totalinteger
doneinteger
okinteger
failedinteger

Errors

StatusCodes
400invalid_request, invalid_url, invalid_schema or invalid_image. Not charged.
401invalid_token. Not charged.
403pre_consume_token_quota_failed (the key's own spending limit), access_denied, web_not_allowed or model_not_in_plan (customer keys while plans cannot include the web tools). Not charged.
404not_found or invalid_endpoint. Not charged.
413read_request_body_failed: the request body is over the limit. Not charged.
429rate_limited, concurrency_limited, api_key_temporarily_frozen, or the failure guard. Not charged.
500internal_error. Not charged.
501api_not_implemented: the endpoint, type or option has not shipped. Not charged.
503source_unavailable, web_api_disabled, token_cache_busy or billing_busy (the charge could not be prepared in time; retry after Retry-After). Not charged.
504timeout. Not charged.