# API reference

Authenticate server requests and read leads, meetings, transcripts, and CRM sync results.

Use the Insurge API to read leads, meeting briefs, transcripts, and CRM sync results from your own server. Use [webhooks](/docs/developers/webhooks) if you want Insurge to send events to you instead. Connecting HubSpot or Salesforce in the dashboard does not need this API.

## Create and protect an API key

Sign in to the [Insurge dashboard](https://dashboard.insurgeai.com) as a workspace admin, then open **Settings → Developers** and select **Create key**. Name the key, choose its scopes, and choose an expiry: **90 days**, **1 year** (the default), or **Never**. Copy the secret: it is shown once and starts with `insurge_live_`.

Store the key in your server's secret manager, for example as `INSURGE_API_KEY`. Never put it in an embed tag, browser JavaScript, a mobile app, or a public repository. If a key leaks, revoke it in the dashboard and create a new one.

Send the key on every request in either header:

- `Authorization: Bearer <key>`
- `X-Api-Key: <key>`

If both are sent, the `Authorization` header is used. The key decides the workspace; an `X-Tenant-Id` header does not change it, and a dashboard sign-in cookie does not authenticate these endpoints.

This request uses the `X-Api-Key` header to list meetings:

```bash
curl --fail-with-body \
  -H "X-Api-Key: $INSURGE_API_KEY" \
  'https://api.insurgeai.com/api/v1/meetings'
```

```json
{"meetings": [], "count": 0}
```

## Base URL and first request

The base URL is `https://api.insurgeai.com/api/v1`. This request lists up to 100 meetings in the key's workspace:

```bash
curl --fail-with-body \
  -H "Authorization: Bearer $INSURGE_API_KEY" \
  'https://api.insurgeai.com/api/v1/meetings?limit=100&offset=0'
```

The response has a `meetings` array and `count`, the number of items in this response (not the workspace total). An empty list is a valid response:

```json
{"meetings": [], "count": 0}
```

## Scopes

Give each key only the access it needs. A key created without choosing scopes gets the three read scopes marked as default. Every other scope must be chosen by name: transcripts are what visitors said word for word, recordings hold their screen and voice, CRM writes push data into your CRM, and continue links open a visitor's demo as that visitor.

| Scope | Allows | Default |
| --- | --- | --- |
| `leads:read` | List and fetch leads | Yes |
| `meetings:read` | List meetings and fetch briefs, without transcripts | Yes |
| `integrations:read` | Read CRM connection status and the sync log | Yes |
| `transcripts:read` | Fetch a meeting's full transcript | No |
| `integrations:write` | Run a CRM sync for one meeting | No |
| `recordings:read` | List, describe, and download meeting recordings | No |
| `recordings:delete` | Delete Insurge's copy of a recording | No |
| `sessions:write` | Create and end continue links for visitors who left a demo part way | No |

## Endpoints

Paths are relative to `https://api.insurgeai.com/api/v1`. Replace `your_meeting_id` and `your_lead_id` with IDs returned by the API.

| Method | Path | Scope | Returns |
| --- | --- | --- | --- |
| GET | `/leads` | `leads:read` | `leads` and `count` |
| GET | `/leads/{lead_id}` | `leads:read` | `lead` and that lead's `meetings` |
| GET | `/meetings` | `meetings:read` | `meetings` and `count` |
| GET | `/meetings/{meeting_id}` | `meetings:read` | `meeting`, `recording`, `lead`, `qualification`, `summary`, `follow_up_requested`, `follow_up`, `progress`, `resumed_from_meeting_id`, `resumable` |
| GET | `/meetings/{meeting_id}/transcript` | `transcripts:read` | `meeting_id` and `transcript` |
| GET | `/recordings` | `recordings:read` | `recordings`, `count`, and `next_cursor` |
| GET | `/meetings/{meeting_id}/recording` | `recordings:read` | `meeting_id` and `recording` |
| GET | `/meetings/{meeting_id}/recording.mp4` | `recordings:read` | The recording file (MP4) |
| DELETE | `/meetings/{meeting_id}/recording` | `recordings:delete` | `meeting_id` and the deleted `recording` |
| POST | `/resume-links` | `sessions:write` | A continue link: `url`, `token`, `expires_at`, and the meeting it carries on |
| DELETE | `/resume-links` | `sessions:write` | `revoked`, the number of links ended |
| GET | `/integrations/status` | `integrations:read` | HubSpot and Salesforce connection status |
| GET | `/integrations/sync-log` | `integrations:read` | `log` and `count` |
| POST | `/integrations/sync/{meeting_id}` | `integrations:write` | CRM sync results for the meeting |

Meetings opened from a test link or a Preview are not part of the API: they are never listed, and every meeting endpoint returns `404` for them.

### List leads

`GET /leads` returns leads newest-seen first. Query parameters:

| Parameter | Default | Meaning |
| --- | --- | --- |
| `limit` | `100` | Number of leads, from 1 to 500 |
| `offset` | `0` | Number of leads to skip |
| `q` | none | Search name, email, company, and form answers |
| `status` | none | Lead stage, such as `qualified` |
| `score` | none | `hot`, `warm`, or `cold` |
| `include_anonymous` | `false` | Also list anonymous visitors, whose emails end in `@anonymous.invalid` |

An unknown `status` or `score` value returns an empty list rather than an error. This requests the first 50 qualified leads:

```bash
curl --fail-with-body \
  -H "Authorization: Bearer $INSURGE_API_KEY" \
  'https://api.insurgeai.com/api/v1/leads?status=qualified&limit=50'
```

```json
{"leads": [], "count": 0}
```

### Fetch a lead

`GET /leads/{lead_id}` returns the lead and its 100 most recent meetings, newest first, in the same format as `GET /meetings`. To page through more, use `GET /meetings?lead_id=`. A missing lead, or one in another workspace, returns `404`.

```bash
curl --fail-with-body \
  -H "Authorization: Bearer $INSURGE_API_KEY" \
  'https://api.insurgeai.com/api/v1/leads/your_lead_id'
```

This sample is shortened; real records have more fields:

```json
{
  "lead": {
    "id": "your_lead_id",
    "email": "jane@example.com",
    "name": "Jane Example",
    "company": "Example Co",
    "role": "Operations lead",
    "first_seen_at": 1795427405.8,
    "last_seen_at": 1795427405.8,
    "meeting_count": 1,
    "lead_score": "hot",
    "status": "engaged",
    "custom_fields": {"team_size": "11-50"},
    "language": null
  },
  "meetings": [
    {
      "id": "your_meeting_id",
      "lead_id": "your_lead_id",
      "agent_id": "product-tour",
      "status": "completed",
      "started_at": 1795427412.3,
      "ended_at": 1795427987.6,
      "duration_s": 575.3,
      "requested_follow_up": 1
    }
  ]
}
```

### List meetings and paginate

`GET /meetings` returns meetings newest-started first. Meetings of anonymous visitors are included. Query parameters:

| Parameter | Default | Meaning |
| --- | --- | --- |
| `limit` | `100` | Number of meetings, from 1 to 500 |
| `offset` | `0` | Number of meetings to skip |
| `lead_id` | none | Only this lead's meetings |
| `agent_id` | none | Only this agent's meetings |
| `status` | none | Meeting status, such as `completed` |
| `score` | none | The lead's score: `hot`, `warm`, or `cold` |
| `since` | none | Meetings that started at or after this time, in Unix seconds |
| `until` | none | Meetings that started before this time, in Unix seconds |

To page, increase `offset` by `limit` for each request and stop when a response has fewer items than `limit`. New meetings can arrive while you page, so store records by `id` and ignore repeats. This requests the second page of 50:

```bash
curl --fail-with-body \
  -H "Authorization: Bearer $INSURGE_API_KEY" \
  'https://api.insurgeai.com/api/v1/meetings?limit=50&offset=50'
```

```json
{"meetings": [], "count": 0}
```

### Fetch a brief or transcript

`GET /meetings/{meeting_id}` returns `meeting`, `recording`, `lead`, `qualification`, `summary`, `follow_up_requested`, `follow_up`, `progress`, `resumed_from_meeting_id`, and `resumable`: the same fields, with the same meaning, as a [meeting webhook's](/docs/developers/webhooks#meeting-events) `data` before its transcript. It does not include the transcript, timeline events, token usage, or cost. Check `summary.status` before reading the brief; it can be `pending`, `ready`, `failed`, or `skipped`.

- `recording` describes the meeting's recording; its `status` is `none` when the meeting was not recorded (see [Download and delete recordings](#download-and-delete-recordings)).
- `progress` is how far the visitor got through the agent's brief, merged across every visit when they came back through a continue link. It has `sections_done` (the sections they moved past, by title), `sections_total`, and `next_section` (where a continue link would carry on; `null` when everything is done). For a brief without a clear numbered outline, `sections_total` and `next_section` are `null` and `sections_done` holds the agent's own short names for what it covered. `progress` is `null` when nothing was recorded. `meeting.progress` is the same, for this visit alone.
- `resumed_from_meeting_id` is the meeting this one carried on from, or `null`.
- `resumable` is `true` when you can [create a continue link](#continue-a-visitors-demo) for this meeting: it is the visitor's newest visit, they left before the end, they gave their email, and the agent is a Tour guide, Help desk, or Training agent that is switched on.

```bash
curl --fail-with-body \
  -H "Authorization: Bearer $INSURGE_API_KEY" \
  'https://api.insurgeai.com/api/v1/meetings/your_meeting_id'
```

A shortened response for a meeting whose brief is not written yet:

```json
{
  "meeting": {"id": "your_meeting_id", "lead_id": "your_lead_id", "agent_id": "product-tour", "status": "completed"},
  "lead": {"id": "your_lead_id", "email": "jane@example.com", "name": "Jane Example"},
  "qualification": null,
  "summary": null,
  "follow_up_requested": null,
  "follow_up": null,
  "recording": {"status": "none", "content_type": null, "size_bytes": null, "sha256": null, "completed_at": null, "expires_at": null, "deleted_at": null, "deleted_by": null, "download_path": null},
  "progress": {"sections_done": ["Getting started"], "sections_total": 4, "next_section": "Reports"},
  "resumed_from_meeting_id": null,
  "resumable": true
}
```

The [webhooks guide](/docs/developers/webhooks#meeting-events) shows a complete brief and explains `follow_up` and `summary.answers`.

Fetch the whole conversation with a key that has `transcripts:read`:

```bash
curl --fail-with-body \
  -H "Authorization: Bearer $INSURGE_API_KEY" \
  'https://api.insurgeai.com/api/v1/meetings/your_meeting_id/transcript'
```

```json
{
  "meeting_id": "your_meeting_id",
  "transcript": [
    {"at": 0.0, "speaker": "agent", "text": "Welcome to the demo."},
    {"at": 6.4, "speaker": "visitor", "text": "Show me billing."}
  ]
}
```

`at` is seconds from the start of the conversation, to 0.1 s. A line also has `spoken` when the voice said something different from the written text, such as a translation. System notes and tool results are left out. Unlike a webhook, this endpoint never shortens long transcripts.

### Check CRM connections and sync results

`GET /integrations/status` reports whether HubSpot and Salesforce are configured and connected, without any OAuth secrets.

```bash
curl --fail-with-body \
  -H "Authorization: Bearer $INSURGE_API_KEY" \
  'https://api.insurgeai.com/api/v1/integrations/status'
```

A workspace with neither CRM connected; `configured` can be `true` when Insurge has set up the CRM app:

```json
{
  "hubspot": {"configured": true, "connected": false},
  "salesforce": {
    "configured": false,
    "app": {"registered": false, "source": null},
    "connected": false
  }
}
```

`GET /integrations/sync-log` lists recent CRM sync results; `limit` defaults to 50, up to 200.

```bash
curl --fail-with-body \
  -H "Authorization: Bearer $INSURGE_API_KEY" \
  'https://api.insurgeai.com/api/v1/integrations/sync-log?limit=50'
```

```json
{"log": [], "count": 0}
```

`POST /integrations/sync/{meeting_id}` runs the CRM sync for one meeting again. Use it only when you mean to: it can write to a connected CRM.

```bash
curl --fail-with-body -X POST \
  -H "Authorization: Bearer $INSURGE_API_KEY" \
  'https://api.insurgeai.com/api/v1/integrations/sync/your_meeting_id'
```

For a meeting in a workspace with no CRM connected, the response is:

```json
{"synced": [], "results": {}, "errors": []}
```

Check `results` and `errors` even when the status is `200`: one CRM can fail while the request succeeds.

### Download and delete recordings

Use these endpoints to keep meeting recordings in your own storage: download each recording, check it, then delete Insurge's copy. A recording is an MP4 of the screen the visitor saw, with the agent's voice and the visitor's microphone. Insurge deletes its copy anyway at the end of its retention period (`expires_at`), so download before then. The [`recording.ready` webhook](/docs/developers/webhooks#recording-events) tells you when a recording can be downloaded, so you do not need to poll.

`GET /recordings` lists recorded meetings, oldest first, with a key that has `recordings:read`:

```bash
curl --fail-with-body \
  -H "Authorization: Bearer $INSURGE_API_KEY" \
  'https://api.insurgeai.com/api/v1/recordings?limit=100'
```

```json
{
  "recordings": [
    {
      "meeting_id": "your_meeting_id",
      "lead_id": "your_lead_id",
      "agent_id": "product-tour",
      "channel": "web",
      "started_at": 1764750000.0,
      "ended_at": 1764750260.4,
      "duration_s": 260.4,
      "recording": {
        "status": "completed",
        "content_type": "video/mp4",
        "size_bytes": 48211934,
        "sha256": "9f2c4a7e0b1d3f5a6c8e9b0d2f4a6c8e0b1d3f5a7c9e1b3d5f7a9c1e3b5d7f9a",
        "completed_at": 1764750331.0,
        "expires_at": 1767342331.0,
        "deleted_at": null,
        "deleted_by": null,
        "download_path": "/api/v1/meetings/your_meeting_id/recording.mp4"
      }
    }
  ],
  "count": 1,
  "next_cursor": null
}
```

| Parameter | Default | Meaning |
| --- | --- | --- |
| `limit` | `100` | Number of recordings, from 1 to 500 |
| `status` | `completed` | `completed`, `processing`, `failed`, `expired`, `deleted`, or `all`; separate several with commas |
| `since` | none | Meetings that started at or after this time, in Unix seconds |
| `until` | none | Meetings that started before this time, in Unix seconds |
| `cursor` | none | The `next_cursor` from the previous page |

To page, pass `next_cursor` back as `cursor`; it is `null` on the last page. Pages stay correct while you delete recordings you have already copied. A `cursor` this API did not return gives `400`.

`recording.status` is `processing`, `completed`, `failed`, `expired`, or `deleted` (`none` for a meeting that was not recorded). Only a `completed` recording has a `download_path`. `expires_at` is when Insurge deletes its copy; it is `null` when no retention period applies or once the recording is gone.

`GET /meetings/{meeting_id}/recording` returns `meeting_id` and that meeting's `recording`:

```bash
curl --fail-with-body \
  -H "Authorization: Bearer $INSURGE_API_KEY" \
  'https://api.insurgeai.com/api/v1/meetings/your_meeting_id/recording'
```

```json
{
  "meeting_id": "your_meeting_id",
  "recording": {
    "status": "completed",
    "content_type": "video/mp4",
    "size_bytes": 48211934,
    "sha256": "9f2c4a7e0b1d3f5a6c8e9b0d2f4a6c8e0b1d3f5a7c9e1b3d5f7a9c1e3b5d7f9a",
    "completed_at": 1764750331.0,
    "expires_at": 1767342331.0,
    "deleted_at": null,
    "deleted_by": null,
    "download_path": "/api/v1/meetings/your_meeting_id/recording.mp4"
  }
}
```

Download the file:

```bash
curl --fail-with-body \
  -H "Authorization: Bearer $INSURGE_API_KEY" \
  -o recording.mp4 \
  'https://api.insurgeai.com/api/v1/meetings/your_meeting_id/recording.mp4'
```

- The response is the whole file (`200`), or exactly the `Range` you ask for (`206`). Add `-C -` to `curl` to continue a broken transfer.
- `X-Content-SHA256` and `ETag` carry the file's SHA-256, which is also `recording.sha256`. Recordings made before 30 Nov 2026 have no stored digest (`sha256` is `null`).
- A workspace can have at most 4 downloads open at once; a fifth gets `429` with `Retry-After`. A client that takes more than two minutes to accept a 4 MB chunk is disconnected; continue with a `Range` request.

Once you have checked your copy, delete Insurge's with a key that has `recordings:delete`. Pass the SHA-256 of your file (for example from `sha256sum recording.mp4`) as `sha256`, so nothing is deleted unless it matches:

```bash
curl --fail-with-body -X DELETE \
  -H "Authorization: Bearer $INSURGE_API_KEY" \
  'https://api.insurgeai.com/api/v1/meetings/your_meeting_id/recording?sha256=your_file_sha256'
```

```json
{
  "meeting_id": "your_meeting_id",
  "recording": {
    "status": "deleted",
    "content_type": null,
    "size_bytes": 48211934,
    "sha256": "9f2c4a7e0b1d3f5a6c8e9b0d2f4a6c8e0b1d3f5a7c9e1b3d5f7a9c1e3b5d7f9a",
    "completed_at": 1764750331.0,
    "expires_at": null,
    "deleted_at": 1764752000.0,
    "deleted_by": {"kind": "api_key", "id": "your_key_id"},
    "download_path": null
  }
}
```

The recording now has `status` `deleted`, no `download_path`, and `deleted_by` naming your key. The meeting, its transcript, and its brief stay. **Deleting cannot be undone.**

- `412`: the `sha256` does not match Insurge's copy, or the recording has no stored digest. Nothing was deleted.
- `409`: the recording is still being processed. Wait for `recording.ready`.
- `404`: the meeting has no recording, or is not in your workspace.
- `503`: storage could not delete it. Nothing changed; try again.
- Deleting again, or deleting a recording that already expired, returns `200` with the same result and changes nothing.

`deleted_by.kind` is `api_key` (with the key's ID), `user` (a workspace admin deleted it from the meeting's page in the dashboard, with the person's ID), `insurge` (Insurge support, no ID), or `retention` (it expired; `status` is then `expired`).

### Continue a visitor's demo

A visitor who left a Tour guide, Help desk, or Training session part way can carry on where they left off. Your server creates a private continue link with a key that has `sessions:write`, then puts it where the visitor will find it, such as your own page or an email:

```bash
curl --fail-with-body -X POST \
  -H "Authorization: Bearer $INSURGE_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"email":"jane@example.com","agent_id":"product-tour"}' \
  'https://api.insurgeai.com/api/v1/resume-links'
```

```json
{
  "url": "https://demo.insurgeai.com/s/your_share_code#resume=your_resume_token",
  "token": "your_resume_token",
  "expires_at": "2026-12-10T10:00:00+00:00",
  "meeting_id": "your_meeting_id",
  "lead_id": "your_lead_id",
  "agent_id": "product-tour",
  "progress": {"sections_done": ["Getting started"], "sections_total": 4, "next_section": "Reports"}
}
```

- **Body:** `meeting_id`, or `email` with an optional `agent_id` (that visitor's newest meeting, with that agent if given). `ttl_hours` sets how long the link works, from 1 to 720 hours; the default is 168 (7 days). The link can be opened any number of times until then.
- **The address** is the agent's live sharing link, on your workspace's own link address if it has one, with `#resume=<token>` added. If you build the address yourself, such as your own iframe `src`, add `resume=<token>` to the fragment and keep any other fragment parameters, for example `#inline=1&resume=<token>`.
- **Which visit:** the link always carries on the visitor's newest visit, even when you pass an older meeting, and `progress` covers every visit.
- **Scope:** the link is tied to your workspace, the agent, and the visitor. Opened on another agent's page or another workspace's, it does not work. Insurge stores only a hash of the token.
- **What the visitor sees:** no visitor form, a "welcome back" with a short recap, then the next section. The visit is a new meeting whose `resumed_from_meeting_id` is the previous one.
- **Not a login:** the resumed session is not signed in to any account the visitor made last time, so anything that needs their account asks them to verify again.

Errors have `{"detail": {"code": …, "message": …}}`:

| Status | `code` | Meaning |
| --- | --- | --- |
| `404` | `no_meeting` | No such meeting, or no meeting for that email |
| `409` | `already_completed` | The visitor's newest visit already finished the demo |
| `422` | `test_meeting` | The meeting came from a test link or a Preview |
| `422` | `anonymous_lead` | The visitor never gave their email |
| `422` | `not_resumable` | The agent is a Presenter or Copilot, or is switched off |
| `422` | `no_link` | The agent has no live sharing link |

To act when someone leaves part way, listen for a [`meeting.ended` webhook](/docs/developers/webhooks#meeting-events) with `resumable: true`.

End links before they expire, either one link by its token (the part after `#resume=`) or every live link of one visitor:

```bash
curl --fail-with-body -X DELETE \
  -H "Authorization: Bearer $INSURGE_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"lead_id":"your_lead_id"}' \
  'https://api.insurgeai.com/api/v1/resume-links'
```

```json
{"revoked": 1}
```

Send `{"token": "your_resume_token"}` to end a single link. `revoked` is the number of live links ended; `0` is not an error. Only your workspace's links are affected. A visitor who opens an ended link sees that it no longer works.

## Errors and rate limits

Check the HTTP status before using a response. Error bodies have a `detail` field; a `422` can list several problems. Recording and continue-link errors with their own meanings are listed in those sections.

| Status | Meaning | What to do |
| --- | --- | --- |
| `400` | A `cursor` this API did not return | Start again without `cursor` |
| `401` | The key is missing, wrong, expired, or revoked | Check the key and its expiry |
| `403` | The key does not have the scope this endpoint needs | Create a key with that scope |
| `404` | The record does not exist, is in another workspace, or is a test meeting | Check the ID |
| `409`, `412` | A recording is not ready, or its `sha256` did not match | See [Download and delete recordings](#download-and-delete-recordings) |
| `422` | A parameter or body is invalid, such as `limit=1000`, or a continue link cannot be created | Fix the value using the tables above |
| `429` | The key has used up its request allowance, or 4 recording downloads are already open | Wait the number of seconds in `Retry-After` |
| `5xx` | A server or upstream problem | Retry reads with backoff; check the CRM before repeating a sync, and the recording before repeating a delete |

Each key can make 60 requests per minute, with bursts of up to 120. Insurge may change this limit; always honour `Retry-After` rather than hard-coding it. Requests that fail with `403` count towards the limit. A `429` response includes `Retry-After`; wait that long before retrying.

## What this API does not do

Create and revoke API keys, connect CRMs, and manage webhook endpoints in the dashboard; those actions need a signed-in workspace admin, not an API key. A workspace admin can also delete a recording from the meeting's page in the dashboard. Live meeting control and real-time streams are not part of this API.

Continue with [webhook delivery and signature checks](/docs/developers/webhooks), or [put an agent on your website](/docs/developers/embed).
