# Lead

Read one lead, update its stage, assignment, contact details and tags.

Read one lead, update its stage, assignment, contact details and tags.

## Get lead

`GET /v1/leads/{lead_id}/`

Required scope: `leads:read`

### Parameters

| Name | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `lead_id` | path | integer | Yes |  |

### Response (200)

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `ad_title` | string | No | read-only |
| `archived` | boolean | No | read-only |
| `channels` | string[] | No | read-only |
| `closer` | object | No | read-only |
| `closer.member_id` | string | No | read-only |
| `closer.name` | string | No | read-only |
| `conversation_id` | string \| null | No | read-only |
| `conversations` | object[] | No | read-only |
| `conversations[].channel` | string | No | read-only |
| `conversations[].id` | string | No | read-only |
| `created_at` | string (date-time) | No | read-only |
| `display_name` | string | No | read-only |
| `has_email` | boolean | No | read-only |
| `has_phone` | boolean | No | read-only |
| `id` | string | No | read-only |
| `inbox_url` | string \| null | No | read-only |
| `instagram_name` | string \| null | No | read-only |
| `instagram_username` | string \| null | No | read-only |
| `is_ad_lead` | boolean | No | read-only |
| `is_excluded` | boolean | No | read-only |
| `is_reachable` | boolean | No | read-only |
| `is_spam` | boolean | No | read-only |
| `location` | object \| null | No | read-only |
| `location.city` | string \| null | No | read-only |
| `location.country` | string | No | read-only |
| `setter` | object | No | read-only |
| `setter.member_id` | string | No | read-only |
| `setter.name` | string | No | read-only |
| `source` | string | No | read-only |
| `source_media_type` | string | No | read-only |
| `stage` | string \| null | No | read-only |
| `stage_key` | string | No | read-only |
| `stage_name` | string | No | read-only |
| `tags` | object[] | No | read-only |
| `tags[].applied_by` | string | No | read-only |
| `tags[].id` | string | No | read-only |
| `tags[].name` | string | No | read-only |
| `unlocked_at` | string (date-time) | No | read-only |
| `unqualification_reason` | string | No | read-only |
| `updated_at` | string (date-time) | No | read-only |

### Responses

- `200` Success
- `400` The request is invalid.
- `401` Authentication is missing, invalid, or revoked.
- `403` The authenticated identity lacks the required scope or capability.
- `404` The resource is unavailable or not visible to this organization.
- `429` The request-rate budget is exhausted.

```bash
curl -X GET "https://api.themochi.app/v1/leads/<lead_id>/" \
  -H "Authorization: Bearer $MOCHI_API_KEY"
```

## Update lead

`PATCH /v1/leads/{lead_id}/`

Required scope: `leads:write`

### Parameters

| Name | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `lead_id` | path | integer | Yes |  |
| `Idempotency-Key` | header | string (uuid) | Yes | UUID4 identifying one intended write. Reuse it only when retrying that same write. |

### Request body

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `archived` | boolean | No |  |
| `stage` | string | No | one of `NEW`, `IN_CONTACT`, `QUALIFIED`, `UNQUALIFIED`, `BOOKED_CALL`, `DEPOSIT`, `WON`, `LOST`, `NO_SHOW` |
| `stage_key` | string | No | max length 32 |
| `unqualification_reason` | string | No | one of `underaged`, `time_waster`, `no_money`, `language_barrier`, `ghosted`, `unclear`, `no_reason` |

### Response (200)

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `ad_title` | string | No | read-only |
| `archived` | boolean | No | read-only |
| `channels` | string[] | No | read-only |
| `closer` | object | No | read-only |
| `closer.member_id` | string | No | read-only |
| `closer.name` | string | No | read-only |
| `conversation_id` | string \| null | No | read-only |
| `conversations` | object[] | No | read-only |
| `conversations[].channel` | string | No | read-only |
| `conversations[].id` | string | No | read-only |
| `created_at` | string (date-time) | No | read-only |
| `display_name` | string | No | read-only |
| `has_email` | boolean | No | read-only |
| `has_phone` | boolean | No | read-only |
| `id` | string | No | read-only |
| `inbox_url` | string \| null | No | read-only |
| `instagram_name` | string \| null | No | read-only |
| `instagram_username` | string \| null | No | read-only |
| `is_ad_lead` | boolean | No | read-only |
| `is_excluded` | boolean | No | read-only |
| `is_reachable` | boolean | No | read-only |
| `is_spam` | boolean | No | read-only |
| `location` | object \| null | No | read-only |
| `location.city` | string \| null | No | read-only |
| `location.country` | string | No | read-only |
| `setter` | object | No | read-only |
| `setter.member_id` | string | No | read-only |
| `setter.name` | string | No | read-only |
| `source` | string | No | read-only |
| `source_media_type` | string | No | read-only |
| `stage` | string \| null | No | read-only |
| `stage_key` | string | No | read-only |
| `stage_name` | string | No | read-only |
| `tags` | object[] | No | read-only |
| `tags[].applied_by` | string | No | read-only |
| `tags[].id` | string | No | read-only |
| `tags[].name` | string | No | read-only |
| `unlocked_at` | string (date-time) | No | read-only |
| `unqualification_reason` | string | No | read-only |
| `updated_at` | string (date-time) | No | read-only |

