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

# Push leads from your CRM

> POST /leads (or /events) onto a UI-created API campaign.

Before you POST: [Lead setup](/api-reference/endpoint/outbound/lead-setup) with your `campaignId` — copy `call.lead` / `email.lead` / `whatsapp.lead`. Optional [Validate lead](/api-reference/endpoint/outbound/validate-lead) (nothing is created).

## Direct lead push

```bash theme={"system"}
curl -sS -X POST "$ONDIAL_BASE_URL/api/v1/leads" \
  -H "Authorization: Bearer $ONDIAL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: crm-$(date +%s)" \
  -d '{
    "campaignId": "YOUR_CAMPAIGN_ID",
    "phone": "+919876543210",
    "name": "Asha",
    "channel": "call",
    "consent": {
      "outboundCall": true,
      "capturedAt": "2026-08-11T10:00:00Z",
      "source": "crm"
    },
    "metadata": { "leadId": "CRM-99" }
  }'
```

## ERP-style events

1. Map `eventType` → campaign via Settings or `POST /api/v1/event-routes`
2. `POST /api/v1/events` with `eventType` + `phone` (+ consent)

Full walkthrough (list templates → fill params → send): [Send WhatsApp and email](/get-started/guides/send-whatsapp-and-email).

## Direct WhatsApp + email (no dial)

Templates are resolved automatically: request ids → campaign Follow-up pick → Omni default verified profile + attached template. You do **not** need to turn campaign Follow-up on if Omni already has the profile and template.

```bash theme={"system"}
curl -sS -X POST "$ONDIAL_BASE_URL/api/v1/leads" \
  -H "Authorization: Bearer $ONDIAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "campaignId": "YOUR_CAMPAIGN_ID",
    "phone": "+919876543210",
    "email": "asha@example.com",
    "name": "Asha",
    "channels": ["whatsapp", "email"],
    "whatsappScheduledAt": "2026-08-13T06:00:00Z",
    "emailScheduledAt": "2026-08-13T06:30:00Z"
  }'
```

| Clock                 | Template sent                                                     |
| --------------------- | ----------------------------------------------------------------- |
| `whatsappScheduledAt` | Resolved WhatsApp template (`whatsappTemplateId` in the response) |
| `emailScheduledAt`    | Resolved email template (`emailTemplateId` in the response)       |

Optional overrides: `whatsappTemplateId`, `whatsappProfileId`, `emailTemplateId`, `emailProfileId` from `GET /api/v1/omni/templates`.

Pass merge fields with the lead:

```json theme={"system"}
{
  "templateVariables": { "contact_name": "Asha", "city": "Ahmedabad" },
  "whatsappParams": ["Asha", "CRM-99"]
}
```

Omit the clocks to send as soon as Calling\_system1 picks up the queue. Poll `GET /api/v1/contacts/{id}` for `whatsappQueueStatus` / `emailStatus` and the pending template ids.

## Register then follow-up

1. `POST /leads` with `"channel": "none"`
2. `POST /api/v1/contacts/{id}/followups`

## Status + conversation back to CRM

1. Save `contactId` from `POST /leads`
2. Poll `GET /api/v1/contacts/{id}` (see `lastCall`) **or** listen for `call.status` webhooks
3. `GET /api/v1/contacts/{id}/calls` — dial list (`hasAnalysis`, optional `summary`)
4. `GET /api/v1/contacts/{id}/calls/{callId}` — transcript/turns + normalized analysis (no internal blobs)

Analysis can lag call completion — poll until `hasAnalysis: true`.

Optional: register HTTPS webhooks in **API Access → Notifications** (`X-Ondial-Signature`).
