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

# Campaigns API

> Send or validate a webhook campaign message with an API key limited to that campaign.

A webhook campaign sends one WhatsApp template to one end user per API call. Each accepted send is charged against the campaign wallet.

A campaign created with **Chosen per request** holds several templates, called usecases. The call names the usecase to send. See [Send a call to a usecase](#send-a-call-to-a-usecase).

## Keys and access

A campaign key is an ordinary API key with **Send campaign messages** and access limited to the campaign. An **All resources** key also works.

Admins create and manage keys in **Settings → Integrations → API keys**. The campaign's **API keys** tab lists eligible keys.

On a one-template campaign, selected keys that include the campaign lock its template, parameters and number. Revoke those keys or clone the campaign before changing them. A campaign with usecases has no such lock. See [Change a usecase while callers send](https://hellotars.com/docs/guides/campaigns/webhook-campaigns.md#change-a-usecase-while-callers-send) for its rules.

## Send a call to a usecase

The body of a usecase call has three fields.

| Field | Meaning |
| - | - |
| usecase | The name of the usecase to send. |
| to | The recipient number in E.164 format, or encrypted with your incoming numbers key. |
| data | Optional object with your own field names. It fills the template and reaches the reply conversation. |

```json theme={null}
{
  "usecase": "payment_due",
  "to": "+919812345678",
  "data": { "amount": "1,200", "due_date": "15 Mar", "invoice_id": "INV-9" }
}
```

A usecase campaign refuses `params` and `media`. The usecase fills the template from `data`, and a usecase can take its header image from a `data` key. A campaign with one template refuses `usecase`.

A key that the usecase reads must hold text, a number, or true or false. A key that has no fallback must be present in `data`. Other keys are accepted and reach the reply conversation. The same limits as other webhook calls apply to `data`: up to 50 keys, 8 KB, and 5 levels.

The response is the usual send result with the `usecase` that was sent. The Contract tab of the campaign shows one request shape for each usecase. Field errors and the codes `usecase_paused`, `template_paused`, and `usecase_gone` are in [API errors](https://hellotars.com/docs/developer/errors.md#campaign-send-field-errors).

## Validate and send

[Validate](https://hellotars.com/docs/developer/api/campaigns/validate.md) checks the request and returns pricing without sending or charging. It does not check consent or wallet balance.

Validate and [send](https://hellotars.com/docs/developer/api/campaigns/send.md) share the campaign-send rate limit. Both can return a retryable problem.

## Pricing and lifecycle

A send is charged before delivery. A send that fails before WhatsApp accepts it is refunded. If WhatsApp accepts a send and reports a failure later, the charge stays. Staging-mode sends are not charged.

A paused campaign returns retryable campaign\_paused. A cancelled or failed campaign returns terminal campaign\_gone. For a usecase, a turned off usecase returns retryable usecase\_paused and a retired usecase returns terminal usecase\_gone.

See [Errors](https://hellotars.com/docs/developer/errors.md) for the problem format and [Run webhook campaigns](https://hellotars.com/docs/guides/campaigns/webhook-campaigns.md) for setup.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.