### Responses

- `200` Success
- `400` The request is invalid.
- `401` Authentication is missing, invalid, or revoked.
- `403` The authenticated identity lacks the required scope or capability.
- `404` The resource is unavailable or not visible to this organization.
- `409` The write conflicts with current state or an identical request is still running.
- `422` The write contains fields outside its closed input schema.
- `429` The request-rate budget is exhausted.

```bash
curl -X PATCH "https://api.themochi.app/v1/leads/<lead_id>/" \
  -H "Authorization: Bearer $MOCHI_API_KEY" \
  -H "Idempotency-Key: $(uuidgen | tr A-Z a-z)" \
  -H "Content-Type: application/json" \
  -d '{"archived":true,"stage":"NEW","stage_key":"string","unqualification_reason":"underaged"}'
```

## Assign a lead

`PUT /v1/leads/{lead_id}/assignment/`

Required scope: `leads:write`

### Parameters

| Name | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `lead_id` | path | integer | Yes |  |
| `Idempotency-Key` | header | string (uuid) | Yes | UUID4 identifying one intended write. Reuse it only when retrying that same write. |

### Request body

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `closer_id` | integer \| null | No |  |
| `setter_id` | integer \| null | No |  |

### Response (200)

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `ad_title` | string | No | read-only |
| `archived` | boolean | No | read-only |
| `channels` | string[] | No | read-only |
| `closer` | object | No | read-only |
| `closer.member_id` | string | No | read-only |
| `closer.name` | string | No | read-only |
| `conversation_id` | string \| null | No | read-only |
| `conversations` | object[] | No | read-only |
| `conversations[].channel` | string | No | read-only |
| `conversations[].id` | string | No | read-only |
| `created_at` | string (date-time) | No | read-only |
| `display_name` | string | No | read-only |
| `has_email` | boolean | No | read-only |
| `has_phone` | boolean | No | read-only |
| `id` | string | No | read-only |
| `inbox_url` | string \| null | No | read-only |
| `instagram_name` | string \| null | No | read-only |
| `instagram_username` | string \| null | No | read-only |
| `is_ad_lead` | boolean | No | read-only |
| `is_excluded` | boolean | No | read-only |
| `is_reachable` | boolean | No | read-only |
| `is_spam` | boolean | No | read-only |
| `location` | object \| null | No | read-only |
| `location.city` | string \| null | No | read-only |
| `location.country` | string | No | read-only |
| `setter` | object | No | read-only |
| `setter.member_id` | string | No | read-only |
| `setter.name` | string | No | read-only |
| `source` | string | No | read-only |
| `source_media_type` | string | No | read-only |
| `stage` | string \| null | No | read-only |
| `stage_key` | string | No | read-only |
| `stage_name` | string | No | read-only |
| `tags` | object[] | No | read-only |
| `tags[].applied_by` | string | No | read-only |
| `tags[].id` | string | No | read-only |
| `tags[].name` | string | No | read-only |
| `unlocked_at` | string (date-time) | No | read-only |
| `unqualification_reason` | string | No | read-only |
| `updated_at` | string (date-time) | No | read-only |

### Responses

- `200` Success
- `400` The request is invalid.
- `401` Authentication is missing, invalid, or revoked.
- `403` The authenticated identity lacks the required scope or capability.
- `404` The resource is unavailable or not visible to this organization.
- `409` The write conflicts with current state or an identical request is still running.
- `422` The write contains fields outside its closed input schema.
- `429` The request-rate budget is exhausted.

