Skip to Content
InsurgeDocumentation

Leads

List the people your agents have met, and fetch one lead with their meetings.

Developers
Markdown

A lead is a person who told one of your agents who they are, usually through the visitor form. Leads are unique by email within your workspace, so a person who comes back is the same lead. Both endpoints need a key with the leads:read scope.

A visitor who never gave an email (an agent with its visitor form off) still gets a lead, as an anonymous placeholder whose email ends in @anonymous.invalid. The list leaves those out unless you ask for them. Their meetings are always in GET /api/v1/meetings.

The lead object

NameTypeDescription
idstringThe lead's id. Meetings and webhooks refer to it as lead_id.
tenant_idstringYour workspace's id.
emailstringThe email the person gave. Unique within the workspace, compared without regard to case.
namestring | nullTheir name, when they gave one.
companystring | nullTheir company, when they gave one.
rolestring | nullTheir role, when they gave one.
first_seen_atnumberWhen the lead was created, in Unix seconds.
last_seen_atnumberWhen the person was last seen, in Unix seconds.
meeting_countnumberHow many meetings they have had.
lead_score'hot' | 'warm' | 'cold' | nullThe score from their latest scored meeting. Only presentation and tour meetings are scored; null until one is.
status'new' | 'engaged' | 'qualified' | 'disqualified'new until their first meeting, then engaged. Your team sets qualified or disqualified on the lead in the dashboard.
custom_fieldsobjectAnswers to your own visitor-form questions, keyed by field. An empty object when there are none.
languagestring | nullA language code such as hi-IN when one was set for this person. null means the workspace default.

List leads

GET /api/v1/leads returns leads, most recently seen first.

NameTypeDescription
statusstringOnly leads with this status: new, engaged, qualified or disqualified.
scorestringOnly leads with this lead_score: hot, warm or cold.
qstringSearch text. Matches the lead's name, email, company or any answer on your visitor form.
include_anonymousbooleantrue also lists anonymous visitors.Default: false
limitnumberLeads per page, 1 to 500.Default: 100
offsetnumberHow many leads to skip.Default: 0
List engaged leads
curl 'https://api.insurgeai.com/api/v1/leads?status=engaged&limit=50' \
  -H "Authorization: Bearer $INSURGE_API_KEY"
200 OK
{
  "leads": [
    {
      "id": "c41e7b2a9d3f4e6a8b1c5d7f9e2a4b6c",
      "tenant_id": "acme",
      "email": "arjun@example.org",
      "name": "Arjun Rao",
      "company": "Northwind Traders",
      "role": null,
      "first_seen_at": 1796122800.4,
      "last_seen_at": 1796122800.5,
      "meeting_count": 1,
      "lead_score": null,
      "status": "engaged",
      "custom_fields": {},
      "language": null
    },
    {
      "id": "3f6c1a9e2b7d4e5f8a9b0c1d2e3f4a5b",
      "tenant_id": "acme",
      "email": "priya@example.com",
      "name": "Priya Sharma",
      "company": "Example Labs",
      "role": "Head of Operations",
      "first_seen_at": 1796119198.3,
      "last_seen_at": 1796119200.6,
      "meeting_count": 1,
      "lead_score": "hot",
      "status": "engaged",
      "custom_fields": {
        "team_size": "40"
      },
      "language": null
    }
  ],
  "count": 2
}

count is the number of leads in this page. Keep asking with a larger offset until a page has fewer than limit leads.

StatusWhen
401The key is missing, wrong, expired or revoked.
403The key doesn't have leads:read.
422limit or offset is out of range.

Get a lead

GET /api/v1/leads/{lead_id} returns one lead and their meetings, newest first (up to 100). Each meeting has the shape of an item in List meetings.

NameTypeDescription
lead_id requiredstringThe lead's id, from a meeting, a webhook or the list.
Get a lead
curl 'https://api.insurgeai.com/api/v1/leads/your_lead_id' \
  -H "Authorization: Bearer $INSURGE_API_KEY"
200 OK
{
  "lead": {
    "id": "3f6c1a9e2b7d4e5f8a9b0c1d2e3f4a5b",
    "tenant_id": "acme",
    "email": "priya@example.com",
    "name": "Priya Sharma",
    "company": "Example Labs",
    "role": "Head of Operations",
    "first_seen_at": 1796119198.3,
    "last_seen_at": 1796119200.6,
    "meeting_count": 1,
    "lead_score": "hot",
    "status": "engaged",
    "custom_fields": {
      "team_size": "40"
    },
    "language": null
  },
  "meetings": [
    {
      "id": "9b2e7c4d1a3f4b6e8d0c2a4e6f8b1d3c",
      "lead_id": "3f6c1a9e2b7d4e5f8a9b0c1d2e3f4a5b",
      "client_id": "b0c6f1e2-5a7d-4c39-9e8b-2f4d6a1c3e5b",
      "started_at": 1796119200.4,
      "ended_at": 1796119612.4,
      "duration_s": 412.0,
      "plan_slug": "agent:product-tour",
      "final_phase": null,
      "status": "completed",
      "objectives_total": 4,
      "objectives_completed": 4,
      "lang": "en-IN",
      "channel": null,
      "agent_id": "product-tour",
      "platform": "desktop_web",
      "source": null,
      "embed_host": "www.example.com",
      "progress": {
        "sections_done": [
          "Workspace",
          "Pipelines",
          "Alerts",
          "Reports"
        ],
        "sections_total": 4,
        "next_section": null
      },
      "resumed_from_meeting_id": null,
      "lead_name": "Priya Sharma",
      "lead_email": "priya@example.com",
      "lead_company": "Example Labs",
      "lead_role": "Head of Operations",
      "lead_score": "hot",
      "lead_status": "engaged",
      "requested_follow_up": 1
    }
  ]
}
StatusWhen
403The key doesn't have leads:read.
404Lead not found: <id>. There is no lead with this id in the key's workspace.

On this page