LeadsDB API Documentation
LeadsDB is a lead management API that helps you store, search, and manage business leads. This documentation covers the REST API, authentication, filtering, and integration with AI assistants via MCP.
Features
- Lead Management: Create, read, update, and delete leads with rich metadata
- Dynamic Attributes: Store custom key-value pairs with type safety (text, number, boolean, list, object)
- Full-Text Search: Fast prefix search on lead names using FTS
- Advanced Filtering: 20+ operators for filtering by text, numbers, dates, tags, location, and custom attributes
- Notes: Attach notes to leads for tracking interactions
- Scoring Rules: Define custom scoring expressions to rank leads automatically
- Batch Operations: Create up to 100 leads in a single API call
- MCP Integration: Connect AI assistants (Claude, Cursor, etc.) directly to your leads
- Rate Limiting: Sliding window rate limiting with plan-based limits
Quick Start
1. Get Your API Key
Your API key is available on the Settings page after signing in. API keys have the format:
Code
2. Make Your First Request
Code
3. Create a Lead
Code
Response:
Code
Authentication
All API endpoints require authentication using your API key. Include it in your requests using one of these methods:
X-API-Key Header
Code
Using API Keys in Documentation
Important: Zudoku documentation doesn't support API key authentication in the playground UI. You need to manually add your API key to each request.
To test API endpoints:
- Copy your API key from the Settings page
- For each API request you want to test:
- Click the "Try it" button on any endpoint
- In the request preview, click "Add header"
- Add header:
X-API-Keywith your API key as the value - Execute the request
Example request headers:
Code
Alternatively, you can use these API testing tools that support API keys:
- Postman - Import the OpenAPI spec from
/api/openapi.yaml - Insomnia - Import the OpenAPI spec
- curl - Add
-H "X-API-Key: your_key"to commands
Lead Model
Each lead contains the following fields:
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Business or contact name |
source | string | Yes | Where the lead came from |
description | string | No | Detailed description |
address | string | No | Street address |
city | string | No | City name |
state | string | No | State or province |
country | string | No | Country name |
postal_code | string | No | ZIP or postal code |
latitude | number | No | GPS latitude |
longitude | number | No | GPS longitude |
phone | string | No | Phone number |
email | string | No | Email address |
website | string | No | Website URL |
rating | number | No | Rating (typically 0-5) |
review_count | integer | No | Number of reviews |
category | string | No | Business category |
tags | string[] | No | Array of tags |
source_id | string | No | ID from the source system |
logo_url | string | No | URL to business logo |
attributes | object[] | No | Custom key-value pairs |
Dynamic Attributes
Store custom data with type safety:
Code
Filtering Leads
The API supports powerful filtering with multiple operators using the filter query parameter.
Filter Format: logic.operator.field.value
Code
Available Operators
Text Fields
| Operator | Description | Example |
|---|---|---|
eq | Equals (case insensitive) | filter=and.eq.city.Athens |
neq | Not equals | filter=and.neq.country.USA |
contains | Contains substring | filter=and.contains.name.pizza |
not_contains | Does not contain | filter=and.not_contains.name.test |
is_empty | Is null or empty | filter=and.is_empty.email |
is_not_empty | Has a value | filter=and.is_not_empty.phone |
Number Fields
| Operator | Description | Example |
|---|---|---|
eq | Equals | filter=and.eq.rating.4.5 |
neq | Not equals | filter=and.neq.review_count.0 |
gt | Greater than | filter=and.gt.rating.4 |
gte | Greater than or equal | filter=and.gte.rating.4 |
lt | Less than | filter=and.lt.rating.3 |
lte | Less than or equal | filter=and.lte.review_count.10 |
Tags/Arrays
| Operator | Description | Example |
|---|---|---|
array_contains | Contains value | filter=and.array_contains.tags.vip |
array_not_contains | Does not contain | filter=and.array_not_contains.tags.spam |
array_empty | Array is empty | filter=and.array_empty.tags |
array_not_empty | Array has items | filter=and.array_not_empty.tags |
Location
| Operator | Description | Example |
|---|---|---|
within_radius | Within radius (km) | filter=and.within_radius.location.37.98,23.73,5 |
is_set | Has coordinates | filter=and.is_set.location |
is_not_set | No coordinates | filter=and.is_not_set.location |
Pagination & Sorting
Combine filters, pagination, and sorting in a single request:
Code
Parameters:
limit: Maximum results per page (default: 50, max: 1000)cursor: Pagination cursor from previous responsesort_by: Field to sort bysort_order:ASCorDESC(default:ASC)
Response:
Code
Batch Operations
Create up to 100 leads in a single request:
Code
Response (207 Multi-Status for partial success):
Code
Notes
Attach notes to leads for tracking interactions:
Code
Scoring Rules
Define custom scoring expressions to automatically rank leads. Scores are calculated when leads are created and can be recalculated in bulk.
Expression Variables
| Variable | Type | Description |
|---|---|---|
rating | number | Lead rating (0-5) |
review_count | number | Number of reviews |
email | string | Email address (nil if not set) |
phone | string | Phone number (nil if not set) |
website | string | Website URL (nil if not set) |
city | string | City name |
country | string | Country name |
tags | string[] | Array of tags |
Example Expressions
Code
Scores are automatically clamped to the 0-100 range.
Rate Limits
API requests are rate-limited using a sliding window algorithm.
| Plan | Limit | Window |
|---|---|---|
| Free | 100 requests | 10 minutes |
| Pro | 1,000 requests | 10 minutes |
Rate Limit Headers
Every response includes rate limit information:
| Header | Description |
|---|---|
X-RateLimit-Limit | Maximum requests per window |
X-RateLimit-Remaining | Remaining requests |
Retry-After | Seconds to wait (when rate limited) |
Rate Limit Exceeded Response
Code
HTTP Status: 429 Too Many Requests
Error Handling
All errors follow a consistent format:
Code
Common Error Codes
| Status | Description |
|---|---|
400 | Invalid request body or parameters |
401 | Missing or invalid API key |
403 | Leads limit reached (upgrade required) |
404 | Resource not found |
429 | Rate limit exceeded |
500 | Internal server error |
Next Steps
- API Reference - Complete endpoint documentation with interactive examples
- MCP Setup Guide - Connect AI assistants to your leads
- Changelog - API version history
- FAQ - Common questions, troubleshooting, and answers