```bash
curl -X PUT "https://api.themochi.app/v1/leads/<lead_id>/assignment/" \
  -H "Authorization: Bearer $MOCHI_API_KEY" \
  -H "Idempotency-Key: $(uuidgen | tr A-Z a-z)" \
  -H "Content-Type: application/json" \
  -d '{"closer_id":1,"setter_id":1}'
```

## Update lead contact

`PATCH /v1/leads/{lead_id}/contact/`

Required scope: `leads:write`

### Parameters

| Name | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `lead_id` | path | integer | Yes |  |
| `Idempotency-Key` | header | string (uuid) | Yes | UUID4 identifying one intended write. Reuse it only when retrying that same write. |

### Request body

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `email` | string (email) | No | max length 254 |
| `overwrite` | boolean | No |  |
| `phone_number` | string | No | max length 255 |

### Response (200)

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `ad_title` | string | No | read-only |
| `archived` | boolean | No | read-only |
| `channels` | string[] | No | read-only |
| `closer` | object | No | read-only |
| `closer.member_id` | string | No | read-only |
| `closer.name` | string | No | read-only |
| `conversation_id` | string \| null | No | read-only |
| `conversations` | object[] | No | read-only |
| `conversations[].channel` | string | No | read-only |
| `conversations[].id` | string | No | read-only |
| `created_at` | string (date-time) | No | read-only |
| `display_name` | string | No | read-only |
| `has_email` | boolean | No | read-only |
| `has_phone` | boolean | No | read-only |
| `id` | string | No | read-only |
| `inbox_url` | string \| null | No | read-only |
| `instagram_name` | string \| null | No | read-only |
| `instagram_username` | string \| null | No | read-only |
| `is_ad_lead` | boolean | No | read-only |
| `is_excluded` | boolean | No | read-only |
| `is_reachable` | boolean | No | read-only |
| `is_spam` | boolean | No | read-only |
| `location` | object \| null | No | read-only |
| `location.city` | string \| null | No | read-only |
| `location.country` | string | No | read-only |
| `setter` | object | No | read-only |
| `setter.member_id` | string | No | read-only |
| `setter.name` | string | No | read-only |
| `source` | string | No | read-only |
| `source_media_type` | string | No | read-only |
| `stage` | string \| null | No | read-only |
| `stage_key` | string | No | read-only |
| `stage_name` | string | No | read-only |
| `tags` | object[] | No | read-only |
| `tags[].applied_by` | string | No | read-only |
| `tags[].id` | string | No | read-only |
| `tags[].name` | string | No | read-only |
| `unlocked_at` | string (date-time) | No | read-only |
| `unqualification_reason` | string | No | read-only |
| `updated_at` | string (date-time) | No | read-only |

### Responses

- `200` Success
- `400` The request is invalid.
- `401` Authentication is missing, invalid, or revoked.
- `403` The authenticated identity lacks the required scope or capability.
- `404` The resource is unavailable or not visible to this organization.
- `409` The write conflicts with current state or an identical request is still running.
- `422` The write contains fields outside its closed input schema.
- `429` The request-rate budget is exhausted.

```bash
curl -X PATCH "https://api.themochi.app/v1/leads/<lead_id>/contact/" \
  -H "Authorization: Bearer $MOCHI_API_KEY" \
  -H "Idempotency-Key: $(uuidgen | tr A-Z a-z)" \
  -H "Content-Type: application/json" \
  -d '{"email":"string","overwrite":true,"phone_number":"string"}'
```

## Get lead intelligence

`GET /v1/leads/{lead_id}/intelligence/`

Required scope: `leads:read`, `signals:read`

### Parameters

| Name | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `lead_id` | path | integer | Yes |  |

### Response (200)

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `ai_mode` | object | No | read-only |
| `ai_mode.enabled` | boolean | No | read-only |
| `ai_mode.status` | string | No | read-only |
| `conversation_stage` | object | No | read-only |
| `conversation_stage.entered_at` | string (date-time) | No | read-only |
| `conversation_stage.value` | string | No | read-only |
| `engagement` | object | No | read-only |
| `engagement.avg_score` | number | No | read-only |
| `engagement.computed_at` | string (date-time) | No | read-only |
| `engagement.max_score` | number | No | read-only |
| `engagement.question_count` | integer | No | read-only |
| `engagement.trend` | string | No | read-only |
| `last_lead_message_at` | string (date-time) | No | read-only |
| `last_org_message_at` | string (date-time) | No | read-only |
| `objection` | object | No | read-only |
| `objection.present` | boolean | No | read-only |
| `objection.type` | string | No | read-only |
| `outcome` | object | No | read-only |
| `outcome.computed_at` | string (date-time) | No | read-only |
| `outcome.confidence` | number | No | read-only |
| `outcome.value` | string | No | read-only |
| `sentiment` | object | No | read-only |
| `sentiment.computed_at` | string (date-time) | No | read-only |
| `sentiment.confidence` | number | No | read-only |
| `sentiment.value` | string | No | read-only |
| `window` | object | No | read-only |
| `window.expires_at` | string (date-time) | No | read-only |
| `window.status` | string | No | read-only |

