AI API
Every AI endpoint takes a plain English prompt alongside the parameters you already use on the standard API. Spider plans the work, cleans the page, and returns data shaped by that prompt. Six routes cover crawling, scraping, search, browser automation, link discovery, and unblocking, all on one request and response contract.
- Base URL
- https://api.spider.cloud
- Method
- POST
- Auth
- Bearer API key
- Access
- AI Studio subscription
On this page
Routes
Six routes, all POST only. Any other method returns 400. Each one also answers on a /v1 alias, so /v1/ai/crawl is equivalent to /ai/crawl.
- POST /ai/crawlCrawl a site from one starting URL and let the prompt decide what matters on each page.
- POST /ai/scrapeFetch a single URL and extract exactly what the prompt asks for.
- POST /ai/searchRun a web search driven by the prompt and return ranked results.
- POST /ai/browserDrive a real browser session with a natural language prompt, so clicks, toggles and form steps happen before extraction.
- POST /ai/linksCollect the links on a page that match the prompt.
- POST /ai/unblockerFetch a page that is behind bot protection and hand the cleaned result to the model.
How AI routes differ
The request and response contract matches the standard API. Six things behave differently once a prompt is involved.
- A prompt, not a selector
Describe the data you want in plain language. There is no CSS path to maintain when the markup changes.
- Everything the standard route takes
Each AI route accepts the full parameter surface of its non-AI counterpart, plus the AI fields.
- Structured output
Results arrive on metadata.extracted_data, shaped by extraction_schema when you supply one.
- Always a real browser
AI routes cache, but they never skip the browser, so the model reads live page content.
- Separate billing
AI routes require an active AI Studio subscription, and each request spends credits against it.
- Model cost passed through
ai_cost is the raw vendor token spend and is excluded from domain markup.
Authentication
Send your API key as a bearer token against https://api.spider.cloud. The same key works across every Spider endpoint.
AI routes also require an active AI Studio subscription , and every request spends credits against it. A key that works on /crawl can still be refused here. See Errors for what that looks like.
Authorization header requiredBearer YOUR_API_KEY. Requests without it fail with an empty 400.
Content-Type header requiredapplication/json.
Common parameters
These apply across the AI routes. Each route additionally accepts everything its standard counterpart takes, so the Parameters reference covers proxies, geo-location, caching, headers and the rest.
prompt string requiredNatural language description of what to do and what to pull back. An empty prompt is rejected with a 400.
extraction_schema object optionalShape for the structured result. Takes `name` (required), `description` (optional) and `schema`, which may be a JSON object or a JSON encoded string.
cleaning_intent "extraction" | "action" | "general" optional, crawl / scrape / links / unblocker onlyHow aggressively the HTML is reduced before the model reads it. Use "extraction" for data pulls, "action" to keep interactive elements, "general" for a balanced clean. Not accepted on /ai/search or /ai/browser.
metadata boolean default falseReturn page metadata such as title and description. Note that `metadata.extracted_data` is attached to the response either way, so structured output never depends on this flag.
return_format string optionalContent shape for each page, for example "markdown", "raw", "text" or "commonmark".
limit number optionalMaximum pages to process. The value is lifted internally into a crawl budget of `{"*": limit}`.
An extraction_schema pins the output shape. Pass schema as an object, or as a JSON encoded string if that is easier to carry through your client.
Response
Every AI route returns a JSON array of page objects, even when you asked for a single URL. Two fields catch people out, so they are called out below.
url string alwaysThe URL this result came from.
status number alwaysHTTP status returned by the target page, not by the Spider API.
error string | null alwaysPer page error. Null on success. A page can fail while the request as a whole returns 200.
duration_elasped_ms number alwaysTime spent on this page. Note the spelling: "elasped" is part of the public contract, so reading duration_elapsed_ms returns undefined.
costs object | null alwaysCost breakdown in USD. It is null, not an object of zeros, whenever the request bills nothing, so check before reading total_cost.
metadata.extracted_data object alwaysThe structured result. It is attached whether or not you passed metadata: true.
content string conditionalPage content in the shape named by return_format. Omitted when no content was requested.
links string[] conditionalDiscovered links. Always present on /ai/links, which forces link return on.
Endpoints
Six references, each one listing only what is specific to that route. Everything in Common parameters applies to all of them.
AI Crawl
POST /ai/crawlCrawl a site from one starting URL and let the prompt decide what matters on each page. Returns an array of pages with structured data attached.
depth number optionalHow many link levels below the starting URL to follow.
AI Scrape
POST /ai/scrapeFetch a single URL and extract exactly what the prompt asks for. Pair it with an extraction_schema when you need a stable shape.
AI Search
POST /ai/searchRun a web search driven by the prompt and return ranked results. Pass `search` yourself to skip query generation, or leave it off and the prompt becomes the query.
search string optional, search onlyThe literal search query. When omitted, a query is generated from the prompt.
fetch_page_content boolean default false, search onlyFetch and return the content of each result page instead of the result listing alone.
num number optional, search onlyNumber of search results to return.
AI Browser
POST /ai/browserDrive a real browser session with a natural language prompt, so clicks, toggles and form steps happen before extraction. Best for pages that only reveal data after interaction.
wait_for object optionalA WaitFor struct, not a number. Fields are `selector` and `dom` (each `{ timeout, selector }`), `idle_network`, `idle_network0` and `almost_idle_network0` (each `{ timeout }`), `delay` (`{ timeout }`) and the boolean `page_navigations`. Every timeout is a duration object of `{ secs, nanos }`.
AI Links
POST /ai/linksCollect the links on a page that match the prompt. Link return is forced on for this route, so every page object carries a `links` array.
return_page_links boolean forced onAlways enabled for this route. You do not need to send it, and sending false does not disable it.
AI Unblocker
POST /ai/unblockerFetch a page that is behind bot protection and hand the cleaned result to the model. Use it when a normal scrape returns a challenge page.
Errors
Three failures account for nearly everything you will see. The status code is the whole signal on the first one, since it arrives with no body.
Returned with an empty body. There is no message to parse. It covers malformed JSON, a missing or empty prompt, an unrecognised field, a missing Authorization header, and an unresolvable API key. If a request fails with nothing in the body, check those first.
The account has no active AI Studio subscription, or the subscription has no credits left to spend. Plans are on the AI Studio pricing page .
Carries a Retry-After header in seconds, and retry_after_ms in the body. Back off for that long rather than retrying immediately.
Rate limits
AI routes are limited by requests per second on the account's AI Studio tier, separately from the monthly credit allowance.
| Tier | Requests per second | Credits per month |
|---|---|---|
| Starter | 1 | 600 |
| Lite | 5 | 3,000 |
| Standard | 10 | 12,500 |
| Scale | 25 | 60,000 |
Looking for the non-AI routes? Start at the API reference . For plans and included credits, see AI Studio pricing .