Skip to main content

Subscribe to a webhook

warning

This is a V1 legacy endpoint. It uses a different path /rest/v1 and may return different error codes and response formats compared to V2. While it remains functional, consider handling errors accordingly.

Start receiving notifications for selected events via webhook. Whenever an event occurs, we will send the event data as an array of objects to the specified target URL.

Request

Endpoint

POST https://api.woodpecker.co/rest/v1/webhooks/subscribe

Headers

x-api-key: {YOUR_API_KEY}
Content-type: application/json

For details on how to authenticate your requests, please see the authentication guide.

Body

You can subscribe to the same event up to three times per account, provided that each subscription uses a unique target_url. However, you can subscribe multiple different events to a single target_url.

{ 
"target_url": "https://receiving-url.com/unique_target_url",
"event": "EVENT_NAME"
}

Body schema

FieldTypeDescription
target_urlstringThe URL where webhook events will be delivered
eventstringEvent you would like to be notified about. Available events

Request sample

Subscribe to a webhook

curl --request POST \
--url "https://api.woodpecker.co/rest/v1/webhooks/subscribe" \
--header "Content-Type: application/json" \
--header "x-api-key: {YOUR_API_KEY}" \
--data '{
"target_url": "https://receiving-url.com/unique_target_url",
"event": "EVENT_NAME"
}'

Response

Response examples

Successfully subscribed

{
"target_url": "https://receiving-url.com/unique_target_url",
"event": "EVENT_NAME",
"message": "Subscribed."
}

Body schema

FieldData TypeDescription
target_urlstringThe URL where webhook events will be delivered
eventstringThe name of the event for which the subscription was created
messagestringA confirmation message indicating the subscription status