> ## 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.

# SDR Workspace

> AI-driven reply handling with connected SDR Gmail accounts for personalized follow-up.

When a campaign reply is classified as positive (interested, meeting booked, etc.), Leadterra can hand it off to a Sales Development Rep (SDR). The SDR's personal Gmail is connected via Composio, enabling AI-generated draft replies, one-click sending, and automatic follow-up scheduling — all orchestrated through the public API.

## How it works

1. **Reply classification** — Inbound replies are classified by AI (interested, not\_interested, meeting\_booked, etc.)
2. **Assignment** — A positive reply is assigned to an SDR via `POST /v1/replies/:replyId/assign`, creating a prospect thread in the SDR's inbox
3. **Draft generation** — The SDR (or an agent) calls `POST /v1/sdr/drafts/generate` to produce an AI-suggested reply
4. **Review and send** — The draft can be edited via `PATCH /v1/sdr/drafts/:draftId`, then sent through the SDR's connected Gmail with `POST /v1/sdr/drafts/:draftId/send`
5. **Follow-up automation** — Follow-up tasks are scheduled automatically based on admin-configured rules, and can be managed via API

## Authentication

SDR endpoints require an API key with `role: "sdr"` and a linked `sdrId`. Create one in the dashboard under **Settings → API Keys**, specifying the SDR profile to link.

```
Authorization: Bearer sk_live_your_key
```

## Gmail connection

SDRs send replies through their own connected Gmail account via Composio. Check connection status with `GET /v1/sdr/gmail/status`. Gmail OAuth setup is currently browser-only — the SDR must connect their Gmail through the dashboard.

## Thread lifecycle

| Status                | Meaning                                        |
| --------------------- | ---------------------------------------------- |
| `new`                 | New thread, no reply sent yet                  |
| `awaiting_reply`      | SDR has replied, waiting for prospect response |
| `needs_followup`      | Prospect hasn't responded, follow-up due       |
| `replied`             | Prospect replied after SDR engagement          |
| `meeting_booked`      | Meeting confirmed                              |
| `won`                 | Deal closed                                    |
| `lost_not_interested` | Prospect declined                              |
| `lost_timing`         | Bad timing                                     |
| `lost_competitor`     | Went with competitor                           |
| `archived`            | Archived                                       |

<Note>
  Thread status transitions are validated against a state machine. Invalid transitions return a 400 error with the allowed transitions.
</Note>
