# Leads

List leads and tag several at once.

List leads and tag several at once.

## List leads

`GET /v1/leads/`

Required scope: `leads:read`

### Parameters

| Name | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `stage_key` | query | string | No |  |
| `stage` | query | string | No | one of `NEW`, `IN_CONTACT`, `QUALIFIED`, `UNQUALIFIED`, `BOOKED_CALL`, `DEPOSIT`, `WON`, `LOST`, `NO_SHOW` |
| `tag` | query | integer | No | min 1 |
| `source` | query | string | No | one of `DM`, `COMMENT`, `STORY`, `OUTBOUND` |
| `setter_id` | query | integer | No | min 1 |
| `closer_id` | query | integer | No | min 1 |
| `is_ad_lead` | query | boolean | No |  |
| `archived` | query | boolean | No |  |
| `updated_since` | query | string (date-time) | No |  |
| `location` | query | string[] | No | max 50 items |
| `cursor` | query | string | No |  |
| `page_size` | query | integer | No | min 1; max 100 |

### Response (200)

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `data` | object[] | Yes |  |
| `data[].ad_title` | string | No | read-only |
| `data[].archived` | boolean | No | read-only |
| `data[].channels` | string[] | No | read-only |
| `data[].closer` | object | No | read-only |
| `data[].closer.member_id` | string | No | read-only |
| `data[].closer.name` | string | No | read-only |
| `data[].conversation_id` | string \| null | No | read-only |
| `data[].conversations` | object[] | No | read-only |
| `data[].conversations[].channel` | string | No | read-only |
| `data[].conversations[].id` | string | No | read-only |
| `data[].created_at` | string (date-time) | No | read-only |
| `data[].display_name` | string | No | read-only |
| `data[].has_email` | boolean | No | read-only |
| `data[].has_phone` | boolean | No | read-only |
| `data[].id` | string | No | read-only |
| `data[].inbox_url` | string \| null | No | read-only |
| `data[].instagram_name` | string \| null | No | read-only |
| `data[].instagram_username` | string \| null | No | read-only |
| `data[].is_ad_lead` | boolean | No | read-only |
| `data[].is_excluded` | boolean | No | read-only |
| `data[].is_reachable` | boolean | No | read-only |
| `data[].is_spam` | boolean | No | read-only |
| `data[].location` | object \| null | No | read-only |
| `data[].location.city` | string \| null | No | read-only |
| `data[].location.country` | string | No | read-only |
| `data[].setter` | object | No | read-only |
| `data[].setter.member_id` | string | No | read-only |
| `data[].setter.name` | string | No | read-only |
| `data[].source` | string | No | read-only |
| `data[].source_media_type` | string | No | read-only |
| `data[].stage` | string \| null | No | read-only |
| `data[].stage_key` | string | No | read-only |
| `data[].stage_name` | string | No | read-only |
| `data[].tags` | object[] | No | read-only |
| `data[].tags[].applied_by` | string | No | read-only |
| `data[].tags[].id` | string | No | read-only |
| `data[].tags[].name` | string | No | read-only |
| `data[].unlocked_at` | string (date-time) | No | read-only |
| `data[].unqualification_reason` | string | No | read-only |
| `data[].updated_at` | string (date-time) | 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/" \
  -H "Authorization: Bearer $MOCHI_API_KEY"
```

## Tag leads in bulk

`POST /v1/leads/bulk/tags/`

Required scope: `leads:write`

### Parameters

| Name | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `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 |
| --- | --- | --- | --- |
| `lead_ids` | integer[] | Yes | max 100 items |
| `tag_ids` | integer[] | Yes | max 20 items |

### 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 POST "https://api.themochi.app/v1/leads/bulk/tags/" \
  -H "Authorization: Bearer $MOCHI_API_KEY" \
  -H "Idempotency-Key: $(uuidgen | tr A-Z a-z)" \
  -H "Content-Type: application/json" \
  -d '{"lead_ids":[1],"tag_ids":[1]}'
```

