Overview
The lead sync API lets you push leads from your CRM (HubSpot, Salesforce, Pipedrive, or any custom system) into Naturalead. It supports idempotent upserts using an externallead_id, so you can run periodic syncs without creating duplicates.
Idempotent Upserts
Use your CRM’s lead ID as the external identifier. Re-syncing the same lead updates it instead of creating a duplicate.
Bulk Operations
Sync up to 100 leads per request. The API handles partial failures gracefully.
Authentication
Authenticate sync requests with an API key.Sync requests require an API key with the
leads:sync_create scope. Create one in Settings > API Keys in the dashboard.Using External lead_id for Idempotent Upserts
Every lead in the sync payload can include alead_id field that maps to your CRM’s unique identifier. When Naturalead receives a lead with a lead_id that already exists in your account, it updates the existing lead instead of creating a new one.
This makes your sync operations idempotent — running the same sync twice produces the same result.
Bulk Sync Example
Send an array of leads to the sync endpoint. Each lead should include alead_id from your CRM.
Handling Partial Failures
When syncing multiple leads, some may succeed while others fail validation. The API does not roll back successful operations when others fail. Instead, it returns a detailed breakdown.- Log all entries from the
errorsarray with theirlead_idfor investigation. - Fix the invalid data in your CRM.
- Re-sync only the failed leads in the next run.
Bulk Delete for Synced Leads
To remove leads that were deleted in your CRM, use the bulk delete endpoint with the externallead_id values.
Rate Limit Considerations
The sync API has a dedicated rate limit to protect system stability.| Limit | Value |
|---|---|
| Sync requests per minute | 50 |
| Leads per sync request | 100 |
| Maximum leads per minute | 5,000 |
Best Practices for Periodic Sync
Use External lead_id Consistently
Always include the CRM’s unique lead identifier as
lead_id. This is the key that makes upserts idempotent. Never omit it, or you risk creating duplicates.Sync Incrementally
Rather than syncing your entire CRM on every run, track the last sync timestamp and only send leads that were created or modified since then. This reduces API calls and processing time.
Handle Deletes Separately
After syncing new and updated leads, query your CRM for recently deleted records and send those to the bulk delete endpoint.
Schedule During Off-Peak Hours
If you are syncing large volumes, schedule your sync jobs during off-peak hours to avoid competing with real-time conversation traffic for rate limit capacity.
For real-time sync (pushing leads as they are created in your CRM), consider using your CRM’s webhook or event system to trigger individual lead creation via
POST /api/leads instead of the bulk sync endpoint.