Webhooks
Webhooks that tell your services about runs, and their deliveries.
Every path is under /api/v1; see the API for authenticating, errors and rate
limits, and the schemas for the bodies.
The project's webhooks (webhook:manage)
GET /api/v1/projects/{project}/webhooks
| Parameter | In | Description |
|---|---|---|
project |
path | ID |
Answers:
200: OK, object with the fields below
| Field | Type | Description |
|---|---|---|
event_types |
array of string, required | What a webhook can subscribe to. |
webhooks |
array of Webhook, required |
Errors: 403, 404 (how errors look).
Add a webhook (webhook:manage)
POST /api/v1/projects/{project}/webhooks
Deliveries are POSTed as JSON {id, type, occurred_at, project_id, organization_id, data}
(id is the event's; deliveries of one event share it) with headers Forge-Event,
Forge-Delivery and Forge-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256 of "<t>.<body>" under the secret> (several v1 while a secret is rotated). Receivers should
check the signature and reject old timestamps. Any 2xx counts as delivered; otherwise
Forge retries for about a day (8 attempts). Redirects are not followed, and only public
addresses are reached. The secret is returned once.
| Parameter | In | Description |
|---|---|---|
project |
path | ID |
Body (application/json): any.
Answers:
201: Created, with its secret, Webhook
Errors: 400, 403, 404, 409, 422, 503 (how errors look).
A webhook (webhook:manage)
GET /api/v1/webhooks/{webhook}
| Parameter | In | Description |
|---|---|---|
webhook |
path | ID |
Answers:
200: OK, Webhook
Errors: 404 (how errors look).
Change a webhook's URL, description, events or whether it is enabled (webhook:manage)
PATCH /api/v1/webhooks/{webhook}
| Parameter | In | Description |
|---|---|---|
webhook |
path | ID |
Body (application/json): WebhookInput.
Answers:
200: OK, Webhook
Errors: 400, 404, 422 (how errors look).
Delete a webhook; deliveries still pending are dropped (webhook:manage)
DELETE /api/v1/webhooks/{webhook}
| Parameter | In | Description |
|---|---|---|
webhook |
path | ID |
Answers:
204: Deleted
Errors: 404 (how errors look).
Give a webhook a new secret; the previous one signs too for 24 hours (webhook:manage)
POST /api/v1/webhooks/{webhook}/rotate-secret
| Parameter | In | Description |
|---|---|---|
webhook |
path | ID |
Answers:
200: The webhook with its new secret, Webhook
Errors: 404, 503 (how errors look).
Send a test event (type ping) to a webhook (webhook:manage)
POST /api/v1/webhooks/{webhook}/ping
| Parameter | In | Description |
|---|---|---|
webhook |
path | ID |
Answers:
202: The delivery, sent shortly, WebhookDelivery
Errors: 404 (how errors look).
A webhook's deliveries, newest first, kept 30 days (webhook:manage)
GET /api/v1/webhooks/{webhook}/deliveries
| Parameter | In | Description |
|---|---|---|
webhook |
path | ID |
limit |
query | integer |
cursor |
query | string |
Answers:
200: OK, object with the fields below
| Field | Type | Description |
|---|---|---|
deliveries |
array of WebhookDelivery, required | |
next_cursor |
string |
Errors: 400, 404 (how errors look).
Send a delivery's event again, as a new delivery (webhook:manage)
POST /api/v1/webhooks/{webhook}/deliveries/{delivery}/redeliver
| Parameter | In | Description |
|---|---|---|
webhook |
path | ID |
delivery |
path | ID |
Answers:
202: The new delivery, WebhookDelivery
Errors: 404 (how errors look).