API Reference
Welcome to the LeadGen AI API. Our REST API allows you to programmatically find and extract business data from Google Maps using natural language prompts or structured queries.
http://localhost:8000
Authentication
Authenticate your requests by including your API key in the X-API-Key request header. You can find or regenerate your API key in the user dashboard.
Usage Tiers & Limits
We enforce daily rate limits based on your account status. Limits are reset every 24 hours at UTC midnight.
Start Scrape POST /api/scrape
Initiates a new scraping job. You can provide a query, a natural language prompt, or detailed filters.
| Parameter | Description |
|---|---|
query string | The search term (e.g., "Plumbers in New York"). Required if prompt is empty. |
prompt string | Natural language request (e.g., "Find coffee shops in Bali with > 4.5 rating"). |
max_results integer | Maximum leads to collect. Default: 100. |
deep_scan boolean | Enable website crawling for emails and socials. Default: false. |
webhook_url string (url) | A URL to receive a POST notification when the job is complete. Useful for n8n/OpenClaw. |
curl -X POST "http://localhost:8000/api/scrape" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "Plumbers in Austin",
"max_results": 20,
"deep_scan": true,
"webhook_url": "https://your-agent-webhook.com/callback"
}'
import requests
url = "http://localhost:8000/api/scrape"
headers = {"X-API-Key": "YOUR_API_KEY"}
data = {
"query": "Plumbers in Austin",
"max_results": 20,
"deep_scan": True
}
response = requests.post(url, json=data, headers=headers)
print(response.json())
const axios = require('axios');
const startScrape = async () => {
const url = 'http://localhost:8000/api/scrape';
const headers = { 'X-API-Key': 'YOUR_API_KEY' };
const body = {
query: 'Plumbers in Austin',
max_results: 20,
deep_scan: true
};
const { data } = await axios.post(url, body, { headers });
console.log(data);
};
startScrape();
<?php
$url = "http://localhost:8000/api/scrape";
$headers = [
"X-API-Key: YOUR_API_KEY",
"Content-Type: application/json"
];
$data = json_encode([
"query" => "Plumbers in Austin",
"max_results" => 20,
"deep_scan" => true
]);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
echo $response;
?>
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
url := "http://localhost:8000/api/scrape"
data := map[string]interface{}{
"query": "Plumbers in Austin",
"max_results": 20,
"deep_scan": true,
}
jsonData, _ := json.Marshal(data)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("X-API-Key", "YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
fmt.Println("Response Status:", resp.Status)
}
Agent Integration OpenClaw & n8n
LeadGen AI is designed to be the "data-hungry" core of your AI agents. You can connect your OpenClaw agents or n8n workflows to LeadGen AI in three easy steps:
1 Set your API Key
In your OpenClaw agent tool configuration or n8n HTTP Request node, add the following header:
X-API-Key: YOUR_PRIVATE_KEY
2 Configure Webhook Callbacks
Since scraping can take several minutes, use the webhook_url parameter. LeadGen AI will POST to this URL once the job is finished, sending the total lead count and a unique results link.
3 Process with OpenClaw
Once the agent receives the webhook, it can fetch the leads from the results_url and proceed with its next task (e.g., personalized cold outreach or CRM entry).