### Responses

- `200` Success
- `400` The request is invalid.
- `401` Authentication is missing, invalid, or revoked.
- `403` The authenticated identity lacks the required scope or capability.
- `404` The resource is unavailable or not visible to this organization.
- `429` The request-rate budget is exhausted.

```bash
curl -X GET "https://api.themochi.app/v1/leads/<lead_id>/intelligence/" \
  -H "Authorization: Bearer $MOCHI_API_KEY"
```

## Get lead signals

`GET /v1/leads/{lead_id}/signals/`

Required scope: `signals:read`

### Parameters

| Name | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `lead_id` | path | integer | Yes |  |
| `signal_type` | query | string | No | one of `BOOKING_LINK`, `PAYMENT_LINK`, `QUALIFIER_LINK`, `NURTURE_LINK`, `CALL_CONFIRMED`, `PRICE_DISCUSSED`, `OBJECTION_RAISED`, `OBJECTION_OVERCOME`, `HIGH_ENGAGEMENT`, `WENT_COLD`, `GHOSTED`, `SCHEDULING_PROPOSED`, `SCHEDULING_CONFIRMED`, `CONTACT_EXCHANGED` |
| `lead_id` | query | integer | No | min 1 |
| `detected_since` | query | string (date-time) | No |  |
| `updated_since` | query | string (date-time) | No |  |
| `min_confidence` | query | number | No | min 0; max 1 |
| `cursor` | query | string | No |  |
| `page_size` | query | integer | No | min 1; max 100 |

### Response (200)

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `data` | object[] | Yes |  |
| `data[].confidence` | number | No | read-only |
| `data[].detected_at` | string (date-time) | No | read-only |
| `data[].id` | string | No | read-only |
| `data[].lead_id` | string | No | read-only |
| `data[].signal_type` | string | No | read-only |
| `next_cursor` | string \| null | Yes |  |

### Responses

- `200` Success
- `400` The request is invalid.
- `401` Authentication is missing, invalid, or revoked.
- `403` The authenticated identity lacks the required scope or capability.
- `404` The resource is unavailable or not visible to this organization.
- `429` The request-rate budget is exhausted.

```bash
curl -X GET "https://api.themochi.app/v1/leads/<lead_id>/signals/" \
  -H "Authorization: Bearer $MOCHI_API_KEY"
```

## Add tags to a lead

`POST /v1/leads/{lead_id}/tags/`

Required scope: `leads:write`

### Parameters

| Name | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `lead_id` | path | integer | Yes |  |
| `Idempotency-Key` | header | string (uuid) | Yes | UUID4 identifying one intended write. Reuse it only when retrying that same write. |

### Request body

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `tag_id` | integer | Yes |  |

### Response (201)

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `ad_title` | string | No | read-only |
| `archived` | boolean | No | read-only |
| `channels` | string[] | No | read-only |
| `closer` | object | No | read-only |
| `closer.member_id` | string | No | read-only |
| `closer.name` | string | No | read-only |
| `conversation_id` | string \| null | No | read-only |
| `conversations` | object[] | No | read-only |
| `conversations[].channel` | string | No | read-only |
| `conversations[].id` | string | No | read-only |
| `created_at` | string (date-time) | No | read-only |
| `display_name` | string | No | read-only |
| `has_email` | boolean | No | read-only |
| `has_phone` | boolean | No | read-only |
| `id` | string | No | read-only |
| `inbox_url` | string \| null | No | read-only |
| `instagram_name` | string \| null | No | read-only |
| `instagram_username` | string \| null | No | read-only |
| `is_ad_lead` | boolean | No | read-only |
| `is_excluded` | boolean | No | read-only |
| `is_reachable` | boolean | No | read-only |
| `is_spam` | boolean | No | read-only |
| `location` | object \| null | No | read-only |
| `location.city` | string \| null | No | read-only |
| `location.country` | string | No | read-only |
| `setter` | object | No | read-only |
| `setter.member_id` | string | No | read-only |
| `setter.name` | string | No | read-only |
| `source` | string | No | read-only |
| `source_media_type` | string | No | read-only |
| `stage` | string \| null | No | read-only |
| `stage_key` | string | No | read-only |
| `stage_name` | string | No | read-only |
| `tags` | object[] | No | read-only |
| `tags[].applied_by` | string | No | read-only |
| `tags[].id` | string | No | read-only |
| `tags[].name` | string | No | read-only |
| `unlocked_at` | string (date-time) | No | read-only |
| `unqualification_reason` | string | No | read-only |
| `updated_at` | string (date-time) | No | read-only |

