# Quickstart

> Trigger your first AI call in three steps — an API key, a campaign, one request.

Source: https://docs.cleartalk.ai/docs/developers/quickstart

The fastest useful thing you can do with the ClearTalk API: hand it a lead, and have your AI agent call them seconds later. Three steps.

<Summary
  items={[
  "Create an API key under Integrations → API access.",
  "Find your campaign's trigger URL on its edit page.",
  "Post a lead to it — the agent calls, and the contact is created for you.",
  "Swap the URL to text instead, or send up to 5,000 contacts in one batch.",
]}
/>

## Step 1 — Create an API key

In your dashboard: **Integrations → API access → Generate key**. The key (starting `ct_`) is shown once — store it safely. Details in [Authentication](/docs/developers/authentication).

## Step 2 — Find your campaign's trigger URL

Calls are triggered *into a campaign* — the campaign supplies the agent, the working hours, and the follow-up rules. Open any calling campaign in your dashboard and check its **Trigger Instructions** panel: it shows the campaign's ID, the exact URL, and a copyable example.

<Callout title="Campaigns wait to be triggered">
  Standard calling and texting campaigns don't dial through a list on their own — they act when a lead is posted to their trigger URL. An "active" campaign with no triggers arriving does nothing. (Scheduled batch campaigns are the exception.)
</Callout>

<Sequence
  caption="Your request is step 2. Without it, nothing happens."
  steps={[
  { title: "A lead appears in your system", note: "A form fill, a new CRM record, an event in your own app." },
  { title: "You post it to the campaign", note: "One request carrying the phone number, plus anything else the agent should know." },
  { title: "ClearTalk creates or updates the contact", note: "Your custom fields become variables the agent can use by name." },
  { title: "The agent calls", note: "Within the campaign's working hours, following its follow-up rules." },
  { title: "The result comes back", note: "Through your webhook, into whichever system you pointed it at." },
]}
/>

## Step 3 — Trigger a call

```bash
curl -X POST "https://backboard.cleartalk.ai/api/public/calls/trigger/YOUR_CAMPAIGN_ID" \
  -H "Authorization: Bearer ct_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "phone": "+15551234567",
    "first_name": "Jamie",
    "last_name": "Rivera",
    "email": "jamie@example.com",
    "tags": ["api-test"],
    "custom_fields": { "property_address": "12 Oak Lane" }
  }'
```

A `202` response means the call is accepted:

```json
{
  "ok": true,
  "queued": true,
  "status": "queued",
  "requestId": "...",
  "contactId": "...",
  "campaignId": "...",
  "contactPhone": "+15551234567"
}
```

The contact is created (or updated) automatically, and everything in `custom_fields` becomes variables your agent can use in conversation. Moments later the call appears under **Conversations** in your dashboard, with its recording, transcript, summary, and result.

<Callout title="Posted after hours? The call is held, not lost">
  If the lead arrives outside the campaign's calling hours, the response comes back with `"status": "held"` and a `scheduledFor` timestamp — the call places itself automatically when the window opens, in the recipient's local time. Nothing for you to retry.
</Callout>

## Variations

**Text instead of call** — same body, texting campaign's URL:

```bash
POST https://backboard.cleartalk.ai/api/public/sms/trigger/YOUR_CAMPAIGN_ID
```

The response's `status` tells you what happened: `sent`, `enrolled` (into the campaign's message sequence), `skipped_engaged` (lead is mid-conversation — not interrupted), or `suppressed` (opted out).

**A whole list at once** — up to 5,000 contacts with optional pacing between dials:

```bash
curl -X POST "https://backboard.cleartalk.ai/api/public/campaigns/trigger-batch/YOUR_CAMPAIGN_ID" \
  -H "Authorization: Bearer ct_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "contacts": [
      { "phone": "+15551234567", "first_name": "Jamie" },
      { "phone": "+15559876543", "first_name": "Alex" }
    ],
    "pacing_seconds": 30
  }'
```

Invalid rows are reported in the response's `rejected` array rather than failing the batch.

## Common errors

| Status | Meaning                                                                               |
| ------ | ------------------------------------------------------------------------------------- |
| `400`  | Missing or invalid phone number, or the campaign is the wrong type for this endpoint. |
| `401`  | Bad or missing API key.                                                               |
| `404`  | Campaign not found in your organization.                                              |
| `409`  | The campaign is paused, completed, or archived.                                       |
| `422`  | The campaign has no agent assigned, or the recipient is suppressed.                   |

## Next steps

* [Get call results pushed back to your system](/docs/integrations/webhooks) the moment each call ends.
* [Wire it into HighLevel](/docs/integrations/gohighlevel) without writing code.
* Browse the [full API reference](/api-reference) for every parameter and response schema.
