# AI Data Extraction API - Spider

Extract structured data from websites with AI pipelines. Pull contacts, generate Q&A pairs, label sites by category and filter links, from one API call.

Canonical: https://spider.cloud/api/ai-extraction/

## Crawl plus AI in one request.

For teams building a lead list, a training set or a directory. Name a site and one pipeline call crawls it, reads each page with a model, and returns contacts, Q\&A pairs, labels or the links worth keeping.

POST /pipeline/extract-contacts, the first 10 pages of one site

```
curl -X POST https://api.spider.cloud/pipeline/extract-contacts \
  -H "Authorization: Bearer $SPIDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"url\": \"$TARGET_URL\", \"limit\": 10}"
```

TARGET_URL is the site you want contacts from, and SPIDER_API_KEY holds your key. The contacts found are stored on your account, where the contacts data API returns them.

[Get an API key](https://spider.cloud/register/) [Try in playground](https://spider.cloud/docs/api/)

## Each pulls a different shape.

- Extract contacts `POST /pipeline/extract-contacts`

  Crawls the site and has a model pick out email addresses, phone numbers, social profiles and business details. The contacts are stored on your account, and the contacts data API returns them.

  For lead lists, sales research, company records

- Questions & answers `POST /pipeline/extract-qa`

  Crawls the site and writes question and answer pairs from its pages. Give it a topic and each answer comes from text on a page it read.

  For faq pages, training sets, knowledge bases

- Label website `POST /pipeline/label`

  Crawls the site and sorts it into topics, industries or labels you name.

  For directories, lead sorting, large url lists

- Filter links `POST /pipeline/filter-links`

  Crawls the site's links and keeps the ones that match what you describe: a topic, a content type or a rule of your own.

  For focused crawls, content-type filters, custom rules

- Crawl from text `POST /pipeline/crawl-text`

  Send text or markdown with URLs in it, such as a document, an email body or your notes. Spider pulls out every link and crawls each one.

The v1 pipelines are deprecated. For new work, the [Fetch API](https://spider.cloud/api/fetch/) returns structured data from configs the AI discovers for each site, and the [Scraper API](https://spider.cloud/api/scrape/) takes a `css_extraction_map` for custom extraction.

## The same call in three languages.

```
import os
from spider import Spider

client = Spider()

# TARGET_URL is the company site you want contacts from.
# The first 10 pages of it are crawled and read.
contacts = client.api_post(
    "pipeline/extract-contacts",
    {"url": os.environ["TARGET_URL"], "limit": 10},
)

for contact in contacts:
    print(contact)
```

```
curl -X POST https://api.spider.cloud/pipeline/extract-contacts \
  -H "Authorization: Bearer $SPIDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"url\": \"$TARGET_URL\", \"limit\": 10}"
```

```
const response = await fetch("https://api.spider.cloud/pipeline/extract-contacts", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.SPIDER_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ url: process.env.TARGET_URL, limit: 10 }),
});

console.log(await response.json());
```

### More from the API.

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

[The base crawling that powers AI pipelines](https://spider.cloud/api/crawl/)

[Lead Generation Guide](https://spider.cloud/use-cases/lead-generation/)

[Build lead gen workflows with Spider](https://spider.cloud/use-cases/lead-generation/)

[AI Training Data](https://spider.cloud/use-cases/ai-training/)

[Collect data for model training](https://spider.cloud/use-cases/ai-training/)

## Five pipelines, one crawl each.

Each one crawls the site you name and reads its pages with a model, on the same key as every other endpoint. For new work, Fetch or Scrape fits better, and both return structured fields beyond raw HTML.

[View all APIs](https://spider.cloud/api/)
