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

# Generate and Send SDR Draft Replies

> Generate AI drafts, edit, and send replies through an SDR's connected Gmail.

The draft pipeline uses a multi-model approach: a planner model assembles context, a draft model writes the reply, and a judge model scores quality. Drafts include guardrails to prevent sending low-quality or off-brand responses.

## Generate a draft

```bash theme={null}
curl -X POST https://app.leadterra.co/v1/sdr/drafts/generate \
  -H "Authorization: Bearer sk_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{"threadId": "THREAD_ID", "variantCount": 1}'
```

Optionally pass `instructions` to guide the tone or content.

```json theme={null}
{
  "data": {
    "drafts": [
      {
        "id": "draft_id",
        "bodyText": "Hi Ava, thanks for the reply...",
        "bodyHtml": "<p>Hi Ava, thanks for the reply...</p>",
        "subject": "Re: Quick question"
      }
    ],
    "insights": [],
    "appliedRules": []
  }
}
```

## Edit a draft

```bash theme={null}
curl -X PATCH https://app.leadterra.co/v1/sdr/drafts/DRAFT_ID \
  -H "Authorization: Bearer sk_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{"bodyText": "Hi Ava, thanks for getting back to me..."}'
```

## Send the draft

```bash theme={null}
curl -X POST https://app.leadterra.co/v1/sdr/drafts/DRAFT_ID/send \
  -H "Authorization: Bearer sk_live_your_key"
```

The email is sent through the SDR's connected Gmail via Composio. If guardrails block the send, the response is `422` with a guardrails object explaining the issues.

## Send a manual reply (no AI draft)

Skip draft generation and send a manual reply directly:

```bash theme={null}
curl -X POST https://app.leadterra.co/v1/sdr/threads/THREAD_ID/send-manual \
  -H "Authorization: Bearer sk_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{"bodyText": "Thanks for the note, I will follow up tomorrow."}'
```

## Regenerate a draft

If the initial draft isn't right, regenerate with instructions:

```bash theme={null}
curl -X POST https://app.leadterra.co/v1/sdr/drafts/DRAFT_ID/regenerate \
  -H "Authorization: Bearer sk_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{"instructions": "Be more concise and mention the integration"}'
```

## Discard a draft

```bash theme={null}
curl -X DELETE https://app.leadterra.co/v1/sdr/drafts/DRAFT_ID \
  -H "Authorization: Bearer sk_live_your_key"
```
