> For the complete documentation index, see [llms.txt](https://kollect.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kollect.gitbook.io/docs/webhook-overview/registration-and-delivery.md). Agents can also search and read this documentation through its [MCP server](https://kollect.gitbook.io/docs/~gitbook/mcp).

# Registration and delivery

Outbound webhooks are **not** configured through the S2S API. You register a URL and obtain a **signing secret** through **authenticated profile APIs**, separate from API-key authentication used for create-payment.

### Prerequisites <a href="#prerequisites" id="prerequisites"></a>

| Requirement                   | Details                                                                                                                                                                                                                                                                                                                                                                  |
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **KYB or Mesta verification** | Webhook management requires `onboardingStatus` of `KybVerified` **or** `MestaVerified`.                                                                                                                                                                                                                                                                                  |
| **Write permission**          | The authenticated Firebase user's organization role must grant `write` (Owner or Admin) on the merchant account.                                                                                                                                                                                                                                                         |
| **API key created first**     | The product requires an API key to exist before saving webhook settings.                                                                                                                                                                                                                                                                                                 |
| **HTTPS URL**                 | `webhookUrl` must be a valid HTTPS URL and must **not** point to localhost, a private network address, a link-local address (including the `169.254.169.254` cloud metadata endpoint), or contain embedded credentials. Use a public tunnel (e.g. ngrok) for local development — see [Testing & sandbox](https://kollect.gitbook.io/docs/guides/testing-and-sandbox.md). |

### Endpoints <a href="#endpoints" id="endpoints"></a>

All routes below are mounted under `/kollect/profile/webhook` and require a **Firebase-authenticated** request (`Authorization: Bearer <idToken>`), **not** the S2S API-key flow. **Full path** = `<host>/kollect/profile/webhook...`.

| Action                        | Method + path                                     | Body / query                                                           |
| ----------------------------- | ------------------------------------------------- | ---------------------------------------------------------------------- |
| List your webhook(s)          | `GET /kollect/profile/webhook`                    | none — returns all registered scopes for your account                  |
| Register / update a webhook   | `POST /kollect/profile/webhook`                   | `{ "webhookUrl": "https://...", "scope": "invoice_settlement" }`       |
| Toggle status                 | `PATCH /kollect/profile/webhook/status`           | `{ "status": "active" \| "inactive", "scope": "invoice_settlement" }`  |
| Send a test delivery          | `POST /kollect/profile/webhook/test`              | `{ "scenario": "success" \| "failed", "scope": "invoice_settlement" }` |
| Regenerate the signing secret | `POST /kollect/profile/webhook/regenerate-secret` | query param `?scope=invoice_settlement`                                |
| Delete a webhook              | `DELETE /kollect/profile/webhook`                 | query param `?scope=invoice_settlement`                                |

## `scope` is required

Every webhook is registered against a **scope** — the event type it should receive. For S2S invoice payments, use:

```json
{
  "scope": "invoice_settlement"
}
```

`scope` must be `invoice_settlement` or `fiat_settlement` when **creating** a webhook (`POST`); `status`/`regenerate-secret`/`DELETE` also accept the legacy value `"all"` for webhooks registered before per-scope registration existed, but new webhooks cannot be created with `"all"`.

## Registering a URL

**Request body:**

```json
{
  "webhookUrl": "https://api.example.com/v1/kollect/webhook",
  "scope": "invoice_settlement"
}
```

**Response:**

```json
{
  "success": true,
  "data": {
    "scope": "invoice_settlement",
    "webhookUrl": "https://api.example.com/v1/kollect/webhook",
    "signingSecret": "‹64-char hex string›",
    "status": "active"
  },
  "message": "Webhook settings saved successfully."
}
```

{% hint style="warning" %}
Unlike some providers, the **signing secret is returned in full on every `GET` and `POST` to this endpoint** — it is not a shown-once secret. Treat any credential with access to your Firebase account/API key as sensitive, and prefer `regenerate-secret` if you suspect exposure.
{% endhint %}

Calling `POST` again for the same `scope` **updates the URL in place** without rotating the secret (`$setOnInsert` semantics — the secret is only generated on first creation for that scope). Use `regenerate-secret` to rotate it explicitly.

### Webhook record status <a href="#webhook-record-status" id="webhook-record-status"></a>

Delivery requires:

* `status: active` on the webhook document for that `scope`.
* Valid `webhookUrl` and `signingSecret`.

Use `PATCH /webhook/status` to deactivate temporarily during maintenance.

### Testing your endpoint <a href="#testing-your-endpoint" id="testing-your-endpoint"></a>

`POST /kollect/profile/webhook/test` sends a single signed sample payload (same shape as production, with placeholder IDs) to your registered `webhookUrl` for the given `scope` and `scenario` (`success` or `failed`). It does **not** touch real payment/invoice data and does **not** retry — it's a one-shot delivery check.

### Outbound delivery behavior <a href="#outbound-delivery-behavior" id="outbound-delivery-behavior"></a>

| Property | Value                                                                                                  |
| -------- | ------------------------------------------------------------------------------------------------------ |
| Method   | `POST`                                                                                                 |
| Headers  | `Content-Type: application/json`, `x-kollect-signature: <hex>`, `x-kollect-signature-v2: sha256=<hex>` |
| Timeout  | **10 seconds** per attempt                                                                             |
| Retries  | Up to **4 attempts total** with backoff **2s, 4s, 8s**; a delivery log is kept per attempt-set         |

**Recommendation:** Respond with **2xx** immediately after **validating the signature** and **enqueueing** work to your internal queue. Perform heavy work asynchronously — retries stop as soon as you return 2xx, so slow synchronous processing just costs you extra redeliveries.

### Related pages <a href="#related-pages" id="related-pages"></a>

* ​[Webhooks overview](https://kollect.gitbook.io/docs/webhook-overview.md)​
* ​[Payload & signature verification](https://kollect.gitbook.io/docs/webhook-overview/payload-and-verification.md)​
* ​[Getting started](https://kollect.gitbook.io/docs/introduction/getting-started.md)​
