Skip to content

Webhooks

Les exemples utilisent $SPAVIK_BASE_URL et $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

CodeDescription
200Succès
401Authentification requise, ou jeton invalide.
403Cet 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

NomTypeDescription
urlstringrequis
eventsmodel.trained | model.stale | model.refreshed | credits.low[]facultatif

Réponses

CodeDescription
201Créée (le secret n'est rendu qu'une seule fois)
401Authentification requise, ou jeton invalide.
403Cet appelant n'est pas autorisé à faire cette action.
409TOO_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

NomTypeDescription
urlstringfacultatif
eventsstring[]facultatif
activebooleanfacultatif

Réponses

CodeDescription
200Succès
401Authentification requise, ou jeton invalide.
403Cet appelant n'est pas autorisé à faire cette action.
404Webhook inconnu.
409WEBHOOK_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

CodeDescription
204Supprimé
401Authentification requise, ou jeton invalide.
403Cet 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-...'

Documentation générée pour partie depuis le contrat OpenAPI.