# Enroll a lead in this cadence

**`POST https://myagentmail.com/cadences/{id}/enrollments`**

Group: Cadences
Operation ID: `enrollLeadInCadence`

Idempotent on (cadenceId, leadExternalId) — re-enrolling the
same lead returns the existing enrollment with `created: false`.

Lead identity fields: pass whatever you have. The runner uses
`leadLinkedinUrl` for LinkedIn invites and `leadEmail` for
email steps. `leadProfileUrn` is set automatically when the
first LinkedIn invite is sent (the runner persists it for
future after_accept attribution and reply-detection).


## Path parameters

- `id` (string, required) —

## Request body

Content-Type: `application/json`

```json
{
  "leadExternalId": "string",
  "leadName": "string",
  "leadEmail": "agent@example.com",
  "leadLinkedinUrl": "https://example.com",
  "leadProfileUrn": "string",
  "sessionId": "string",
  "inboxId": "00000000-0000-0000-0000-000000000000",
  "context": {},
  "startAt": "2026-05-01T09:03:22.718Z"
}
```

## Responses

### 200 — Enrollment ready. `created` distinguishes new from existing.

## Code samples

### TypeScript

```typescript
import { MyAgentMail } from "myagentmail";

const client = new MyAgentMail({ apiKey: process.env.MYAGENTMAIL_API_KEY! });

// POST /cadences/{id}/enrollments
const result = await client.request("post", "/cadences/{id}/enrollments", { params: { id: "00000000-0000-0000-0000-000000000000" } }, { body: {
  "leadExternalId": "string",
  "leadName": "string",
  "leadEmail": "agent@example.com",
  "leadLinkedinUrl": "https://example.com",
  "leadProfileUrn": "string",
  "sessionId": "string",
  "inboxId": "00000000-0000-0000-0000-000000000000",
  "context": {},
  "startAt": "2026-05-01T09:03:22.718Z"
} });
```

### curl

```bash
curl -X POST 'https://myagentmail.com/cadences/00000000-0000-0000-0000-000000000000/enrollments' \
  -H 'X-API-Key: $MYAGENTMAIL_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "leadExternalId": "string",
  "leadName": "string",
  "leadEmail": "agent@example.com",
  "leadLinkedinUrl": "https://example.com",
  "leadProfileUrn": "string",
  "sessionId": "string",
  "inboxId": "00000000-0000-0000-0000-000000000000",
  "context": {},
  "startAt": "2026-05-01T09:03:22.718Z"
}'
```

### Python

```python
import os, requests

r = requests.post(
    "https://myagentmail.com/cadences/00000000-0000-0000-0000-000000000000/enrollments",
    headers={"X-API-Key": os.environ["MYAGENTMAIL_API_KEY"]},
    json={
        "leadExternalId": "string",
        "leadName": "string",
        "leadEmail": "agent@example.com",
        "leadLinkedinUrl": "https://example.com",
        "leadProfileUrn": "string",
        "sessionId": "string",
        "inboxId": "00000000-0000-0000-0000-000000000000",
        "context": {},
        "startAt": "2026-05-01T09:03:22.718Z"
    },
)
r.raise_for_status()
print(r.json())
```
