Set the webhook
Registers or replaces the survey's webhook endpoint and returns a fresh signing secret.
HTTP request
PUT https://www.asqiro.com/api/v1/surveys/{id}/webhook
An API key created by a workspace member who can edit. A viewer's key answers 403.
Path parameters
| Parameter | Type | Description |
|---|---|---|
| id | string | The survey id, as returned by the surveys endpoints.Required |
Request body
| Parameter | Type | Description |
|---|---|---|
| targetUrl | string | Public HTTPS URL that receives the event. Private, loopback, and link-local hosts are rejected.Required |
Response body
| Field | Type | Description |
|---|---|---|
| enabled | boolean | Whether a webhook is currently configured for this survey. |
| targetUrl | string | The URL receiving events, or null when no webhook is configured. |
| signingSecret | string | Secret used to sign deliveries. Returned only by this call. |
Note Every call rotates the signing secret. Store the returned value before deploying, or deliveries will fail verification.
Note The URL must be public HTTPS. Loopback, private-range, and link-local hosts, and URLs carrying credentials, answer 400 with the code invalid_request.
Errors
- unauthorized · 401 · The API key is missing, malformed, deleted, or its creator lost workspace access. Check the Authorization header, then the key itself.
- forbidden · 403 · The key is valid but lacks the access this call needs - most often a read-only key attempting a write.
- not_found · 404 · No survey with that id is reachable by this key. A survey in another workspace answers the same way as one that does not exist.
- invalid_request · 400 · The request body or a parameter was missing or malformed. Fix the request; retrying it unchanged will fail again.
- plan_upgrade_required · 403 · The workspace owner's plan does not include API access. Upgrading the plan restores it; retrying will not.
- rate_limited · 429 · Too many requests. The Retry-After response header carries the number of seconds to wait.
Example request
bash
curl -X PUT "https://www.asqiro.com/api/v1/surveys/s_7t2qk8wvbf31/webhook" \
-H "Authorization: Bearer $ASQIRO_API_KEY" \
-H "Content-Type: application/json" \
-d '{"targetUrl":"https://hooks.example.com/asqiro"}'Returns 200 on success.
json
{
"enabled": true,
"targetUrl": "https://hooks.example.com/asqiro",
"signingSecret": "a1b2c3d4e5f6..."
}