Contacts & Leads
Contacts are the full CRM card; leads are the scoring view over the same records. Both share one table — a lead update edits the underlying contact.
All endpoints require a Bearer JWT in the Authorization header plus an X-Workspace-Id header selecting the workspace.
Contacts
/api/contactsAuth requiredList contacts with linked-company info, activity counts, and last-touch timestamps.
Query Parameters
| Field | Type | Required | Note |
|---|---|---|---|
| stage | string | No | Filter by stage |
| search | string | No | Matches name, company, email |
| limit | number | No | Default 50, max 200 |
| offset | number | No | Default 0 |
Response
[
{
"id": 3,
"workspace_id": 1,
"name": "Jane Doe",
"email": "jane@acme.com",
"company": "Acme Corp",
"company_id": 1,
"title": "VP Sales",
"state": "qualified",
"score": 78,
"activity_count": 5,
"last_touch": "2026-03-28T14:30:00Z"
}
]/api/contactsAuth requiredCreate a contact.
Request Body
| Field | Type | Required | Note |
|---|---|---|---|
| name | string | Yes | Required |
| string | No | — | |
| company | string | No | Free text; use company links for the real relation |
| title | string | No | — |
| phone | string | No | — |
| stage | string | No | Default 'lead' |
| source | string | No | — |
| notes | string | No | — |
| score | number | No | 0–100, default 50 |
Response
{
"id": 4,
"workspace_id": 1,
"name": "John Smith",
"email": "john@globex.com",
"company": "Globex",
"state": "lead",
"score": 50,
"activity_count": 0,
"last_touch": null
}/api/contacts/{contact_id}Auth requiredGet a contact with its recent activities (up to 50) and deals.
Response
{
"id": 3,
"name": "Jane Doe",
"state": "qualified",
"score": 78,
"activities": [ { "id": 9, "type": "call", "description": "Intro call" } ],
"deals": [ { "id": 7, "title": "Enterprise plan", "value": 120000 } ]
}/api/contacts/{contact_id}Auth requiredUpdate contact fields. All fields optional; returns 400 when no fields are provided.
Request Body
| Field | Type | Required | Note |
|---|---|---|---|
| name | string | No | — |
| string | No | — | |
| company | string | No | — |
| title | string | No | — |
| phone | string | No | — |
| stage | string | No | — |
| source | string | No | — |
| notes | string | No | — |
| score | number | No | 0–100 |
Response
{ "id": 3, "name": "Jane Doe", "state": "customer", "score": 85 }/api/contacts/{contact_id}Auth requiredDelete a contact and remove its company links.
Response
{ "deleted": 3 }Leads
/api/leadsAuth requiredList leads ordered by score (highest first). Same records as contacts, in the scoring shape.
Query Parameters
| Field | Type | Required | Note |
|---|---|---|---|
| status | string | No | Filter by stage |
| search | string | No | Matches name, company |
| limit | number | No | Default 50, max 200 |
| offset | number | No | Default 0 |
Response
[
{
"id": 3,
"workspace_id": 1,
"name": "Jane Doe",
"company": "Acme Corp",
"source": "inbound",
"score": 78,
"status": "qualified"
}
]/api/leadsAuth requiredCreate a lead (a contact row without email).
Request Body
| Field | Type | Required | Note |
|---|---|---|---|
| name | string | Yes | Required |
| company | string | No | — |
| title | string | No | — |
| source | string | No | — |
| score | number | No | 0–100, default 50 |
| status | string | No | Default 'lead' |
Response
{
"id": 5,
"name": "New Prospect",
"company": "Initech",
"score": 50,
"status": "lead"
}/api/leads/{contact_id}Auth requiredUpdate a lead. Accepts status (mapped to the contact stage) plus scoring fields.
Request Body
| Field | Type | Required | Note |
|---|---|---|---|
| name | string | No | — |
| company | string | No | — |
| title | string | No | — |
| source | string | No | — |
| score | number | No | 0–100 |
| status | string | No | — |
Response
{ "id": 5, "name": "New Prospect", "score": 62, "status": "qualified" }/api/leads/{contact_id}Auth requiredDelete a lead (deletes the underlying contact).
Response
{ "deleted": 5 }