---
title: "webhook"
method: POST
path: "/v2/webhook"
tags: ["Webhooks"]
---

# webhook

`POST /v2/webhook`

Create a webhook.

Specify a topic and a url. Use this call to either create or update a webhook for a topic.

<details>
<summary><strong>Error Glossary</strong> (click to expand)</summary>

| Code | HTTP Status | Message |
|------|-------------|-------------|
| `AP009` | 401 | Unauthorized |
| `AP101` | 401 | No authenticated user |
| `AP1000` | 200 | Invalid API |
| `AP1102` | 400 | Topic required to create webhook |
| `AP1103` | 400 | URL is invalid or missing |
| `AP1104` | 400 | Unrecognized topic |
| `AP1105` | 200 | Error creating webhook |
| `AP1107` | 400 | Merchant is required |

</details>

## Headers

- `Content-Type` string, required
- `authorization` string, required

## Request body

- object
  - `topic` 'transaction_completed' | 'transaction_refunded' | 'transaction_voided' | 'preauthorized_transaction_created' | 'transaction_declined' | 'transaction_resolved' | 'user_active' | 'user_suspended' | 'merchant_reputation_updated', required — Webhook topic to subscribe to
  - `url` string, required — Callback URL where webhook payloads will be sent.

## Response `200`

Success - Webhook Subscribed

- union
  - WebhookPostResponse
    - `webhooks` object — Object of webhook subscribed to
      - `id` integer — Id of webhook subscription.
      - `topic` string
      - `url` string, uri
      - `payloadVersion` string — Payload format version for this subscription (e.g.2.0). Determines the shape of delivered webhook payloads.
  - 200failure
    - `error` object
      - `code` string
      - `message` string
      - `help` string — Support contact information

## Other responses

- `400` — Bad Request - Validation Errors

---

[API](https://skmtc.net/aero/apis/aeropay-v2-api.md) · [All operations](https://skmtc.net/aero/apis/aeropay-v2-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/aero/aeropay-v2-api/revisions/4700c4ceeaad/schema)
