API Documentation
Endpoints
Process Endpoint
POST /api/v1/{endpoint_id}/
Headers
{ "x-api-key": "YOUR_API_KEY", "Content-Type": "application/json" }
Request Body
{
"query": "search query",
"instructions": "extraction instructions",
"url_pattern_match": "regex pattern",
"pattern_exclude": false,
"results": 5,
"schema": {
"field_name": {
"type": "string|integer|boolean",
"description": "field description"
}
}
}
- query Required - The search query to use
- instructions Required - Instructions for data extraction
- schema Optional - Definition of fields to extract. If not provided, a schema will be automatically generated based on the instructions
- url_pattern_match Optional - Regex pattern to filter URLs
- pattern_exclude Optional - Whether to exclude or include pattern matches
- results Optional - Number of results to process (default: 5)
Note: These parameters can be set as defaults when creating the endpoint, and overridden in the request body.
Response
{ "status": "success", "message": "Request accepted and being processed", "task_id": "550e8400-e29b-41d4-a716-446655440000" }
Webhook Payload
{
"task_id": "550e8400-e29b-41d4-a716-446655440000",
"success": true,
"url": "https://example.com/page1",
"items": [
{
"price": "$35,000",
"model": "Model 3 Standard Range",
"year": 2024
},
{
"price": "$40,000",
"model": "Model 3 Standard Range Plus",
"year": 2024
}
]
}
Results will be sent to your webhook endpoints as they are processed. Each URL's results will be sent as a separate webhook request.
Error Responses
Webhook Integration
Configure a webhook to receive results automatically. Each search result will be processed and sent individually to your webhook endpoint. This is useful for requests that may take longer to process.
Webhook Configuration
- Configure your webhook URL in the endpoint settings
- Configure custom headers for your webhook (optional)
- Choose HTTP method for the webhook (GET, POST, etc.)
- Use the task_id from the initial request to track related results
Webhook Payload Format
{
"task_id": "unique-task-id",
"success": true,
"url": "https://example.com/page",
"items": [{
"price": "$35,000",
"model": "Model 3 Standard Range",
"year": 2024
}]
}
Each webhook response represents one processed URL. Multiple webhook requests may be sent for a single API request, all sharing the same task_id.
Webhook Response
- Webhook expects a response within 10 seconds
- Failed webhook deliveries will be logged but not retried
- Each webhook can have its own custom headers
Rate Limits
Plan | Requests per Day | Results per Request |
---|---|---|
Free Account | 10 | 10 |
Business Account | Custom | Custom |
Code Examples
import requests
API_KEY = 'your_api_key'
ENDPOINT_ID = 'your-endpoint-id'
headers = {
'x-api-key': API_KEY,
'Content-Type': 'application/json'
}
data = {
'query': 'tesla model 3 price',
'instructions': 'Extract the price for each variant',
'results': 5
}
response = requests.post(
f'https://api.autoserp.com/endpoint/v1/{ENDPOINT_ID}/',
json=data,
headers=headers
)
# Get task_id to track results in webhooks
task_id = response.json().get('task_id')
const API_KEY = 'your_api_key';
const ENDPOINT_ID = 'your-endpoint-id';
const response = await fetch(
`https://api.autoserp.com/endpoint/v1/${ENDPOINT_ID}/`,
{
method: 'POST',
headers: {
'x-api-key': API_KEY,
'Content-Type': 'application/json'
},
body: JSON.stringify({
query: 'tesla model 3 price',
instructions: 'Extract the price for each variant',
results: 5
})
}
);
const data = await response.json();
const taskId = data.task_id; // Use this to track results in webhooks
curl -X POST https://api.autoserp.com/endpoint/v1/your-endpoint-id/ \ -H "x-api-key: your_api_key" \ -H "Content-Type: application/json" \ -d '{ "query": "tesla model 3 price", "instructions": "Extract the price for each variant", "results": 5 }'