### Responses

- `201` Success
- `400` The request is invalid.
- `401` Authentication is missing, invalid, or revoked.
- `403` The authenticated identity lacks the required scope or capability.
- `404` The resource is unavailable or not visible to this organization.
- `409` The write conflicts with current state or an identical request is still running.
- `422` The write contains fields outside its closed input schema.
- `429` The request-rate budget is exhausted.

```bash
curl -X POST "https://api.themochi.app/v1/leads/<lead_id>/tags/" \
  -H "Authorization: Bearer $MOCHI_API_KEY" \
  -H "Idempotency-Key: $(uuidgen | tr A-Z a-z)" \
  -H "Content-Type: application/json" \
  -d '{"tag_id":1}'
```

## Remove a tag from a lead

`DELETE /v1/leads/{lead_id}/tags/{tag_id}/`

Required scope: `leads:write`

### Parameters

| Name | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `lead_id` | path | integer | Yes |  |
| `tag_id` | path | integer | Yes |  |
| `Idempotency-Key` | header | string (uuid) | Yes | UUID4 identifying one intended write. Reuse it only when retrying that same write. |

### Request body

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `suppress` | boolean | No |  |

### Response (200)

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `ad_title` | string | No | read-only |
| `archived` | boolean | No | read-only |
| `channels` | string[] | No | read-only |
| `closer` | object | No | read-only |
| `closer.member_id` | string | No | read-only |
| `closer.name` | string | No | read-only |
| `conversation_id` | string \| null | No | read-only |
| `conversations` | object[] | No | read-only |
| `conversations[].channel` | string | No | read-only |
| `conversations[].id` | string | No | read-only |
| `created_at` | string (date-time) | No | read-only |
| `display_name` | string | No | read-only |
| `has_email` | boolean | No | read-only |
| `has_phone` | boolean | No | read-only |
| `id` | string | No | read-only |
| `inbox_url` | string \| null | No | read-only |
| `instagram_name` | string \| null | No | read-only |
| `instagram_username` | string \| null | No | read-only |
| `is_ad_lead` | boolean | No | read-only |
| `is_excluded` | boolean | No | read-only |
| `is_reachable` | boolean | No | read-only |
| `is_spam` | boolean | No | read-only |
| `location` | object \| null | No | read-only |
| `location.city` | string \| null | No | read-only |
| `location.country` | string | No | read-only |
| `setter` | object | No | read-only |
| `setter.member_id` | string | No | read-only |
| `setter.name` | string | No | read-only |
| `source` | string | No | read-only |
| `source_media_type` | string | No | read-only |
| `stage` | string \| null | No | read-only |
| `stage_key` | string | No | read-only |
| `stage_name` | string | No | read-only |
| `tags` | object[] | No | read-only |
| `tags[].applied_by` | string | No | read-only |
| `tags[].id` | string | No | read-only |
| `tags[].name` | string | No | read-only |
| `unlocked_at` | string (date-time) | No | read-only |
| `unqualification_reason` | string | No | read-only |
| `updated_at` | string (date-time) | No | read-only |

### Responses

- `200` Success
- `400` The request is invalid.
- `401` Authentication is missing, invalid, or revoked.
- `403` The authenticated identity lacks the required scope or capability.
- `404` The resource is unavailable or not visible to this organization.
- `409` The write conflicts with current state or an identical request is still running.
- `422` The write contains fields outside its closed input schema.
- `429` The request-rate budget is exhausted.

```bash
curl -X DELETE "https://api.themochi.app/v1/leads/<lead_id>/tags/<tag_id>/" \
  -H "Authorization: Bearer $MOCHI_API_KEY" \
  -H "Idempotency-Key: $(uuidgen | tr A-Z a-z)" \
  -H "Content-Type: application/json" \
  -d '{"suppress":true}'
```

