API Documentation
Integrate Extractly into your applications
Need an API key to get started?
Create and manage your keys from the API Keys page.
Quick Start
Get up and running in minutes
Extractly provides a simple REST API to scrape websites and extract structured data using AI. The typical workflow is:
- 1Scrape - Fetch content from a website URL
- 2Extract - Send scraped content to AI with your extraction prompt
- 3Use - Receive structured JSON data for your application
Base URL
text
https://extractly.me/apiAuthentication
text
Authorization: Bearer YOUR_API_KEYEndpoints
Complete Example
Full workflow: scrape then extract
Step 1: Scrape the website
javascript
const scrapeResponse = await fetch('/api/scrape', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
},
body: JSON.stringify({
url: 'https://example-spa.com',
maxPages: 5,
mode: 'optimized'
})
});
const scrapeData = await scrapeResponse.json();
console.log(`Scraped ${scrapeData.pagesScraped} pages`);Step 2: Extract structured data
javascript
const extractResponse = await fetch('/api/extract', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
},
body: JSON.stringify({
scrapedData: scrapeData.scrapedData,
templatePrompt: `
Extract all services from this spa website.
Return JSON: {
business: { name, phone, email, address },
services: [{ name, price, duration, description }]
}
`,
provider: 'gemini'
})
});
const result = await extractResponse.json();
console.log(result.outputJson);Step 3: Use the extracted data
javascript
// Example output
{
"business": {
"name": "Serenity Spa & Wellness",
"phone": "(555) 123-4567",
"email": "[email protected]",
"address": "123 Relaxation Blvd, Wellness City"
},
"services": [
{
"name": "Deep Tissue Massage",
"price": "$120",
"duration": "60 min",
"description": "Therapeutic massage targeting deep muscle layers"
},
{
"name": "Hot Stone Therapy",
"price": "$150",
"duration": "90 min",
"description": "Relaxing massage with heated basalt stones"
}
]
}Error Handling
Common error codes and how to handle them
| Error Code | HTTP Status | Description | Solution |
|---|---|---|---|
| INVALID_JSON | 400 | Request body is not valid JSON | Check your JSON syntax |
| INVALID_URL | 400 | The provided URL is malformed | Ensure URL starts with http:// or https:// |
| SCRAPE_FAILED | 422 | Could not scrape the website | Site may be blocking scrapers or down |
| EXTRACTION_FAILED | 422 | AI could not extract data | Refine your prompt or check scraped content |
| NETWORK_ERROR | 502 | Backend service unavailable | Retry in a few seconds |
| RATE_LIMITED | 429 | Too many requests | Wait before retrying |
Ready to start building?
Try the interactive playground to test extractions before integrating.