Introduction
API for managing campaigns, leads, and sync operations in EvenLeads.
Welcome to the EvenLeads API documentation. This API allows you to programmatically manage your campaigns, leads, and sync operations.
## Getting Started
To use this API, you'll need an API key. You can create one from your [API Settings](/settings/api) page.
## Authentication
All API requests must include your API key in the **X-API-Key** header:
```
X-API-Key: your_api_key_here
```
Alternatively, you can pass it as a query parameter:
```
?api_key=your_api_key_here
```
## Base URL
All API requests should be made to:
```
https://evenleads.com/api/v1
```
## Rate Limiting
- Manual sync operations are limited to once every 15 minutes per campaign
- Standard rate limiting of 60 requests per minute applies to all endpoints
## Code Examples
Throughout this documentation, you'll find code examples in multiple programming languages (Bash, JavaScript, PHP, Python). Use the language selector at the top to choose your preferred language.
Authenticating requests
To authenticate requests, include a X-API-Key header with the value "your_api_key_here".
All authenticated endpoints are marked with a requires authentication badge in the documentation below.
You can create API keys by visiting your API Settings page in your dashboard. Include your API key in the X-API-Key header or as an api_key query parameter.
Account
API endpoints for account information and usage
Get account usage and limits
requires authentication
Retrieve current usage statistics and plan limits for EvenLeads features.
Example request:
curl --request GET \
--get "http://localhost:8000/api/v1/account/usage" \
--header "X-API-Key: your_api_key_here" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://localhost:8000/api/v1/account/usage"
);
const headers = {
"X-API-Key": "your_api_key_here",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'http://localhost:8000/api/v1/account/usage';
$response = $client->get(
$url,
[
'headers' => [
'X-API-Key' => 'your_api_key_here',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'http://localhost:8000/api/v1/account/usage'
headers = {
'X-API-Key': 'your_api_key_here',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()Example response (200):
{
"success": true,
"data": {
"user": {
"id": 1,
"name": "John Doe",
"email": "john@example.com"
},
"plan": {
"name": "Professional",
"interval": "monthly"
},
"limits": {
"campaigns": {
"current": 3,
"max": 5,
"percentage": 60
},
"leads_storage": {
"current": 1250,
"max": 5000,
"percentage": 25
},
"leads_per_sync": {
"max": 100
},
"ai_replies_per_month": {
"current": 45,
"max": 500,
"percentage": 9,
"resets_at": "2025-02-01T00:00:00.000000Z"
},
"manual_syncs_per_month": {
"current": 12,
"max": 100,
"percentage": 12,
"resets_at": "2025-02-01T00:00:00.000000Z"
},
"keywords_per_campaign": {
"max": 20
},
"automated_sync_interval_minutes": {
"value": 60
}
}
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Authentication
API endpoints for authentication
Validate API Key
requires authentication
Validates if an API key is valid and returns associated user information.
Example request:
curl --request GET \
--get "http://localhost:8000/api/v1/auth/validate" \
--header "X-API-Key: your_api_key_here" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://localhost:8000/api/v1/auth/validate"
);
const headers = {
"X-API-Key": "your_api_key_here",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'http://localhost:8000/api/v1/auth/validate';
$response = $client->get(
$url,
[
'headers' => [
'X-API-Key' => 'your_api_key_here',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'http://localhost:8000/api/v1/auth/validate'
headers = {
'X-API-Key': 'your_api_key_here',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()Example response (200):
{
"success": true,
"message": "API key is valid",
"data": {
"user": {
"id": 1,
"name": "John Doe",
"email": "john@example.com"
},
"api_key": {
"name": "My API Key",
"created_at": "2025-01-01T00:00:00.000000Z",
"last_used_at": "2025-01-15T12:30:00.000000Z"
}
}
}
Example response (401):
{
"success": false,
"message": "Invalid API key."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Campaigns
API endpoints for managing campaigns
List all campaigns
requires authentication
Get a paginated list of all campaigns for the authenticated user.
Example request:
curl --request GET \
--get "http://localhost:8000/api/v1/campaigns?page=1&per_page=15&status=active&platform=reddit" \
--header "X-API-Key: your_api_key_here" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://localhost:8000/api/v1/campaigns"
);
const params = {
"page": "1",
"per_page": "15",
"status": "active",
"platform": "reddit",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"X-API-Key": "your_api_key_here",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'http://localhost:8000/api/v1/campaigns';
$response = $client->get(
$url,
[
'headers' => [
'X-API-Key' => 'your_api_key_here',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'page' => '1',
'per_page' => '15',
'status' => 'active',
'platform' => 'reddit',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'http://localhost:8000/api/v1/campaigns'
params = {
'page': '1',
'per_page': '15',
'status': 'active',
'platform': 'reddit',
}
headers = {
'X-API-Key': 'your_api_key_here',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200):
{
"success": true,
"data": {
"campaigns": [
{
"id": 1,
"name": "Web Development Services",
"offering": "Custom web development",
"website_url": "https://example.com",
"platforms": [
"reddit",
"facebook"
],
"status": "active",
"keywords": [
"web development",
"website"
],
"strong_matches_count": 15,
"partial_matches_count": 8,
"new_leads_count": 5,
"last_sync_at": "2025-01-15T10:30:00.000000Z",
"next_sync_at": "2025-01-15T11:30:00.000000Z",
"created_at": "2025-01-01T00:00:00.000000Z",
"updated_at": "2025-01-15T10:30:00.000000Z"
}
],
"pagination": {
"current_page": 1,
"per_page": 15,
"total": 25,
"last_page": 2
}
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get a single campaign
requires authentication
Retrieve detailed information about a specific campaign including all settings, matches, and sync history.
Example request:
curl --request GET \
--get "http://localhost:8000/api/v1/campaigns/1" \
--header "X-API-Key: your_api_key_here" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://localhost:8000/api/v1/campaigns/1"
);
const headers = {
"X-API-Key": "your_api_key_here",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'http://localhost:8000/api/v1/campaigns/1';
$response = $client->get(
$url,
[
'headers' => [
'X-API-Key' => 'your_api_key_here',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'http://localhost:8000/api/v1/campaigns/1'
headers = {
'X-API-Key': 'your_api_key_here',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()Example response (200):
{
"success": true,
"data": {
"id": 1,
"name": "Web Development Services",
"offering": "Custom web development",
"website_url": "https://example.com",
"portfolio_path": "/portfolio",
"platforms": [
"reddit",
"facebook"
],
"facebook_groups": [
"group1",
"group2"
],
"keywords": [
"web development",
"website"
],
"include_keywords": [
"need",
"looking for"
],
"ai_settings": {
"tone": "professional",
"length": "medium"
},
"include_call_to_action": true,
"status": "active",
"strong_matches_count": 15,
"partial_matches_count": 8,
"new_leads_count": 5,
"last_sync_at": "2025-01-15T10:30:00.000000Z",
"next_sync_at": "2025-01-15T11:30:00.000000Z",
"created_at": "2025-01-01T00:00:00.000000Z",
"updated_at": "2025-01-15T10:30:00.000000Z"
}
}
Example response (404):
{
"success": false,
"message": "Campaign not found"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Create a new campaign
requires authentication
Create a new campaign. You can only create campaigns for social platforms your account is connected with.
Example request:
curl --request POST \
"http://localhost:8000/api/v1/campaigns" \
--header "X-API-Key: your_api_key_here" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"name\": \"Web Development Services\",
\"offering\": \"Custom web development and design services\",
\"website_url\": \"https:\\/\\/example.com\",
\"portfolio_path\": \"\\/portfolio\",
\"platforms\": [
\"reddit\",
\"facebook\"
],
\"facebook_groups\": [
\"group1\",
\"group2\"
],
\"keywords\": [
\"web development\",
\"website\"
],
\"negative_keywords\": [
\"architecto\"
],
\"include_keywords\": [
\"need\",
\"looking for\"
],
\"ai_settings\": {
\"tone\": \"professional\",
\"length\": \"medium\"
},
\"include_call_to_action\": true,
\"status\": \"active\"
}"
const url = new URL(
"http://localhost:8000/api/v1/campaigns"
);
const headers = {
"X-API-Key": "your_api_key_here",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"name": "Web Development Services",
"offering": "Custom web development and design services",
"website_url": "https:\/\/example.com",
"portfolio_path": "\/portfolio",
"platforms": [
"reddit",
"facebook"
],
"facebook_groups": [
"group1",
"group2"
],
"keywords": [
"web development",
"website"
],
"negative_keywords": [
"architecto"
],
"include_keywords": [
"need",
"looking for"
],
"ai_settings": {
"tone": "professional",
"length": "medium"
},
"include_call_to_action": true,
"status": "active"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'http://localhost:8000/api/v1/campaigns';
$response = $client->post(
$url,
[
'headers' => [
'X-API-Key' => 'your_api_key_here',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'name' => 'Web Development Services',
'offering' => 'Custom web development and design services',
'website_url' => 'https://example.com',
'portfolio_path' => '/portfolio',
'platforms' => [
'reddit',
'facebook',
],
'facebook_groups' => [
'group1',
'group2',
],
'keywords' => [
'web development',
'website',
],
'negative_keywords' => [
'architecto',
],
'include_keywords' => [
'need',
'looking for',
],
'ai_settings' => [
'tone' => 'professional',
'length' => 'medium',
],
'include_call_to_action' => true,
'status' => 'active',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'http://localhost:8000/api/v1/campaigns'
payload = {
"name": "Web Development Services",
"offering": "Custom web development and design services",
"website_url": "https:\/\/example.com",
"portfolio_path": "\/portfolio",
"platforms": [
"reddit",
"facebook"
],
"facebook_groups": [
"group1",
"group2"
],
"keywords": [
"web development",
"website"
],
"negative_keywords": [
"architecto"
],
"include_keywords": [
"need",
"looking for"
],
"ai_settings": {
"tone": "professional",
"length": "medium"
},
"include_call_to_action": true,
"status": "active"
}
headers = {
'X-API-Key': 'your_api_key_here',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (201):
{
"success": true,
"message": "Campaign created successfully",
"data": {
"id": 1,
"name": "Web Development Services",
"status": "active",
"created_at": "2025-01-15T12:00:00.000000Z"
}
}
Example response (422):
{
"success": false,
"message": "Validation failed",
"errors": {
"platforms": [
"You are not connected to facebook. Please connect your account first."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Update a campaign
requires authentication
Update an existing campaign. Same validation rules as creation apply.
Example request:
curl --request PUT \
"http://localhost:8000/api/v1/campaigns/1" \
--header "X-API-Key: your_api_key_here" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"name\": \"Updated Campaign Name\",
\"offering\": \"Updated offering description\",
\"website_url\": \"https:\\/\\/example.com\",
\"portfolio_path\": \"\\/portfolio\",
\"platforms\": [
\"reddit\"
],
\"facebook_groups\": [
\"group1\"
],
\"keywords\": [
\"web dev\",
\"website\"
],
\"negative_keywords\": [
\"architecto\"
],
\"include_keywords\": [
\"need\"
],
\"ai_settings\": {
\"tone\": \"casual\"
},
\"include_call_to_action\": false,
\"status\": \"paused\"
}"
const url = new URL(
"http://localhost:8000/api/v1/campaigns/1"
);
const headers = {
"X-API-Key": "your_api_key_here",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"name": "Updated Campaign Name",
"offering": "Updated offering description",
"website_url": "https:\/\/example.com",
"portfolio_path": "\/portfolio",
"platforms": [
"reddit"
],
"facebook_groups": [
"group1"
],
"keywords": [
"web dev",
"website"
],
"negative_keywords": [
"architecto"
],
"include_keywords": [
"need"
],
"ai_settings": {
"tone": "casual"
},
"include_call_to_action": false,
"status": "paused"
};
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'http://localhost:8000/api/v1/campaigns/1';
$response = $client->put(
$url,
[
'headers' => [
'X-API-Key' => 'your_api_key_here',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'name' => 'Updated Campaign Name',
'offering' => 'Updated offering description',
'website_url' => 'https://example.com',
'portfolio_path' => '/portfolio',
'platforms' => [
'reddit',
],
'facebook_groups' => [
'group1',
],
'keywords' => [
'web dev',
'website',
],
'negative_keywords' => [
'architecto',
],
'include_keywords' => [
'need',
],
'ai_settings' => [
'tone' => 'casual',
],
'include_call_to_action' => false,
'status' => 'paused',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'http://localhost:8000/api/v1/campaigns/1'
payload = {
"name": "Updated Campaign Name",
"offering": "Updated offering description",
"website_url": "https:\/\/example.com",
"portfolio_path": "\/portfolio",
"platforms": [
"reddit"
],
"facebook_groups": [
"group1"
],
"keywords": [
"web dev",
"website"
],
"negative_keywords": [
"architecto"
],
"include_keywords": [
"need"
],
"ai_settings": {
"tone": "casual"
},
"include_call_to_action": false,
"status": "paused"
}
headers = {
'X-API-Key': 'your_api_key_here',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('PUT', url, headers=headers, json=payload)
response.json()Example response (200):
{
"success": true,
"message": "Campaign updated successfully",
"data": {
"id": 1,
"name": "Updated Campaign Name",
"updated_at": "2025-01-15T12:30:00.000000Z"
}
}
Example response (404):
{
"success": false,
"message": "Campaign not found"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Delete a campaign
requires authentication
Soft delete a campaign and all its associated data.
Example request:
curl --request DELETE \
"http://localhost:8000/api/v1/campaigns/1" \
--header "X-API-Key: your_api_key_here" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://localhost:8000/api/v1/campaigns/1"
);
const headers = {
"X-API-Key": "your_api_key_here",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'http://localhost:8000/api/v1/campaigns/1';
$response = $client->delete(
$url,
[
'headers' => [
'X-API-Key' => 'your_api_key_here',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'http://localhost:8000/api/v1/campaigns/1'
headers = {
'X-API-Key': 'your_api_key_here',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('DELETE', url, headers=headers)
response.json()Example response (200):
{
"success": true,
"message": "Campaign deleted successfully"
}
Example response (404):
{
"success": false,
"message": "Campaign not found"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Leads
API endpoints for managing leads
List all leads
requires authentication
Get a paginated list of all leads with comprehensive filtering options.
Example request:
curl --request GET \
--get "http://localhost:8000/api/v1/leads?page=1&per_page=15&campaign_id=1&status=new&match_type=strong&platform=reddit&min_confidence=7&max_confidence=10&search=website&sort_by=created_at&sort_order=desc" \
--header "X-API-Key: your_api_key_here" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://localhost:8000/api/v1/leads"
);
const params = {
"page": "1",
"per_page": "15",
"campaign_id": "1",
"status": "new",
"match_type": "strong",
"platform": "reddit",
"min_confidence": "7",
"max_confidence": "10",
"search": "website",
"sort_by": "created_at",
"sort_order": "desc",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"X-API-Key": "your_api_key_here",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'http://localhost:8000/api/v1/leads';
$response = $client->get(
$url,
[
'headers' => [
'X-API-Key' => 'your_api_key_here',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'page' => '1',
'per_page' => '15',
'campaign_id' => '1',
'status' => 'new',
'match_type' => 'strong',
'platform' => 'reddit',
'min_confidence' => '7',
'max_confidence' => '10',
'search' => 'website',
'sort_by' => 'created_at',
'sort_order' => 'desc',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'http://localhost:8000/api/v1/leads'
params = {
'page': '1',
'per_page': '15',
'campaign_id': '1',
'status': 'new',
'match_type': 'strong',
'platform': 'reddit',
'min_confidence': '7',
'max_confidence': '10',
'search': 'website',
'sort_by': 'created_at',
'sort_order': 'desc',
}
headers = {
'X-API-Key': 'your_api_key_here',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200):
{
"success": true,
"data": {
"leads": [
{
"id": 1,
"campaign_id": 1,
"campaign_name": "Web Development Services",
"platform": "reddit",
"platform_id": "abc123",
"title": "Looking for web developer",
"description": "Need someone to build a website",
"url": "https://reddit.com/r/example/comments/abc123",
"author": "john_doe",
"subreddit": "webdev",
"facebook_group": null,
"comments_count": 5,
"confidence_score": 8,
"match_type": "strong",
"status": "new",
"matched_keywords": [
"website",
"web developer"
],
"synced_at": "2025-01-15T10:30:00.000000Z",
"contacted_at": null,
"created_at": "2025-01-15T10:30:00.000000Z",
"updated_at": "2025-01-15T10:30:00.000000Z"
}
],
"pagination": {
"current_page": 1,
"per_page": 15,
"total": 150,
"last_page": 10
}
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get a single lead
requires authentication
Retrieve detailed information about a specific lead including AI generations and campaign details.
Example request:
curl --request GET \
--get "http://localhost:8000/api/v1/leads/1" \
--header "X-API-Key: your_api_key_here" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://localhost:8000/api/v1/leads/1"
);
const headers = {
"X-API-Key": "your_api_key_here",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'http://localhost:8000/api/v1/leads/1';
$response = $client->get(
$url,
[
'headers' => [
'X-API-Key' => 'your_api_key_here',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'http://localhost:8000/api/v1/leads/1'
headers = {
'X-API-Key': 'your_api_key_here',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()Example response (200):
{
"success": true,
"data": {
"id": 1,
"campaign": {
"id": 1,
"name": "Web Development Services",
"offering": "Custom web development"
},
"platform": "reddit",
"platform_id": "abc123",
"title": "Looking for web developer",
"description": "Need someone to build a website for my startup",
"url": "https://reddit.com/r/example/comments/abc123",
"author": "john_doe",
"subreddit": "webdev",
"facebook_group": null,
"comments_count": 5,
"confidence_score": 8,
"match_type": "strong",
"status": "new",
"matched_keywords": [
"website",
"web developer"
],
"ai_generations": [
{
"id": 1,
"generated_message": "Hi! I'd love to help with your project...",
"created_at": "2025-01-15T10:35:00.000000Z"
}
],
"synced_at": "2025-01-15T10:30:00.000000Z",
"contacted_at": null,
"created_at": "2025-01-15T10:30:00.000000Z",
"updated_at": "2025-01-15T10:30:00.000000Z"
}
}
Example response (404):
{
"success": false,
"message": "Lead not found"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Delete a lead
requires authentication
Permanently delete a lead from your account.
Example request:
curl --request DELETE \
"http://localhost:8000/api/v1/leads/1" \
--header "X-API-Key: your_api_key_here" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://localhost:8000/api/v1/leads/1"
);
const headers = {
"X-API-Key": "your_api_key_here",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'http://localhost:8000/api/v1/leads/1';
$response = $client->delete(
$url,
[
'headers' => [
'X-API-Key' => 'your_api_key_here',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'http://localhost:8000/api/v1/leads/1'
headers = {
'X-API-Key': 'your_api_key_here',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('DELETE', url, headers=headers)
response.json()Example response (200):
{
"success": true,
"message": "Lead deleted successfully"
}
Example response (404):
{
"success": false,
"message": "Lead not found"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Bulk delete leads
requires authentication
Delete multiple leads at once by providing an array of lead IDs.
Example request:
curl --request POST \
"http://localhost:8000/api/v1/leads/bulk-delete" \
--header "X-API-Key: your_api_key_here" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"lead_ids\": [
1,
2,
3
]
}"
const url = new URL(
"http://localhost:8000/api/v1/leads/bulk-delete"
);
const headers = {
"X-API-Key": "your_api_key_here",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"lead_ids": [
1,
2,
3
]
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'http://localhost:8000/api/v1/leads/bulk-delete';
$response = $client->post(
$url,
[
'headers' => [
'X-API-Key' => 'your_api_key_here',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'lead_ids' => [
1,
2,
3,
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'http://localhost:8000/api/v1/leads/bulk-delete'
payload = {
"lead_ids": [
1,
2,
3
]
}
headers = {
'X-API-Key': 'your_api_key_here',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (200):
{
"success": true,
"message": "Successfully deleted 3 leads"
}
Example response (422):
{
"success": false,
"message": "Validation failed",
"errors": {
"lead_ids": [
"The lead ids field is required."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Update lead status
requires authentication
Update the status of a lead (new, contacted, closed).
Example request:
curl --request PATCH \
"http://localhost:8000/api/v1/leads/1/status" \
--header "X-API-Key: your_api_key_here" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"status\": \"contacted\"
}"
const url = new URL(
"http://localhost:8000/api/v1/leads/1/status"
);
const headers = {
"X-API-Key": "your_api_key_here",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"status": "contacted"
};
fetch(url, {
method: "PATCH",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'http://localhost:8000/api/v1/leads/1/status';
$response = $client->patch(
$url,
[
'headers' => [
'X-API-Key' => 'your_api_key_here',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'status' => 'contacted',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'http://localhost:8000/api/v1/leads/1/status'
payload = {
"status": "contacted"
}
headers = {
'X-API-Key': 'your_api_key_here',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('PATCH', url, headers=headers, json=payload)
response.json()Example response (200):
{
"success": true,
"message": "Lead status updated successfully",
"data": {
"id": 1,
"status": "contacted",
"contacted_at": "2025-01-15T12:00:00.000000Z"
}
}
Example response (404):
{
"success": false,
"message": "Lead not found"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Sync
API endpoints for syncing campaigns
Trigger manual sync for a campaign
requires authentication
Manually trigger a sync operation for a specific campaign to fetch new leads immediately.
Example request:
curl --request POST \
"http://localhost:8000/api/v1/sync/campaign/1" \
--header "X-API-Key: your_api_key_here" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://localhost:8000/api/v1/sync/campaign/1"
);
const headers = {
"X-API-Key": "your_api_key_here",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'http://localhost:8000/api/v1/sync/campaign/1';
$response = $client->post(
$url,
[
'headers' => [
'X-API-Key' => 'your_api_key_here',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'http://localhost:8000/api/v1/sync/campaign/1'
headers = {
'X-API-Key': 'your_api_key_here',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers)
response.json()Example response (200):
{
"success": true,
"message": "Sync started successfully",
"data": {
"campaign_id": 1,
"campaign_name": "Web Development Services",
"status": "queued",
"queued_at": "2025-01-15T12:00:00.000000Z"
}
}
Example response (404):
{
"success": false,
"message": "Campaign not found"
}
Example response (429):
{
"success": false,
"message": "Campaign was synced recently. Please wait before syncing again.",
"data": {
"last_sync_at": "2025-01-15T11:55:00.000000Z",
"next_available_sync": "2025-01-15T12:10:00.000000Z"
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Sync all active campaigns
requires authentication
Trigger a sync operation for all active campaigns belonging to the authenticated user.
Example request:
curl --request POST \
"http://localhost:8000/api/v1/sync/all" \
--header "X-API-Key: your_api_key_here" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://localhost:8000/api/v1/sync/all"
);
const headers = {
"X-API-Key": "your_api_key_here",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'http://localhost:8000/api/v1/sync/all';
$response = $client->post(
$url,
[
'headers' => [
'X-API-Key' => 'your_api_key_here',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'http://localhost:8000/api/v1/sync/all'
headers = {
'X-API-Key': 'your_api_key_here',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers)
response.json()Example response (200):
{
"success": true,
"message": "Sync started for 3 campaigns",
"data": {
"total_campaigns": 3,
"queued_campaigns": [
{
"id": 1,
"name": "Web Development Services"
},
{
"id": 2,
"name": "Design Services"
},
{
"id": 3,
"name": "SEO Consulting"
}
],
"queued_at": "2025-01-15T12:00:00.000000Z"
}
}
Example response (404):
{
"success": false,
"message": "No active campaigns found"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get sync history for a campaign
requires authentication
Retrieve the sync history for a specific campaign with details about each sync operation.
Example request:
curl --request GET \
--get "http://localhost:8000/api/v1/sync/history/1?page=1&per_page=15" \
--header "X-API-Key: your_api_key_here" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://localhost:8000/api/v1/sync/history/1"
);
const params = {
"page": "1",
"per_page": "15",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"X-API-Key": "your_api_key_here",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'http://localhost:8000/api/v1/sync/history/1';
$response = $client->get(
$url,
[
'headers' => [
'X-API-Key' => 'your_api_key_here',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'page' => '1',
'per_page' => '15',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'http://localhost:8000/api/v1/sync/history/1'
params = {
'page': '1',
'per_page': '15',
}
headers = {
'X-API-Key': 'your_api_key_here',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200):
{
"success": true,
"data": {
"campaign_id": 1,
"campaign_name": "Web Development Services",
"sync_history": [
{
"id": 1,
"started_at": "2025-01-15T10:00:00.000000Z",
"completed_at": "2025-01-15T10:05:00.000000Z",
"status": "completed",
"leads_found": 5,
"errors": null,
"duration_seconds": 300
}
],
"pagination": {
"current_page": 1,
"per_page": 15,
"total": 50,
"last_page": 4
}
}
}
Example response (404):
{
"success": false,
"message": "Campaign not found"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get running sync for a campaign
requires authentication
Retrieve the currently running or queued sync for a specific campaign. Returns null if no sync is currently active.
Example request:
curl --request GET \
--get "http://localhost:8000/api/v1/sync/campaign/1/running" \
--header "X-API-Key: your_api_key_here" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://localhost:8000/api/v1/sync/campaign/1/running"
);
const headers = {
"X-API-Key": "your_api_key_here",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'http://localhost:8000/api/v1/sync/campaign/1/running';
$response = $client->get(
$url,
[
'headers' => [
'X-API-Key' => 'your_api_key_here',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'http://localhost:8000/api/v1/sync/campaign/1/running'
headers = {
'X-API-Key': 'your_api_key_here',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()Example response (200):
{
"success": true,
"data": {
"sync_id": 123,
"campaign_id": 1,
"status": "running",
"sync_mode": "fast",
"started_at": "2025-01-15T12:00:00.000000Z"
}
}
Example response (200):
{
"success": true,
"data": null,
"message": "No sync currently running for this campaign"
}
Example response (404):
{
"success": false,
"message": "Campaign not found"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get sync details by ID
requires authentication
Retrieve detailed information about a specific sync operation by its sync history ID.
Example request:
curl --request GET \
--get "http://localhost:8000/api/v1/sync/123" \
--header "X-API-Key: your_api_key_here" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://localhost:8000/api/v1/sync/123"
);
const headers = {
"X-API-Key": "your_api_key_here",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'http://localhost:8000/api/v1/sync/123';
$response = $client->get(
$url,
[
'headers' => [
'X-API-Key' => 'your_api_key_here',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'http://localhost:8000/api/v1/sync/123'
headers = {
'X-API-Key': 'your_api_key_here',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()Example response (200):
{
"success": true,
"data": {
"sync_id": 123,
"campaign_id": 1,
"campaign_name": "Web Development Services",
"status": "completed",
"sync_mode": "fast",
"sync_type": "manual",
"platform": "reddit",
"started_at": "2025-01-15T12:00:00.000000Z",
"completed_at": "2025-01-15T12:05:00.000000Z",
"posts_found": 25,
"leads_created": 5,
"error_message": null,
"metadata": {
"keywords_used": [
"web development help",
"need developer"
],
"subreddits_searched": [
"webdev",
"forhire"
]
}
}
}
Example response (404):
{
"success": false,
"message": "Sync not found"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.