Webhooks
Examples use
$SPAVIK_BASE_URLand$SPAVIK_API_KEY, set in Get started.
GET /v1/webhooks
List webhooks
Authentication : API key (X-API-Key) or web session (Authorization: Bearer)
Responses
| Code | Description |
|---|---|
200 | Success |
401 | Authentication required, or invalid token. |
403 | This caller is not allowed to perform this action. |
Example
sh
curl -X GET "$SPAVIK_BASE_URL/v1/webhooks" \
-H 'X-API-Key: sk-spv-api-...'POST /v1/webhooks
Register a webhook
Authentication : API key (X-API-Key) or web session (Authorization: Bearer)
Request body
| Name | Type | Description | |
|---|---|---|---|
url | string | required | |
events | model.trained | model.stale | model.refreshed | credits.low[] | optional |
Responses
| Code | Description |
|---|---|
201 | Created (the secret is returned once and only once) |
401 | Authentication required, or invalid token. |
403 | This caller is not allowed to perform this action. |
409 | TOO_MANY_WEBHOOKS: workspace limit reached; WEBHOOK_URL_EXISTS: this URL is already registered here (update the existing webhook instead). |
Example
sh
curl -X POST "$SPAVIK_BASE_URL/v1/webhooks" \
-H 'X-API-Key: sk-spv-api-...' \
-H 'Content-Type: application/json' \
-d '{
"url": "https://exemple.test/spavik-webhook",
"events": [
"model.trained",
"credits.low"
]
}'PATCH /v1/webhooks/{id}
Update a webhook
Authentication : API key (X-API-Key) or web session (Authorization: Bearer)
Request body
| Name | Type | Description | |
|---|---|---|---|
url | string | optional | |
events | string[] | optional | |
active | boolean | optional |
Responses
| Code | Description |
|---|---|
200 | Success |
401 | Authentication required, or invalid token. |
403 | This caller is not allowed to perform this action. |
404 | Unknown webhook. |
409 | WEBHOOK_URL_EXISTS: this URL is already registered on another webhook of the workspace. |
Example
sh
curl -X PATCH "$SPAVIK_BASE_URL/v1/webhooks/{id}" \
-H 'X-API-Key: sk-spv-api-...' \
-H 'Content-Type: application/json' \
-d '{
"active": false
}'DELETE /v1/webhooks/{id}
Delete a webhook
Authentication : API key (X-API-Key) or web session (Authorization: Bearer)
Responses
| Code | Description |
|---|---|
204 | Deleted |
401 | Authentication required, or invalid token. |
403 | This caller is not allowed to perform this action. |
Example
sh
curl -X DELETE "$SPAVIK_BASE_URL/v1/webhooks/{id}" \
-H 'X-API-Key: sk-spv-api-...'