import { Autumn } from 'autumn-js'
const autumn = new Autumn()
const result = await autumn.webhooks.sync({
webhooks: [
{
id: "billing",
url: "https://example.com/webhooks/autumn",
events: [
"billing.updated",
"invoice.finalized",
],
description: "Plan changes and invoices",
},
],
});from autumn_sdk import Autumn
autumn = Autumn(secret_key="am_sk_test...")
res = autumn.webhooks.sync(
webhooks=[
{
"id": "billing",
"url": "https://example.com/webhooks/autumn",
"events": [
"billing.updated",
"invoice.finalized",
],
"description": "Plan changes and invoices",
},
],
)curl --request POST \
--url https://api.useautumn.com/v1/webhooks.sync \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-api-version: <x-api-version>' \
--data '
{
"webhooks": [
{
"id": "billing",
"url": "https://example.com/webhooks/autumn",
"events": [
"billing.updated",
"invoice.finalized"
],
"description": "Plan changes and invoices"
}
]
}
'{
"webhooks": [
{
"id": "billing",
"url": "https://example.com/webhooks/autumn",
"events": [
"billing.updated",
"invoice.finalized"
],
"description": "Plan changes and invoices",
"disabled": false,
"created_at": 1781113864000,
"updated_at": 1781113864000
}
],
"secrets": [
{
"id": "billing",
"secret": "whsec_abc123"
}
],
"errors": []
}
Sync Webhooks
Makes the listed webhooks exist as described: creates missing ones and updates ones that differ. Webhooks not listed are left alone — sync never deletes. Returns the signing secret of each webhook it created, once. Each webhook is applied on its own: failures are listed in errors while the rest still apply, and the request fails only when none could be applied.
import { Autumn } from 'autumn-js'
const autumn = new Autumn()
const result = await autumn.webhooks.sync({
webhooks: [
{
id: "billing",
url: "https://example.com/webhooks/autumn",
events: [
"billing.updated",
"invoice.finalized",
],
description: "Plan changes and invoices",
},
],
});from autumn_sdk import Autumn
autumn = Autumn(secret_key="am_sk_test...")
res = autumn.webhooks.sync(
webhooks=[
{
"id": "billing",
"url": "https://example.com/webhooks/autumn",
"events": [
"billing.updated",
"invoice.finalized",
],
"description": "Plan changes and invoices",
},
],
)curl --request POST \
--url https://api.useautumn.com/v1/webhooks.sync \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-api-version: <x-api-version>' \
--data '
{
"webhooks": [
{
"id": "billing",
"url": "https://example.com/webhooks/autumn",
"events": [
"billing.updated",
"invoice.finalized"
],
"description": "Plan changes and invoices"
}
]
}
'{
"webhooks": [
{
"id": "billing",
"url": "https://example.com/webhooks/autumn",
"events": [
"billing.updated",
"invoice.finalized"
],
"description": "Plan changes and invoices",
"disabled": false,
"created_at": 1781113864000,
"updated_at": 1781113864000
}
],
"secrets": [
{
"id": "billing",
"secret": "whsec_abc123"
}
],
"errors": []
}
Body Parameters
Response
{
"webhooks": [
{
"id": "billing",
"url": "https://example.com/webhooks/autumn",
"events": [
"billing.updated",
"invoice.finalized"
],
"description": "Plan changes and invoices",
"disabled": false,
"created_at": 1781113864000,
"updated_at": 1781113864000
}
],
"secrets": [
{
"id": "billing",
"secret": "whsec_abc123"
}
],
"errors": []
}
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Body
The webhooks to create or update. Webhooks not listed are left alone; nothing is deleted.
Show child attributes
Show child attributes
Response
OK
The listed webhooks as they stand after the sync, except those in errors.
Show child attributes
Show child attributes
Signing secrets for the webhooks this sync created, shown once. Existing webhooks keep theirs.
Show child attributes
Show child attributes
Webhooks that couldn't be created or updated. The others were still applied; the request fails only when none could be.
Show child attributes
Show child attributes