API ReferenceWebhooks
Create Webhook
Subscribe to events by creating a webhook endpoint with event type filters and signing secret.
Endpoint
POST /v1/webhooksBase URL: https://api-id.avnology.net
Authentication: API Key or OAuth token with admin:webhooks:write scope
Request
curl -X POST https://api-id.avnology.net/v1/webhooks \
-H
| Field | Type | Required | Description |
|---|---|---|---|
url | string | Yes | HTTPS destination URL for webhook deliveries |
events | string[] | Yes | Event types to subscribe to (see Events) |
description | string | No | Human-readable description |
active | boolean | No | Whether the webhook is active (default: true) |
organization_id | string | No | Scope webhook to an organization |
custom_headers | object | No | Custom HTTP headers included with each delivery |
Response
Success (201 Created)
{
"id": "whk_9f8e7d6c-5b4a-3c2d-1e0f-9a8b7c6d5e4f",
"url": "https://api.acme.com/webhooks/avnology",
"events": ["user.created", "user.updated", "user.deleted", "session.created"],
"secret": "whsec_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6",
"active": true,
"description": "Sync user changes to our CRM",
"organization_id":
Important: The secret field is the HMAC-SHA256 signing secret. It is only returned on creation and rotation. Store it securely to verify webhook signatures.
Errors
| Status | Code | Description |
|---|---|---|
| 400 | AVNOLOGY_AUTH_902 | Invalid URL or event types |
| 403 | AVNOLOGY_AUTH_100 | Insufficient permissions |
Code Examples
JavaScript (fetch)
async function createWebhook(apiKey, url, events) {
return fetch('https://api-id.avnology.net/v1/webhooks', {
method: 'POST',
headers: { 'Authorization': `Bearer ${apiKey}`, 'Content-Type': 'application/json' },
Python (httpx)
import httpx
def create_webhook(api_key: str, url: str, events: list[str]) -> dict:
return httpx.post("https://api-id.avnology.net/v1/webhooks",
headers={"Authorization"
Go (net/http)
func createWebhook(ctx context.Context, apiKey, webhookURL string, events []string) (*Webhook, error) {
Related
- Events Reference -- complete event catalog
- Signature Verification -- verify webhook signatures
- Test Webhook -- send a test event
- SDK:
client.admin.createWebhook({ url, events })(TypeScript)