# Fetch API: the address is the request, fields come back | Spider

Spider's fetch API reads a page from its address. Put the site and path after /fetch/ and named fields come back. Bandwidth from $1 per GB; cost varies by site.

Canonical: https://spider.cloud/api/fetch/

Put the site and the path after /fetch/ and send an empty body. Spider works out the selectors for that page, saves them to your account and returns named fields.

Request

```
curl "https://api.spider.cloud/fetch/books.toscrape.com/catalogue/its-only-the-himalayas_981/index.html" \  -H "Authorization: Bearer $SPIDER_API_KEY" \  -H "Content-Type: application/json" \  -d '{}'
```

Response 200, css_extracted

```
"css_extracted": {  "product_availability": ["In stock (19 available)", "In stock"],  "product_image": ["[../../media/cache/6d/41/6d418a73cc7d4ecfd75ca11d854041db.jpg](\"It's Only the Himalayas\")"],  "product_price": ["£45.17", "£51.33", "£37.59", "£23.88", "£57.25", "£35.02", "£52.29"],  "product_title": ["It's Only the Himalayas"],  ...}
```

Recorded November 19, 2026 against books.toscrape.com, a public sandbox site. Call c of 4. The 4 recorded calls that day took 7.26 s to 52.34 s each, timed from a laptop. The 4 product fields of 7 are shown verbatim, and the rest are under What comes back.

