Quick Start Guide
Get up and running with Scrapezy in minutes
This guide will help you get started with Scrapezy's API in just a few minutes. Follow these steps to begin extracting data from any website.
1. Get Your API Key
- Sign up for a Scrapezy account at scrapezy.com
- Navigate to Settings → API Keys
- Click "Create New API Key"
- Give your key a descriptive name (e.g., "Development Key")
- Copy your API key immediately - you won't be able to see it again!
2. Make Your First Extraction Request
Here's a simple example of how to extract data from a webpage:
// Initialize the extraction job
const response = await fetch('https://scrapezy.com/api/extract', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': 'your_api_key'
},
body: JSON.stringify({
url: 'https://example.com/products/phone',
prompt: 'Extract the phone name, price, and current stock status'
})
});
const { jobId } = await response.json();
// Check the job status
const result = await fetch(`https://scrapezy.com/api/extract/${jobId}`, {
headers: {
'x-api-key': 'your_api_key'
}
});
const data = await result.json();
console.log(data);
// Example output:
// {
// "status": "completed",
// "result": {
// "name": "iPhone 15 Pro",
// "price": "$999",
// "inStock": true
// }
// }
3. Writing Basic Prompts
The key to successful extraction is being clear about what you want. Here are some examples:
✅ Good basic prompts:
- "Get the article title and author name"
- "Extract the product price and availability"
- "Find the company's contact email and phone number"
❌ Avoid:
- "Get everything" (too vague)
- "Extract data" (not specific enough)
- "Find information" (needs more context)
Please note, instructions on how to navigate the page are not currently supported, for example: "Click the button with the text 'Next'" or "Scroll to the bottom of the page". These will be supported in the future, but are currently ignored.
4. Understanding Job Status
Your extraction job will go through these states:
pending
: Job is queuedrunning
: Currently processingcompleted
: Data is readyfailed
: Something went wrong
5. Basic Error Handling
Here's how to handle common errors:
try {
const response = await fetch('https://scrapezy.com/api/extract', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': 'your_api_key'
},
body: JSON.stringify({
url: 'https://example.com',
prompt: 'Extract the main heading'
})
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const { jobId } = await response.json();
// ... handle the job ID
} catch (error) {
console.error('Error:', error);
}
Common error codes:
401
: Check your API key402
: Add more credits to your account500
: Try again later
Next Steps
Ready to do more? Check out our Advanced Usage Guide to learn about:
- Caching and performance optimization
- Complex data extraction
- Custom data handling
Need help? Contact our support team at [email protected]