Typescript (SDK)
import { Autumn } from 'autumn-js'
const autumn = new Autumn()
const result = await autumn.webhooks.previewSync({
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.preview_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.preview_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"
}
]
}
'{
"changes": [
{
"action": "create",
"id": "billing",
"webhook": {
"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
}
}
],
"errors": []
}
Webhooks
Preview Sync Webhooks
Shows what webhooks.sync would do with the same body, without changing anything: which webhooks it would create or update, and which existing ones it would leave alone because the body doesn’t list them.
POST
/
v1
/
webhooks.preview_sync
Typescript (SDK)
import { Autumn } from 'autumn-js'
const autumn = new Autumn()
const result = await autumn.webhooks.previewSync({
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.preview_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.preview_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"
}
]
}
'{
"changes": [
{
"action": "create",
"id": "billing",
"webhook": {
"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
}
}
],
"errors": []
}
Body Parameters
Response
{
"changes": [
{
"action": "create",
"id": "billing",
"webhook": {
"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
}
}
],
"errors": []
}
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Body
application/json
The webhooks to create or update. Webhooks not listed are left alone; nothing is deleted.
Show child attributes
Show child attributes
Response
200 - application/json
OK
What webhooks.sync would do. adopt takes over a webhook made in the dashboard with the same URL, keeping its signing secret. unmanaged webhooks exist but aren't listed, so sync leaves them alone.
- Option 1
- Option 2
- Option 3
- Option 4
Show child attributes
Show child attributes
Listed webhooks webhooks.sync would refuse, e.g. when several dashboard webhooks share the URL.
Show child attributes
Show child attributes