In [the call shown here](#recorded-run), a body of 2 bytes named no selectors and got 7 named fields back from a book page.

Bandwidth from $1 per GB plus $0.0001 per minute a request runs. Cost varies by site.

[Get an API key](https://spider.cloud/register/)

readings call c

- Fields returned

  - 7
  - named lists in `css_extracted`, call c

- Selectors you wrote

  - 0
  - Spider worked them out and saved them

- Body sent

  - 2 bytes
  - the whole request body, `{}`

- Bandwidth

  - From $1 per GB
  - plus $0.0001 per minute a request runs

## What comes back

A JSON array with one object for the page. Every recorded call returned one, and these are its fields.

Each field is a list of every match for its selector, not one value. `product_price` held 7 prices: the book's own, £45.17, first, then the prices of the 6 related books on the page. Take the first item when you want the book's own, and check a field against the page before you rely on it.

Spider picks the field names, and they can change between calls until the config settles. The first recorded call returned 6 fields, with `product_image_url`. The next 3 returned 7, with `product_image` and `related_product_image`.

the first match

```
page["css_extracted"]["product_price"][0]   # "£45.17"
```

css_extracted, call c

```
"css_extracted": {  "product_availability": ["In stock (19 available)", "In stock"],  "product_image": ["[../../media/cache/6d/41/6d418a73cc7d4ecfd75ca11d854041db.jpg](\"It's Only the Himalayas\")"],  "product_price": ["£45.17", "£51.33", "£37.59", "£23.88", "£57.25", "£35.02", "£52.29"],  "product_title": ["It's Only the Himalayas"],  "related_product_availability": ["In stock (19 available)", "In stock"],  "related_product_image": ["[../../media/cache/0b/bc/0bbcd0a6f4bcd81ccb1049a52736406e.jpg](\"Libertarianism for Beginners\")", "[../../media/cache/09/a3/09a3aef48557576e1a85ba7efea8ecb7.jpg](\"Mesaerion: The Best Science Fiction Stories 1800-1849\")", "[../../media/cache/55/33/553310a7162dfbc2c6d19a84da0df9e1.jpg](\"Olio\")", "[../../media/cache/54/60/54607fe8945897cdcced0044103b10b6.jpg](\"Our Band Could Be Your Life: Scenes from the American Indie Underground, 1981-1991\")", "[../../media/cache/81/c4/81c4a973364e17d01f217e1188253d5e.jpg](\"Rip it Up and Start Again\")", "[../../media/cache/94/b1/94b1b8b244bce9677c2f29ccc890d4d2.jpg](\"Scott Pilgrim's Precious Little Life (Scott Pilgrim #1)\")"],  "related_product_price": ["£45.17", "£51.33", "£37.59", "£23.88", "£57.25", "£35.02", "£52.29"]}
```

field

- `css_extracted`

  The named fields. Each is a list of every match for its selector. Call c returned 7.

- `content`

  The page's main region. With no format set it is HTML, 13,690 characters in call c. With `return_format` set to markdown it was 3,655 characters of markdown.

- `metadata`

  `extracted_data` repeats the named fields. It also holds the page `title`, `description`, `domain`, `pathname` and `file_size`.

- `costs`

  What this call cost, in dollars. `total_cost` is the sum, and each part has a text twin ending in `_formatted`.

- `url`

  The page that was read. In the recording it is https\://books.toscrape.com/catalogue/its-only-the-himalayas_981/index.html.

- `status`

  A status code for the page. It was 200 in every call. Read `error` to learn whether the call worked.

- `error`

  null when the call worked, and the reason as text when it did not.

`content` is HTML when the body sets no format. Call c returned 13,690 characters of it, starting at `<article class="product_page"><!-- Start of product page -->`. The call that sent `return_format` as markdown got 3,655 characters of markdown, starting like this.

content, markdown

```
![It&#39;s Only the Himalayas](../../media/cache/6d/41/6d418a73cc7d4ecfd75ca11d854041db.jpg)
# It's Only the Himalayas
£45.17
```

## How the settings are found

A config is the set of selectors and reading settings for one page. Your account keeps one for each site and path you call.

1. 1

   A saved config

   Spider looks for a saved config for this site and this exact path. It checks your account's own first, then one Spider keeps for that path. When it finds one, it reads the page with it.

2. 2

   The first call

   With neither, the first call works one out. Spider reads the page, proposes a selector for each field, checks every selector against the page and drops the ones that match nothing. Then it saves the config to your account.

3. 3

   A config that stops working

   A config that keeps failing is dropped, and a later call works out a new one.

- What a config holds

  Selectors for the main content and for each field, whether the page needs a browser or a plain request, and scroll and wait settings.

- Whose it is

  A config Spider works out on your call is saved to your account and is not shared with other customers. Spider also keeps a small set of configs of its own, and every account can use those. With zero data retention on your account, nothing about your config is saved.

## Fetch or scrape

Both read a page and bill the same way. They differ in who writes the selectors and what is kept between calls.

Use fetch when

- You want named fields from a page and would rather not write the selectors.

- You read the same page again and want its settings kept in your account.

- You want the page in the address and nothing required in the body.

Use scrape when

- You know the selectors and want to pass them yourself, in `css_extraction_map`.

- You want each call to start from your own options, with nothing saved between calls.

- You want the page content only, with no fields worked out.

## What the request takes

The address names the page. The body is optional: 3 of the 4 recorded calls sent `{}`.

- {domain}

  - address
  - required
  - The site to read, right after /fetch/. In the recording, books.toscrape.com.

- {path}

  - address
  - site root
  - The rest of the address, slashes and all. Each path is its own saved config. A query string on the address is dropped.

- return_format

  - body
  - not set
  - With none set, `content` is HTML. The one recorded call that sent markdown got markdown.

- limit

  - body
  - not set
  - Above 1, the call crawls from that page, up to 100 pages. No recorded call set it.

- scrape options

  - body
  - not set
  - The body takes the options /scrape takes, and they override the saved settings for this call. A `url` in the body is ignored.

When a call does not work

- 400

  The address is not a site and a path. The body is {"error":"Invalid fetch URL. Use /fetch/{domain}/{path}"}. A GET gets a 400 too, because only POST is served.

- 503

  Spider could not read the page to work out a config. The call can be retried, and the Retry-After header says when.

## The same call in three forms

The samples are plain HTTP requests. The Python and JavaScript ones print the first price. Each ran once against the recorded address on November 20, 2026, UTC, and printed £45.17.

[Run this](https://spider.cloud/playground/?mode=fetch\&url=https%3A%2F%2Fbooks.toscrape.com%2Fcatalogue%2Fits-only-the-himalayas_981%2Findex.html\&src=api_fetch_run)

```
curl "https://api.spider.cloud/fetch/books.toscrape.com/catalogue/its-only-the-himalayas_981/index.html" \  -H "Authorization: Bearer $SPIDER_API_KEY" \  -H "Content-Type: application/json" \  -d '{}'
```

```
import os, requests res = requests.post(    "https://api.spider.cloud/fetch/books.toscrape.com/catalogue/its-only-the-himalayas_981/index.html",    headers={"Authorization": f"Bearer {os.environ['SPIDER_API_KEY']}"},    json={},)page = res.json()[0] print(page["css_extracted"]["product_price"][0])
```

```
const res = await fetch(  "https://api.spider.cloud/fetch/books.toscrape.com/catalogue/its-only-the-himalayas_981/index.html",  {    method: "POST",    headers: {      Authorization: `Bearer ${process.env.SPIDER_API_KEY}`,      "Content-Type": "application/json",    },    body: "{}",  },);const [page] = await res.json(); console.log(page.css_extracted.product_price[0]);
```

## What a fetch costs

Pay as you go from $1 per GB of bandwidth plus $0.0001 per minute a request runs. No subscription. Top up from $5.

- The recorded readings

  The 4 calls on this page, recorded November 19, 2026 against books.toscrape.com, reported from $0.0000547 to $0.0000743 in costs.total_cost. The markdown call reported $0.0000179 in transform_cost, and the others 0. These are readings of one page, not a price.

- Working out a config

  A fetch is metered like a scrape, and working out the config adds no charge. If the selectors find nothing, an AI extraction can run instead, and its cost shows in costs.ai_cost. It was 0 in every recorded call.

- Cost differs by site

  An attempt bills only the bandwidth it used and the time it ran. Cost varies by site. Every response reports its own cost in costs.total_cost.

## Common questions

Are the configs Spider saves shared with other accounts?

No. A config Spider works out on your call is saved to your account, used for your calls and not shared with other customers. Spider also keeps a small set of configs of its own, and every account can use those. With zero data retention on your account, nothing about your config is saved.

Does a config for one page work for another page on the same site?

No. A config is saved for a site and an exact path, so /a and /b on one site are two configs. The first call to each works out its own, unless Spider already keeps one for that path.

What happens when Spider cannot read the page?

The call returns a 503 that can be retried, with a Retry-After header that says when. An address that is not a site and a path returns a 400 with the error Invalid fetch URL. Use /fetch/{domain}/{path}.

Why does a field hold more than one value?

Each field is a list of every match for its selector on the page. In the call recorded on November 19, 2026, product_price held 7 prices: the book's own, £45.17, first, then those of the 6 related books. Take the first item for the book's own price.

What is in content?

With no return_format, content is HTML, the main region of the page: 13,690 characters in the recorded call. Send return_format set to markdown and it comes back as markdown, 3,655 characters for the same page. The named fields are in css_extracted either way.

Can I change the settings Spider saved?

You can override them on any call. The body takes the options /scrape takes, and they apply to that call over the saved settings. A url in the body is ignored, because the address names the page.

### Keep reading

[Scrape API](https://spider.cloud/api/scrape/)

[Any URL in the body, with your own options and selectors on every call.](https://spider.cloud/api/scrape/)

[Crawl API](https://spider.cloud/api/crawl/)

[Follow a site's links from one URL and get each page's content.](https://spider.cloud/api/crawl/)

[Fetch API reference](https://spider.cloud/docs/api/fetch/)

[The request and the response for POST /fetch/{domain}/{path}.](https://spider.cloud/docs/api/fetch/)

## Fetch one page of your own

Pay as you go with bandwidth from $1 per GB, and every response tells you what that call cost.

[Get an API key](https://spider.cloud/register/)
