> For the complete documentation index, see [llms.txt](https://help.alternativepayments.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.alternativepayments.io/getting-started/accounts-payable-api/webhooks.md).

# Webhooks

The Accounts Payable API adds 14 new webhook topics to the existing webhook infrastructure. Partners subscribe using the same `POST /webhooks` endpoint with new topic values. No new webhook endpoints are needed.

## Subscribing to Acc Payable Webhooks

Use the existing webhook subscription endpoint:

```
POST /webhooks
```

```json
{
  "topic": "vendor_created",
  "endpoint_url": "https://your-server.com/webhooks",
  "secret_key": "your-webhook-secret"
}
```

## New Webhook Topics

### Vendor Events

| Topic                | Trigger                                           |
| -------------------- | ------------------------------------------------- |
| `vendor_created`     | Vendor created (manual, OCR, or integration sync) |
| `vendor_updated`     | Vendor details changed                            |
| `vendor_deactivated` | Vendor deactivated                                |
| `vendor_reactivated` | Vendor reactivated                                |

### Bill Events

| Topic            | Trigger                                         |
| ---------------- | ----------------------------------------------- |
| `bill_created`   | Bill created (manual, OCR, or integration sync) |
| `bill_updated`   | Bill details changed                            |
| `bill_submitted` | Bill submitted for approval                     |
| `bill_rejected`  | Bill rejected                                   |
| `bill_deleted`   | Bill soft-deleted                               |

### Vendor Payment Events

| Topic                       | Trigger                                           |
| --------------------------- | ------------------------------------------------- |
| `vendor_payment_processing` | Vendor payment initiated, funds being transferred |
| `vendor_payment_succeeded`  | Vendor payment completed successfully             |
| `vendor_payment_failed`     | Vendor payment failed                             |
| `vendor_payment_canceled`   | Vendor payment canceled                           |

### Vendor Data Request Events

| Topic                           | Trigger                                                |
| ------------------------------- | ------------------------------------------------------ |
| `vendor_data_request_submitted` | Vendor completed the self-service data collection form |

## Webhook Payload Format

Webhook payloads follow the same format as existing AR webhooks. The `topic` field indicates the event type, and the `data` field contains the resource details.

```json
{
  "id": "event-uuid",
  "topic": "vendor_payment_succeeded",
  "created_at": "2026-04-15T14:30:00Z",
  "data": {
    "vendor_payment_id": "aa0e8400-e29b-41d4-a716-446655440000",
    "bill_id": "660e8400-e29b-41d4-a716-446655440000",
    "vendor_id": "550e8400-e29b-41d4-a716-446655440000",
    "payment_id": "990e8400-e29b-41d4-a716-446655440000",
    "partner_id": "bb0e8400-e29b-41d4-a716-446655440000",
    "amount": 1500.00,
    "payment_date": "2026-04-15T14:30:00Z"
  }
}
```

## Managing Webhook Subscriptions

All existing webhook management endpoints work with the new topics:

| Method | Path                    | Description                     |
| ------ | ----------------------- | ------------------------------- |
| POST   | `/webhooks`             | Subscribe to a topic            |
| GET    | `/webhooks`             | List subscriptions              |
| DELETE | `/webhooks/{id}`        | Unsubscribe                     |
| GET    | `/webhooks/{id}/events` | List events for a subscription  |
| POST   | `/webhooks/{id}/retry`  | Retry failed webhook deliveries |

## Webhook Delivery

* Webhooks are delivered via HTTP POST to the configured `endpoint_url`
* If a `secret_key` was provided, the payload is signed using HMAC-SHA256
* Failed deliveries are retried with exponential backoff
* Event history is retained for 30 days


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.alternativepayments.io/getting-started/accounts-payable-api/webhooks.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
