## Create connect link

`POST https://whatsapp.paaltech.org/api/v1/businesses/{external_id}/whatsapp/connect`

A one-time link to PaalChat's hosted "Connect WhatsApp" page (Meta Embedded Signup) for
this business. Redirect the business's administrator to `url`. Valid for 72 hours and
until used successfully; a new link cancels older unused ones. Success triggers a
`whatsapp.connection` callback with `event: connected`. Treat the link as a secret.

Ability: `connections.manage`

### Path parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `external_id` | string | yes | Your own ID for the business (Multi-SKUUL - the tenant ID). Max 191 characters. Pattern `^[A-Za-z0-9._:-]+$` |

### Body

| Name | Type | Required | Description |
|---|---|---|---|
| `return_url` | string | no | https URL offered to the user after success; `whatsapp=connected` is added to its query. Its origin must be registered for your product by PaalTech (for example `https://*.skuuls.paaltech.org`); any other URL is refused with `return_url_not_allowed`. Max 2048 characters |

### Request

```bash
curl --request POST \
  --url 'https://whatsapp.paaltech.org/api/v1/businesses/presec/whatsapp/connect' \
  --header "Authorization: Bearer $PAALCHAT_TOKEN" \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{"return_url": "https://presec.skuuls.paaltech.org/settings/whatsapp"}'
```

### Responses

- **201** - Link created.

```json
{
  "data": {
    "url": "https://whatsapp.paaltech.org/connect/EsCRzWiltOSLzMBAvEyNHt4bdoWsdAYXwkPKiL2KT83aQk98NFn5coKqweclo4Ih",
    "expires_at": "2026-10-03T18:54:28+00:00"
  }
}
```

- **401** - unauthenticated - missing, invalid, revoked or expired token

```json
{
  "error": {"code": "unauthenticated", "message": "A valid product token is required."}
}
```

- **403** - missing_ability, product_suspended or product_token_required

```json
{
  "error": {
    "code": "missing_ability",
    "message": "This token does not have the ability this request needs."
  }
}
```

- **404** - not_found - not yours, or does not exist

```json
{"error": {"code": "not_found", "message": "Business not found."}}
```

- **409** - business_suspended - the business is suspended on PaalChat.

```json
{
  "error": {
    "code": "business_suspended",
    "message": "This business is suspended on the platform."
  }
}
```

- **422** - validation_failed (fields invalid), or return_url_not_allowed (the return_url's origin is not registered for your product).

```json
{
  "error": {
    "code": "return_url_not_allowed",
    "message": "This return_url is not on your product's registered return origins. Ask PaalTech to register its origin."
  }
}
```

- **429** - rate_limited - over 300 requests/minute for this product

```json
{
  "error": {
    "code": "rate_limited",
    "message": "Too many requests. Slow down and retry after the Retry-After header."
  }
}
```

