Skip to main content

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

GET/api/contactsAuth required

List contacts with linked-company info, activity counts, and last-touch timestamps.

Query Parameters

FieldTypeRequiredNote
stagestringNoFilter by stage
searchstringNoMatches name, company, email
limitnumberNoDefault 50, max 200
offsetnumberNoDefault 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"
  }
]
POST/api/contactsAuth required

Create a contact.

Request Body

FieldTypeRequiredNote
namestringYesRequired
emailstringNo—
companystringNoFree text; use company links for the real relation
titlestringNo—
phonestringNo—
stagestringNoDefault 'lead'
sourcestringNo—
notesstringNo—
scorenumberNo0–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
}
GET/api/contacts/{contact_id}Auth required

Get 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 } ]
}
PATCH/api/contacts/{contact_id}Auth required

Update contact fields. All fields optional; returns 400 when no fields are provided.

Request Body

FieldTypeRequiredNote
namestringNo—
emailstringNo—
companystringNo—
titlestringNo—
phonestringNo—
stagestringNo—
sourcestringNo—
notesstringNo—
scorenumberNo0–100

Response

{ "id": 3, "name": "Jane Doe", "state": "customer", "score": 85 }
DELETE/api/contacts/{contact_id}Auth required

Delete a contact and remove its company links.

Response

{ "deleted": 3 }

Leads

GET/api/leadsAuth required

List leads ordered by score (highest first). Same records as contacts, in the scoring shape.

Query Parameters

FieldTypeRequiredNote
statusstringNoFilter by stage
searchstringNoMatches name, company
limitnumberNoDefault 50, max 200
offsetnumberNoDefault 0

Response

[
  {
    "id": 3,
    "workspace_id": 1,
    "name": "Jane Doe",
    "company": "Acme Corp",
    "source": "inbound",
    "score": 78,
    "status": "qualified"
  }
]
POST/api/leadsAuth required

Create a lead (a contact row without email).

Request Body

FieldTypeRequiredNote
namestringYesRequired
companystringNo—
titlestringNo—
sourcestringNo—
scorenumberNo0–100, default 50
statusstringNoDefault 'lead'

Response

{
  "id": 5,
  "name": "New Prospect",
  "company": "Initech",
  "score": 50,
  "status": "lead"
}
PATCH/api/leads/{contact_id}Auth required

Update a lead. Accepts status (mapped to the contact stage) plus scoring fields.

Request Body

FieldTypeRequiredNote
namestringNo—
companystringNo—
titlestringNo—
sourcestringNo—
scorenumberNo0–100
statusstringNo—

Response

{ "id": 5, "name": "New Prospect", "score": 62, "status": "qualified" }
DELETE/api/leads/{contact_id}Auth required

Delete a lead (deletes the underlying contact).

Response

{ "deleted": 5 }