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

# Manage links

> List, update, revoke, and expire setup links, and reconnect a broken number

## List all links

```bash theme={null}
curl https://api.kapso.ai/platform/v1/customers/{customer_id}/setup_links \
  -H "X-API-Key: YOUR_API_KEY"
```

## Update a link

`PATCH` an existing link to change its redirects, theme, language, connection types, provisioning settings, or expiry:

```bash theme={null}
curl -X PATCH https://api.kapso.ai/platform/v1/customers/{customer_id}/setup_links/{setup_link_id} \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"setup_link": {"language": "es", "expires_at": "2026-12-31T23:59:59Z"}}'
```

`meta_billing_mode` is the one field you cannot change after creation.

## Revoke a link

Set `status` to `revoked` to kill a link before it expires:

```bash theme={null}
curl -X PATCH https://api.kapso.ai/platform/v1/customers/{customer_id}/setup_links/{setup_link_id} \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"setup_link": {"status": "revoked"}}'
```

You cannot set `status` to `used`. Creating a new link also revokes the previous one, since only one link can be active per customer.

## Expiration

Links expire 30 days after creation. Check `expires_at`, or set it with `PATCH` to expire a link sooner or later.

## Reconnect existing numbers

When a customer's WhatsApp connection breaks (token revoked, Meta de-auth, password change), generate a setup link scoped to a specific phone number they already have on Kapso:

```json theme={null}
{
  "setup_link": {
    "reconnect_phone_number": "+14155551234"
  }
}
```

Kapso looks up the customer's existing WhatsApp config matching that number, then forces the setup flow to refresh credentials for the same WABA + phone number. Behavior:

* The number must already exist on a production WhatsApp config for this customer.
* `provision_phone_number` is forced to `false`. Passing `true` returns `422`.
* `allowed_connection_types` is locked to `["dedicated"]` or `["coexistence"]` to match the existing config. Passing a different value returns `422`.
* During Meta's embedded signup, the phone number selector is constrained to the matching number — if the customer connects a different account or number, setup fails.

If no config matches, the API returns `422` with `reconnect_phone_number must match an existing WhatsApp config for this customer`. If multiple configs match the same display number, the API returns `422` and you'll need to resolve the duplicates first.
