# Quickstart

> Send one appointment reminder from a business’s own WhatsApp number.

Base URL: `https://wa.vitral.dev`.

Successful responses are wrapped in `{ "data": ... }`. Errors are `{ "statusCode", "code", "message" }` and are not inside `data`. List routes also return `meta`. See [Errors](/whatsapp/api/errors.md).

## 1. Get your key

Sign up in the Whitelabel WhatsApp Cloud API dashboard. Open **Dashboard → WhatsApp → API keys** and create a key. The partner preset is already checked, including `conversations:read` (the 24-hour window), send, templates, webhooks, customers, and setup links. The raw key is shown once.

```http
GET /api/v1/phone-numbers
Authorization: Bearer $VITRAL_WHATSAPP_API_KEY
```

Scope `phone_numbers:read`. `401` means the key is missing, unknown, revoked, or expired. `403` with `Missing required scope` means this key cannot read numbers. `{ "data": [] }` is normal before Embedded Signup.

## 2. Create the business

```http
POST /api/v1/customers
Authorization: Bearer $VITRAL_WHATSAPP_API_KEY
Content-Type: application/json

{
  "name": "North Clinic",
  "externalCustomerId": "clinic_1842"
}
```

Scope `customers:write`. Response `201` is the stored customer. A second row with the same `externalCustomerId` returns `409` `CONFLICT`. Omitting `externalCustomerId` does not conflict with other rows that also omit it.

## 3. Create a setup link

```http
POST /api/v1/customers/CUSTOMER_ID/setup-links
Authorization: Bearer $VITRAL_WHATSAPP_API_KEY
Content-Type: application/json

{ "language": "es", "expiresInDays": 7 }
```

Scope `setup-links:manage`. Response `201`:

```json
{
  "data": {
    "id": "ck_link",
    "token": "<shown once>",
    "url": "https://wa.vitral.dev/setup/<token>"
  }
}
```

Send `url` to the business owner. They finish Meta’s Embedded Signup, including the payment method on **their** WABA. `language` `es`, `pt`, or `en` selects the hosted page and the Facebook SDK. Omit `language` to follow the browser. Details: [Setup links](/whatsapp/concepts/setup-links.md).

Poll without an API key:

```http
GET /api/v1/setup/public/<token>/status
```

When `data.whatsappSetupStatus` is `COMPLETED`, `data.phoneNumberId` is the Whitelabel WhatsApp Cloud API id you send with. `data.repair.action` `pending` means the owner has not finished. Wait. Do not send another link. `needs_reconnect` means a finished attempt could not attach the phone. Send a new link.

Or list numbers and take the row whose `customerId` matches and whose `status` is `ACTIVE`. `id` is the Whitelabel WhatsApp Cloud API phone id. `waPhoneNumberId` is Meta’s id.

## 4. Create a template

```http
POST /api/v1/templates
Authorization: Bearer $VITRAL_WHATSAPP_API_KEY
Content-Type: application/json

{
  "wabaId": "WABA_ID",
  "name": "appointment_reminder",
  "language": "es",
  "category": "UTILITY",
  "components": [
    {
      "type": "BODY",
      "text": "Hola {{1}}, le recordamos su cita el {{2}} a las {{3}}. Responda SI para confirmar.",
      "example": { "body_text": [["Ana", "2 de octubre", "10:30"]] }
    }
  ]
}
```

Scope `templates:write`. A stored row has `status` `PENDING`. This API does not webhook template approval. Poll `GET /api/v1/templates/:id` or `POST /api/v1/templates/sync` (`202`). See [Templates](/whatsapp/guides/templates.md).

## 5. Send

```http
POST /api/v1/messages
Authorization: Bearer $VITRAL_WHATSAPP_API_KEY
Content-Type: application/json

{
  "phoneNumberId": "PHONE_ID",
  "to": "5215512345678",
  "type": "template",
  "template": {
    "name": "appointment_reminder",
    "language": { "code": "es" },
    "components": [
      {
        "type": "body",
        "parameters": [
          { "type": "text", "text": "Ana" },
          { "type": "text", "text": "2 de octubre" },
          { "type": "text", "text": "10:30" }
        ]
      }
    ]
  }
}
```

Scope `messages:send`. `201` means the row was queued. `data.status` is `PENDING`. `data.type` is `TEMPLATE`. There is no idempotency key.

`to` may be digits, or the same number with a leading `+`. A value that is not a phone is treated as a business-scoped user id.

Free text before the recipient has written to this number returns `400` `VALIDATION_ERROR` with message `Customer service window is closed. Send an approved template message to re-open the conversation.` That response omits `details`. See [Send messages](/whatsapp/guides/send-messages.md).

## 6. Delivery

```http
GET /api/v1/messages/MESSAGE_ID
Authorization: Bearer $VITRAL_WHATSAPP_API_KEY
```

Scope `messages:read`. Or receive `message.status` on the tenant webhook. See [Webhooks](/whatsapp/webhooks/overview.md) and [Errors](/whatsapp/api/errors.md).

## There is no sandbox

No request flag skips Meta. Connect a Meta test number through the same setup link.
