TafScraper API docs
Get the data you need from any website, in a few lines of code
Send a URL, get back clean page data: titles, text, links, images, and on request the brand, navigation, contacts and SEO details. Need one thing only, like prices or emails? Contextual Scrape picks it out for you.
https://api.tafscraper.comQuickstart
A scrape runs in the background. You start it, then check on it. If someone already scraped the same URL with the same settings, you get the pages straight away.
curl -X POST https://api.tafscraper.com/api/v1/scrape \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com", "config": {"max_pages": 10}}'const API = "https://api.tafscraper.com";
const headers = { "X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json" };
// 1. Start the scrape
const start = await fetch(`${API}/api/v1/scrape`, {
method: "POST",
headers,
body: JSON.stringify({ url: "https://example.com", config: { max_pages: 10 } }),
}).then((r) => r.json());
// 2. Cached? The pages are already here.
let pages = start.data;
// 3. Otherwise check the job every 2 seconds until it is done
while (!pages) {
await new Promise((r) => setTimeout(r, 2000));
const job = await fetch(`${API}/api/v1/jobs/${start.job_id}`, { headers }).then((r) => r.json());
if (job.status === "failed") throw new Error(job.error || "Scrape failed");
if (job.status === "completed") pages = job.results ?? [];
}
console.log(pages.length, "pages", pages[0]?.title);import time
import requests
API = "https://api.tafscraper.com"
headers = {"X-API-Key": "YOUR_API_KEY"}
# 1. Start the scrape
start = requests.post(
f"{API}/api/v1/scrape",
headers=headers,
json={"url": "https://example.com", "config": {"max_pages": 10}},
).json()
# 2. Cached? The pages are already here.
pages = start.get("data")
# 3. Otherwise check the job every 2 seconds until it is done
while pages is None:
time.sleep(2)
job = requests.get(f"{API}/api/v1/jobs/{start['job_id']}", headers=headers).json()
if job["status"] == "failed":
raise RuntimeError(job.get("error") or "Scrape failed")
if job["status"] == "completed":
pages = job.get("results") or []
print(len(pages), "pages", pages[0]["title"] if pages else "")The cURL call returns a job_id. Check it with curl https://api.tafscraper.com/api/v1/jobs/JOB_ID -H "X-API-Key: YOUR_API_KEY".
Contextual Scrape: ask for exactly what you need
Most of a website is noise for your use case. With Contextual Scrape you say in plain words what you are looking for, and you get back only that, as tidy JSON with the page it came from. No selectors, no parsing.
1. You describe it
“Every product name and price” or “all email addresses and phone numbers”.
2. We read the pages
TafScraper scrapes the site, then AI reads every page against your request.
3. You get the answer
A short summary and a list of findings, each with its source URL.
Example result for “product names and prices”
{
"summary": "Found 2 products with prices on 1 page.",
"items": [
{
"source_url": "https://shop.example.com/kettles",
"extracted_info": { "product": "Steel Kettle 1.7L", "price": "€39.90" }
},
{
"source_url": "https://shop.example.com/kettles",
"extracted_info": { "product": "Glass Kettle", "price": "€44.00" }
}
]
}- Where: in your dashboard, open Scraper and choose Contextual Scrape. Write what you need, add the URL, and start. The raw pages stay available too.
- Cost: 1 purchased credit per scrape. Free credits cover basic scrapes only.
- Through the API: AI filtering is not available on the API yet. The
contextfield is saved with the job and the job uses a purchased credit, but the API returns the full pages. Until API filtering ships, leavecontextout and filter the pages in your own code. - Tips: name the fields you want (“name, role, email”), keep it to one topic per scrape, and limit
max_pagesto the part of the site that has the answer.
Your API key
Every request needs your API key in the X-API-Key header. Create and revoke keys in your dashboard. Keep keys on your server; never put them in front-end code.
X-API-Key: sk_your_api_key_hereCredits
New accounts get 5 free credits to try basic scrapes. Purchased credits work for everything.
| Request | Cost |
|---|---|
Basic scrape (one job, up to max_pages pages) | 1 credit, free or purchased |
| Contextual Scrape | 1 purchased credit |
| Same URL and settings again, answered from cache | Free |
| Deep Research: fast / standard / heavy | 1 / 5 / 25 credits |
If a job cannot be created, the credit goes back to your balance. See credit packs.
Scrape a website
POST/api/v1/scrape
Starts a scrape of the URL and the pages it links to. Returns the pages at once when they are cached; otherwise returns a job_id to check.
{
"url": "https://example.com",
"config": {
"max_pages": 10,
"max_depth": 2,
"delay_ms": 1000,
"follow_external_links": false,
"scrape_css_branding": false,
"structured": false
}
}Parameters
urlrequired
config.max_pagesdefault 10, max 100
config.max_depthdefault 2, max 5
config.delay_msdefault 1000, min 500
config.follow_external_linksdefault false
config.scrape_css_brandingdefault false
logo (URL, or an SVG data URI for inline logos), favicon, colors (primary, secondary, tertiary as #rrggbb) and fonts (heading, body and families, best first) to each page.config.structureddefault false
site object to each page: brand, navigation, calls to action, sections, FAQ, latest posts, images, contacts and SEO. Same credit cost. See Structured site output.contextoptional, uses a purchased credit
Only scrape sites you are allowed to, and keep the delay polite. You are responsible for following each site's terms.
Response: job started
{
"job_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "started",
"message": "Scraping job started for URL: https://example.com",
"cached": false,
"data": null
}Response: served from cache
{
"job_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "completed",
"message": "Data served from cache for URL: https://example.com with matching configuration",
"cached": true,
"data": [
{
"url": "https://example.com",
"title": "Example Domain",
"text_content": ["Example Domain", "This domain is for use in illustrative examples..."],
"links": ["https://www.iana.org/domains/example"],
"images": []
}
]
}Get the results
GET/api/v1/jobs/:job_id
Shows progress while the job runs. When status is completed, the pages are in results. Checking every 2 to 5 seconds is plenty.
{
"job_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "completed",
"message": "Job completed successfully. Scraped 15 pages",
"progress": { "pages_scraped": 15, "total_links_found": 120, "current_url": null },
"results": [
{ "url": "https://example.com", "title": "Example Domain", "text_content": ["..."], "links": ["..."], "images": [] }
],
"error": null
}pending: waiting to startrunning: collecting pages;progressshows how far it gotcompleted: done; the pages are inresultsfailed: stopped; the reason is inerror
Structured site output
Want the shape of a site, not just its words? Send config.structured: true. Every page then carries a site object (schema version "2"). Collapsed content, such as closed <details> blocks, is included, and Cloudflare-protected emails are decoded.
curl -X POST https://api.tafscraper.com/api/v1/scrape \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{"url": "https://tinnitaid.com", "config": {"max_pages": 1, "structured": true}}'Response (shortened)
{
"url": "https://tinnitaid.com/",
"title": "Tinnitaid - Calm the noise—anytime, anywhere.",
"text_content": ["..."],
"site": {
"schema_version": "2",
"brand": { "name": "Tinnitaid", "source": "og:site_name" },
"primary_nav": [
{ "label": "Articles", "href": "https://tinnitaid.com/blog/", "source": "header_nav", "selector": "..." }
],
"footer_nav": [],
"primary_cta": {
"label": "Open App", "href": "https://app.tinnitaid.com", "count": 3,
"regions": ["hero", "section"], "source": "button_like_link", "selector": "..."
},
"sections": [
{ "index": 0, "region": "hero", "heading": "Tinnitaid",
"subheading": "Calm the noise—anytime, anywhere.",
"text": "...", "html": "...", "images": ["img_2"], "ctas": ["Open App", "How it works"] }
],
"faq": [
{ "question": "What is Tinnitaid?", "answer_text": "...", "answer_html": "...", "source": "details", "selector": "..." }
],
"latest_posts": [
{ "title": "Can stress worsen tinnitus?", "url": "https://tinnitaid.com/can-stress-worsen-tinnitus/", "excerpt": "..." }
],
"images": [
{ "id": "img_3", "url": "https://tinnitaid.com/wp-content/uploads/...png", "alt": "Kifissia Award",
"kind": "award_badge", "section_index": 3, "nearest_heading": "Awards / Investors / Partners",
"region": "section", "status": "ok", "error": null }
],
"contacts": {
"emails": [{ "value": "[email protected]", "source": "cfemail", "selector": "..." }],
"phones": []
},
"seo": { "title": "...", "description": "...", "canonical": "https://tinnitaid.com/", "og_image": "...", "lang": "en-US" },
"warnings": []
}
}- Every item says how it was found (
source) and where (selector, a CSS path). contacts.phonesonly liststel:links and numbers next to words like “phone” that are valid for the site's country. Reference numbers such as DOIs are never reported as phones.- Images that cannot be loaded stay in the list with
status: "failed"and anerror, plus a note inwarnings. Ajs_rendered_suspectedwarning means the page builds itself in the browser and only its static HTML was read.
Deep Research: a cited report from the live web
Ask a question. TafScraper splits it into focused searches, reads the best sources and writes a report with citations, so you can check every claim.
POST/api/v1/deepresearch
{
"query": "Impact of synthetic biology on agriculture in 2026",
"mode": "fast",
"research_strategy": "Focus on nitrogen fixation and commercial cost curves",
"report_format": "Executive brief with comparison tables",
"urls": ["https://example.com/agtech-whitepaper"]
}queryrequired, 3 to 25,000 characters
mode"fast" | "standard" | "heavy", default "standard"
research_strategyoptional
report_formatoptional
urlsoptional
Response: task started
{
"deepresearch_id": "b5e2a251-b53c-4006-98f8-60851f648da5",
"status": "running",
"mode": "fast",
"credits_used": 1,
"message": "Deep research task started in fast mode (1 credits deducted)",
"created_at": "2026-10-15T11:38:10.135Z"
}GET/api/v1/deepresearch/:task_id
Check until status is completed. The report is in output (Markdown) and the sources in sources.
{
"id": "b5e2a251-b53c-4006-98f8-60851f648da5",
"query": "Impact of synthetic biology on agriculture in 2026",
"mode": "fast",
"status": "completed",
"credits_used": 1,
"output": "# Deep Research Report ...\n\n## Executive Summary ...",
"sources": [
{ "title": "Synthetic Biology in Modern Farming", "url": "https://example.org/synbio-agri", "snippet": "..." }
],
"steps_log": [
{ "step": 1, "title": "Formulating Research Strategy", "status": "completed", "details": "Generated 2 targeted search vectors" }
],
"error": null,
"created_at": "2026-10-15T11:38:10.128Z",
"completed_at": "2026-10-15T11:38:25.237Z"
}Also available: GET /api/v1/deepresearch lists your tasks, and DELETE /api/v1/deepresearch/:task_id cancels one that is still running.
Errors
Errors come back as JSON with a message and the status code, for example {"error": "Invalid API key", "status": 401}.
| Code | Meaning | What to do |
|---|---|---|
| 400 | The request is not valid (for example a bad URL), or a contextual job has no purchased credits | Fix the field named in error, or buy credits |
| 401 | Missing or invalid API key | Check the X-API-Key header |
| 402 | Not enough credits | Top up |
| 404 | Job or task not found | Check the ID |
| 429 | Too many requests | Wait a minute, then retry |
| 500 | Something failed on our side | Retry; if it keeps happening, tell us |
Limits
- 30 requests per minute per IP address, shared across all
/api/v1endpoints. - Up to 100 pages and 5 levels deep per scrape job, with at least 500 ms between requests to the same site.
Questions or a use case that needs more? Talk to us.