Webhooks
Les exemples utilisent
$SPAVIK_BASE_URLet$SPAVIK_API_KEY, définis dans Démarrer.
GET /v1/webhooks
Lister les webhooks
Authentification : Clé d'usage (X-API-Key) ou session web (Authorization: Bearer)
Réponses
| Code | Description |
|---|---|
200 | Succès |
401 | Authentification requise, ou jeton invalide. |
403 | Cet appelant n'est pas autorisé à faire cette action. |
Exemple
sh
curl -X GET "$SPAVIK_BASE_URL/v1/webhooks" \
-H 'X-API-Key: sk-spv-api-...'POST /v1/webhooks
Enregistrer un webhook
Authentification : Clé d'usage (X-API-Key) ou session web (Authorization: Bearer)
Corps de la requête
| Nom | Type | Description | |
|---|---|---|---|
url | string | requis | |
events | model.trained | model.stale | model.refreshed | credits.low[] | facultatif |
Réponses
| Code | Description |
|---|---|
201 | Créée (le secret n'est rendu qu'une seule fois) |
401 | Authentification requise, ou jeton invalide. |
403 | Cet appelant n'est pas autorisé à faire cette action. |
409 | TOO_MANY_WEBHOOKS : limite du workspace atteinte ; WEBHOOK_URL_EXISTS : cette URL est déjà enregistrée ici (modifiez plutôt le webhook existant). |
Exemple
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}
Modifier un webhook
Authentification : Clé d'usage (X-API-Key) ou session web (Authorization: Bearer)
Corps de la requête
| Nom | Type | Description | |
|---|---|---|---|
url | string | facultatif | |
events | string[] | facultatif | |
active | boolean | facultatif |
Réponses
| Code | Description |
|---|---|
200 | Succès |
401 | Authentification requise, ou jeton invalide. |
403 | Cet appelant n'est pas autorisé à faire cette action. |
404 | Webhook inconnu. |
409 | WEBHOOK_URL_EXISTS : cette URL est déjà enregistrée sur un autre webhook du workspace. |
Exemple
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}
Supprimer un webhook
Authentification : Clé d'usage (X-API-Key) ou session web (Authorization: Bearer)
Réponses
| Code | Description |
|---|---|
204 | Supprimé |
401 | Authentification requise, ou jeton invalide. |
403 | Cet appelant n'est pas autorisé à faire cette action. |
Exemple
sh
curl -X DELETE "$SPAVIK_BASE_URL/v1/webhooks/{id}" \
-H 'X-API-Key: sk-spv-api-...'