Get webhook subscriptions
Retrieve a list of all subscribed webhooks for the authenticated account. Each webhook consists of a target_url
and event
To manage your existing subscriptions or subscribe to new events, please refer to this guide.
Request
Endpoint
GET https://api.woodpecker.co/rest/v2/webhooks
Headers
x-api-key: {YOUR_API_KEY}
For details on how to authenticate your requests, please see the authentication guide.
Request sample
Retrieve a list of webhook subscriptions
- cURL
- Python
- Java
- Node.js
curl --request GET \
--url "https://api.woodpecker.co/rest/v2/webhooks" \
--header "x-api-key: {YOUR_API_KEY}"
import requests
def get_webhooks():
url = "https://api.woodpecker.co/rest/v2/webhooks"
headers = {
"x-api-key": "{YOUR_API_KEY}"
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
return response.json()
else:
raise Exception(f"GET request failed: {response.status_code}, {response.text}")
if __name__ == "__main__":
try:
data = get_webhooks()
print("GET response:", data)
except Exception as e:
print("Error:", e)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class WoodpeckerApiClient {
private static final String API_KEY = "{YOUR_API_KEY}";
private static final String URL = "https://api.woodpecker.co/rest/v2/webhooks";
public static void main(String[] args) {
try {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(new URI(URL))
.header("x-api-key", API_KEY)
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() == 200) {
System.out.println("GET response: " + response.body());
} else {
System.err.println("GET request failed: " + response.statusCode());
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
const axios = require('axios');
async function getWebhooks() {
const url = 'https://api.woodpecker.co/rest/v2/webhooks';
const headers = {
'x-api-key': '{YOUR_API_KEY}'
};
try {
const response = await axios.get(url, { headers });
console.log('GET response:', response.data);
} catch (error) {
console.error('GET request failed:', error.response ? error.response.status : error.message);
}
}
getWebhooks();
Response
Response examples
- 200
- 200 (no subscriptions)
- 401
- 404
- 500
Returns a list of webhooks associated with the account, if any are subscribed. The results include all webhooks under the account, regardless of which user created the subscription.
{
"webhooks": [
{
"target_url": "https://myurl.com/woodpeckerwebhooks",
"event": "PROSPECT_INTERESTED"
},
{
"target_url": "https://hooks.zapier.com/hooks/catch/123456/",
"event": "PROSPECT_REPLIED"
},
{
"target_url": "https://hook.eu1.make.com/abcd123",
"event": "PROSPECT_REPLIED"
}
]
}
Body schema
Field | Type | Description |
---|---|---|
webhooks[] | array | A list of webhook objects, each containing the target URL and the event type |
└─target_url | string | The URL to which the webhook is sent |
└─event | string | The type of event in Woodpecker that will trigger the webhook. Available webhooks |
A response if your account is not subscribed to any webhooks.
{
"message": "You haven't subscribed to any webhooks."
}
Body schema
Field | Type | Description |
---|---|---|
message | string | A message describing the response |
An issue with authorization. Please review the authorization guide
{
"title": "Unauthorized",
"status": 401,
"detail": "Invalid api key",
"timestamp": "2025-03-05 17:57:00"
}
Body schema
Field | Type | Description |
---|---|---|
title | string | A short title describing the error |
status | integer | The HTTP status code |
detail | string | A detailed message explaining the error |
timestamp | string | The timestamp when the error occurred, YYYY-MM-DD HH:MM:SS UTC |
Please review the request URL.
{
"title": "Not Found",
"status": 404,
"detail": "Requested resource does not exist",
"timestamp": "2025-03-05 17:57:00"
}
Body schema
Field | Type | Description |
---|---|---|
title | string | A short title describing the error |
status | integer | The HTTP status code |
detail | string | A detailed message explaining the error |
timestamp | string | The timestamp when the error occurred, YYYY-MM-DD HH:MM:SS UTC |
Unknown error, please try again later
{
"title": "Internal server error",
"status": 500,
"detail": "An unexpected error has occurred. Please try again later.",
"timestamp": "2025-03-05 17:57:00"
}
Body schema
Field | Type | Description |
---|---|---|
title | string | A short title describing the error |
status | integer | The HTTP status code |
detail | string | A detailed message explaining the error |
timestamp | string | The timestamp when the error occurred, YYYY-MM-DD HH:MM:SS UTC |