> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fetchfox.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Extract data from URLs

> The extract endpoint takes URLs and outputs structured data

The `/api/extract` endpoint converts page content into structured items.

## A simple extraction

Key parameters:

* `url` **or** `urls` (single URL or a list)
* `template` (string or object)

The template can be a dictionary or a string:

* **Dictionary/object**: output items follow the keys you provide.
* **String**: FetchFox infers a schema from your prompt.

Example:

<CodeGroup>
  ```bash curl theme={null}
  curl -X POST "https://api.fetchfox.ai/api/extract" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $FETCHFOX_API_KEY" \
  -d '{
     "urls": [
       "https://pokemondb.net/pokedex/bulbasaur",
       "https://pokemondb.net/pokedex/ivysaur",
       "https://pokemondb.net/pokedex/venusaur"
     ],
     "template": {
       "name": "Name of the pokemon",
       "number": "National pokedex number",
       "stats": "Base stats as a dictionary"
     }
  }'
  ```
</CodeGroup>

Response:

```json theme={null}
{
  "jobId": "j8rcgsnxq3",
  "results": {
    "items": [
      {
        "name": "Bulbasaur",
        "number": "0001",
        "stats": {
          "HP": 45,
          "Attack": 49,
          "Defense": 49,
          "Sp. Atk": 65,
          "Sp. Def": 65,
          "Speed": 45,
          "Total": 318
        },
        "_url": "https://pokemondb.net/pokedex/bulbasaur",
        "_htmlUrl": "https://ffcloud.s3.amazonaws.com/visit/html/4h0o70v9fh.html"
      },
      "...more results..."
    ]
  },
  "metrics": { "...cost and usage metrics..." }
}

```

## Extracting multiple items per URL

By default, FetchFox extracts one item per URL. To extract multiple items from each page, set `perPage` to `many`.

Example:

<CodeGroup>
  ```bash curl theme={null}
  curl -X POST "https://api.fetchfox.ai/api/extract" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $FETCHFOX_API_KEY" \
  -d '{
     "urls": [
       "https://pokemondb.net/pokedex/bulbasaur",
       "https://pokemondb.net/pokedex/ivysaur",
       "https://pokemondb.net/pokedex/venusaur"
     ],
     "template": {
       "moveName": "Name of the pokemon move",
       "moveType": "Name of the move type",
       "movePower": "The power of the move"
     },
     "perPage": "many"
  }'
  ```
</CodeGroup>

Response:

```json theme={null}
{
  "jobId": "fjszygdh38",
  "results": {
    "items": [
      {
        "moveName": "Growl",
        "moveType": "Normal",
        "movePower": "100",
        "_url": "https://pokemondb.net/pokedex/ivysaur",
        "_htmlUrl": "https://ffcloud.s3.amazonaws.com/visit/html/xz6rjf8h2v.html"
      },
      {
        "moveName": "Growth",
        "moveType": "Normal",
        "movePower": "—",
        "_url": "https://pokemondb.net/pokedex/ivysaur",
        "_htmlUrl": "https://ffcloud.s3.amazonaws.com/visit/html/xz6rjf8h2v.html"
      },
      "...more items..."
    ]
  },
  "metrics": { "...cost and usage metrics..." }
}
```

When `perPage: "many"` is used, the response includes a `divide` artifact showing the selector used to split the page into repeated item blocks.

## Boosted extractions

The first few extractions for a given page pattern and template are usually done by sending page HTML to an AI model.

After FetchFox has a few successful examples, the backend asks a more advanced model to write extraction code for that pattern and template. Later extractions can then run that generated code directly.

That means repeated extractions usually get faster over time, and boosted runs typically have no AI cost for the extraction step.

* [Read more about boosted extractions](/boosted-extractions)
