curl -X POST 'https://api.anyformat.ai/v3/webhooks/' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"url": "https://example.com/webhooks/anyformat", "events": ["run.completed", "run.failed"]}'
{
"id": "069dcc2c-e14c-7606-8000-2ee4fb17b4e3",
"url": "https://example.com/webhooks/anyformat",
"events": [
"run.completed",
"run.failed"
],
"created_at": "2023-11-07T05:31:56Z",
"secret": "whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw"
}Create Webhook
Subscribe an HTTPS endpoint to run events
curl -X POST 'https://api.anyformat.ai/v3/webhooks/' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"url": "https://example.com/webhooks/anyformat", "events": ["run.completed", "run.failed"]}'
{
"id": "069dcc2c-e14c-7606-8000-2ee4fb17b4e3",
"url": "https://example.com/webhooks/anyformat",
"events": [
"run.completed",
"run.failed"
],
"created_at": "2023-11-07T05:31:56Z",
"secret": "whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw"
}events is required and takes at least one event.
The response carries the webhook’s secret, the key that verifies each delivery. Store it: no other response returns it.
The URL must use HTTPS and resolve to a public address. A URL that resolves to a private or reserved address answers 400 INVALID_VALUE, and one whose hostname does not resolve answers 422 URL_UNREACHABLE. An organization that already holds 50 webhooks answers 409 WEBHOOK_SUBSCRIPTION_LIMIT.
Send a ping to check the endpoint before a run ends.
curl -X POST 'https://api.anyformat.ai/v3/webhooks/' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"url": "https://example.com/webhooks/anyformat", "events": ["run.completed", "run.failed"]}'
Authorizations
API key issued from app.anyformat.ai/api-key. Send as Authorization: Bearer <key>.
Body
The HTTPS endpoint that receives the events. It must resolve to a public address.
2048^https://"https://example.com/webhooks/anyformat"
Event types the endpoint receives. run.completed: a run ended processed. run.failed: a run ended error. run.cancelled: a run ended cancelled.
1run.completed, run.failed, run.cancelled ["run.completed", "run.failed"]
Response
Successful Response
Unique identifier of the webhook (hyphenated UUID).
"069dcc2c-e14c-7606-8000-2ee4fb17b4e3"
The endpoint that receives the events.
"https://example.com/webhooks/anyformat"
Event types the endpoint receives. run.completed: a run ended processed. run.failed: a run ended error. run.cancelled: a run ended cancelled.
run.completed, run.failed, run.cancelled ["run.completed", "run.failed"]
Timestamp when the webhook was created (ISO 8601).
The signing secret, whsec_ and base64. Verify each delivery's webhook-signature with it. Only this response carries it: store it securely.
"whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw"

