API: Leads
Create, read, update, and delete leads.
List Leads
GET
/api/leadsList leads for the authenticated organization
Auth: Session
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| stage | string | Filter by pipeline stage (e.g., INBOUND, HIGH_INTENT) |
| search | string | Search across name, email, company |
| limit | number | Max results (default: 50) |
Create Lead
POST
/api/leadsCreate a new lead
Auth: Session
Request Body
| Parameter | Type | Description |
|---|---|---|
| name | string | Lead full name(required) |
| string | Lead email (must be unique)(required) | |
| phone | string | Phone number |
| title | string | Job title |
| company | string | Company name |
| location | string | Location |
| string | LinkedIn URL | |
| source | string | Source label (default: WEB_FORM) |
Response (201)
{ "id": "clx...", "name": "Jane Doe", "email": "jane@acme.com", "pipelineStage": "INBOUND", ... }Update Lead
PUT
/api/leads/[id]Update any lead fields
Auth: Session
Send any subset of lead fields. Empty strings are ignored; use null to clear a field.
Close Lead
POST
/api/leads/[id]/closeClose as won or lost
Auth: Session
Request
{ "outcome": "won", "earnings": 5000 }Response
{ "status": "CLOSED_WON", "leadId": "clx...", "earnings": 5000 }Email Sequences
POST
/api/leads/[id]/sequenceCreate an email sequence
Auth: Session
Request Body
| Parameter | Type | Description |
|---|---|---|
| templateStyle | string | Style: professional, minimal, bold, elegant, friendly |
| intervalValue | number | Days between emails (default: 2) |
| intervalUnit | string | Unit: days, weeks, hours |
| emailAccountId | string | Email account to send from |
| useAI | boolean | Generate emails with AI (default: true) |
| customEmails | array | Manual emails: [{subject, body}] |
Use the action field in PUT to: activate, send, cancel, or regenerate the sequence.