> ## Documentation Index
> Fetch the complete documentation index at: https://docs.leadterra.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Reply Intelligence: Automatic Classification of Replies

> Leadterra automatically classifies inbound replies by intent, letting agents and workflows act on interested, bounced, or opt-out signals in real time.

When a lead responds to one of your campaign emails, Leadterra captures the full reply thread and runs it through an automatic intent classifier. Rather than dumping raw email text into your workflow, the platform hands you a structured classification — interested, not interested, out of office, and more — so your agents and downstream systems can take the right action immediately without building their own NLP layer.

## Reply classification

Every inbound reply is analyzed and assigned one of the following classifications:

| Classification   | Meaning                                                     |
| ---------------- | ----------------------------------------------------------- |
| `interested`     | The lead expressed positive intent or asked to learn more.  |
| `not_interested` | The lead declined or asked to stop outreach.                |
| `out_of_office`  | An automated away message with no actionable intent signal. |
| `bounce`         | A delivery failure notification returned to the sender.     |
| `unsubscribe`    | The lead explicitly requested removal from your list.       |

Classifications let your automation branch immediately — for example, routing `interested` replies to a human SDR queue, suppressing `unsubscribe` leads from future campaigns, and ignoring `out_of_office` replies without clogging your pipeline.

## Pulling replies

Use `GET /v1/replies` to list classified replies across all campaigns, or filter to a specific campaign with the optional `campaignId` query parameter:

```bash theme={null}
curl "https://app.leadterra.co/v1/replies?campaignId=camp_01hx4mrqpbcn7wh2gfk9yz6e3s" \
  -H "Authorization: Bearer sk_live_YOUR_KEY"
```

**Sample response**

```json theme={null}
{
  "data": [
    {
      "id": "rpl_01hx5ntrqbdp8xj3ghm2az7c4k",
      "email": "priya.sharma@voltmetrics.io",
      "campaignId": "camp_01hx4mrqpbcn7wh2gfk9yz6e3s",
      "classification": "interested",
      "receivedAt": "2025-01-15T11:04:32Z",
      "threadSnippet": "Hi James, yes this looks relevant — can we find 20 minutes this Thursday?"
    },
    {
      "id": "rpl_01hx5ntrqdep9yk4him3ba8d5l",
      "email": "dan.foster@loopcraft.com",
      "campaignId": "camp_01hx4mrqpbcn7wh2gfk9yz6e3s",
      "classification": "not_interested",
      "receivedAt": "2025-01-15T13:47:09Z",
      "threadSnippet": "Thanks but we're all set for now. Please remove me from your list."
    }
  ],
  "meta": {
    "total": 2,
    "page": 1,
    "pageSize": 50
  }
}
```

The `threadSnippet` field gives you enough context to act on the reply without fetching the full thread. Use the `email` field to look up the lead record and `classification` to route the reply to the right handler in your workflow.

## Using replies in agent workflows

Replies are the signal that closes the outbound loop. Pull `GET /v1/replies` on a schedule or trigger downstream logic from the `reply.received` webhook (see below), then branch your agent's behavior on `classification`:

* Pass `interested` replies to a Deepline agent or Claude Code workflow that drafts a personalized follow-up or books a meeting.
* Feed `not_interested` and `unsubscribe` classifications into a suppression list so those leads are excluded from future campaigns.
* Ignore `out_of_office` replies or log them and retry the lead after a configurable delay.

Because the reply object includes `email`, `campaignId`, and `threadSnippet`, your agent has all the context it needs to take action without additional API calls in the common case.

## Webhook alternative

Instead of polling `GET /v1/replies`, you can subscribe to the `reply.received` webhook event. Leadterra will POST the reply payload to your endpoint the moment a new reply is classified, giving you a real-time push model with no polling overhead.

The webhook payload mirrors the reply object returned by `GET /v1/replies`, so your handler code can be the same regardless of whether you use polling or push.

<Tip>
  Use the `reply.received` webhook rather than polling `GET /v1/replies` whenever your workflow needs to act within seconds of a reply arriving. Polling introduces latency proportional to your polling interval and adds unnecessary API calls during quiet periods. Reserve polling for batch reconciliation or backfill scenarios.
</Tip>
