Webhook management API reference
Use these routes to manage webhook endpoints in a department. You need Pro or Enterprise and permission to perform the requested webhook action. See the event reference for the POST Pollarix sends to your receiver.
Authentication
Send the bearer token from your first API request in the Authorization header. Use the department UUID associated with the token and confirm your API user's webhook permissions.
Base URL
https://api.pollarix.com/api/v1
Endpoints Overview
Paths are relative to the base URL. Replace {departmentId} with the department UUID and {webhookId} with an ID from the endpoint list.
| Method | Path | Purpose |
|---|---|---|
GET | /department/{departmentId}/webhook/ | List configured endpoints. |
POST | /department/{departmentId}/webhook/ | Create an endpoint. |
POST | /department/{departmentId}/webhook/add | Add an endpoint to the department. |
PUT | /department/{departmentId}/webhook/{webhookId} | Update an endpoint. |
DELETE | /department/{departmentId}/webhook/{webhookId} | Delete an endpoint. |
POST | /department/{departmentId}/webhook/test-send | Send a synthetic connection check. |
List Webhooks
Parameters
departmentId is the department UUID.
Response
The response has departmentId and a webhooks array. An unconfigured department returns an empty array. Endpoint entries include an identifier, URL, subscribed events, and activation state. Treat configured headers in a returned endpoint record as sensitive.
Example
GET /api/v1/department/{departmentId}/webhook/
Host: api.pollarix.com
Authorization: Bearer <access_token>
Create Webhook
Parameters
departmentId is the department UUID.
Request Body
| Field | Value |
|---|---|
name | A descriptive endpoint name. |
url | A public HTTPS URL for your receiver. |
events | A nonempty array of supported events. |
isActive | Whether the endpoint receives events. Defaults to true. |
headers | Optional object of custom header names and string values. |
Response
Returns the department webhook configuration, including the new endpoint.
Example
Send the following JSON to POST /api/v1/department/{departmentId}/webhook/:
{
"name": "Survey response receiver",
"url": "https://receiver.example.com/pollarix",
"events": ["SURVEY_COMPLETED"],
"isActive": true
}
Add Webhook
Parameters
departmentId is the department UUID.
Request Body
Use the same fields as Create Webhook.
Example
Send the create example to POST /api/v1/department/{departmentId}/webhook/add. Use the returned department configuration to find the new endpoint's ID.
Update Webhook
Parameters
Provide the departmentId UUID and the webhookId of the endpoint being updated.
Request Body
Send the endpoint's desired name, HTTPS URL, event list, active state, and any custom headers you want it to keep.
Example
To pause an endpoint, send its current configuration with isActive set to false to PUT /api/v1/department/{departmentId}/webhook/{webhookId}.
Delete Webhook
Parameters
Provide the departmentId UUID and the webhookId to delete.
Response
Returns HTTP 200 with the JSON value true.
Example
DELETE /api/v1/department/{departmentId}/webhook/{webhookId}
Test Webhook
Parameters
departmentId is the department UUID.
Request Body
The JSON body takes one url field. Use a public HTTPS test receiver you control.
Response
The API attempts the connection and returns HTTP 200 with JSON null if it completes. Read the receiver logs to check what arrived and how the receiver handled it.
Example
Send {"url":"https://receiver.example.com/pollarix-test"} to POST /api/v1/department/{departmentId}/webhook/test-send. Read Testing your webhook for the differences between a test and a signed event.
Error Responses
Error Format
Use the HTTP status to decide how to handle an error. The response detail can include validation errors or a plan or permission message.
Error Codes
| Status | Check |
|---|---|
400, 422 | Check the URL, UUID and request fields. |
401 | Check that the access token is valid and current. |
403 | Check department permissions and plan availability. |
404 | Check the department and endpoint identifiers. |
429 | Retry after waiting. |
Complete Code Examples
Node.js Webhook Manager
Use this example with a valid token in the environment:
const base = 'https://api.pollarix.com/api/v1';
const department = process.env.POLLARIX_API_KEY;
const response = await fetch(`${base}/department/${department}/webhook/`, {
headers: { Authorization: `Bearer ${process.env.POLLARIX_ACCESS_TOKEN}` },
});
if (!response.ok) throw new Error(`Webhook list failed: ${response.status}`);
const { webhooks } = await response.json();
console.log('Endpoints:', webhooks.length);
Python Webhook Manager
import json
import os
from urllib.request import Request, urlopen
base = "https://api.pollarix.com/api/v1"
department = os.environ["POLLARIX_API_KEY"]
request = Request(
f"{base}/department/{department}/webhook/",
headers={"Authorization": f"Bearer {os.environ['POLLARIX_ACCESS_TOKEN']}"},
)
with urlopen(request, timeout=15) as response:
print("Endpoints:", len(json.load(response)["webhooks"]))