GET /v1/organizations/{org_id}/projects/{id}/workflows
Les workflows d’automatisation d’un projet (déclencheur → conditions → actions) et l’historique de leurs exécutions.
Liste des workflows
Section intitulée « Liste des workflows »GET /api/v1/organizations/{org_id}/projects/{project_id}/workflowsAuthorization: Bearer twa_votre_cle_iciParamètres de chemin
Section intitulée « Paramètres de chemin »| Paramètre | Type | Description |
|---|---|---|
org_id |
UUID |
Identifiant de l’organisation |
project_id |
UUID |
Identifiant du projet |
Réponse 200 OK
Section intitulée « Réponse 200 OK »[ { "id": "018e8888-0000-7000-8000-000000000040", "name": "Workflow par défaut", "is_enabled": true, "is_default": true, "created_at": "2024-03-15T10:22:00Z", "updated_at": "2024-06-01T08:00:00Z" }]| Champ | Type | Description |
|---|---|---|
id |
string (UUID) |
Identifiant du workflow |
name |
string |
Nom |
is_enabled |
boolean |
Workflow actif |
is_default |
boolean |
Workflow par défaut du projet |
created_at |
string (ISO 8601) |
Date de création |
updated_at |
string (ISO 8601) |
Dernière modification |
La liste ne contient pas le graphe.
Pas de lecture unitaire sur /v1
Section intitulée « Pas de lecture unitaire sur /v1 »GET /api/v1/organizations/{org_id}/projects/{project_id}/workflows/{workflow_id} n’existe pas. Pour lire un workflow avec son graphe :
- l’outil MCP
get_workflow; - l’API de session (cookie ou jeton de compte, pas une clé
twa_) :GET /projects/{project_id}/workflows/{workflow_id}. Un workflow d’organisation se lit parGET /organizations/{org_id}/workflows/{workflow_id}.
Créer un workflow
Section intitulée « Créer un workflow »POST /api/v1/organizations/{org_id}/projects/{project_id}/workflowsAuthorization: Bearer twa_votre_cle_iciIdempotency-Key: 018e9999-0000-7000-8000-000000000099Content-Type: application/jsonScope workflows-write, à accorder explicitement sur la clé. Sans cet en-tête : 422. La même clé et le même corps renvoient le workflow déjà créé (200) ; un autre corps avec la même clé : 409.
Corps : name (requis), description, et soit graph (nodes et edges), soit trigger, actions et create_case (défaut true). Les deux formes ensemble : 422.
Réponse 201 : la fiche complète (id, name, description, is_enabled, is_default, family, version, graph, created_at, updated_at). Un nom déjà pris sur le projet : 409.
Modifier un workflow
Section intitulée « Modifier un workflow »PATCH /api/v1/organizations/{org_id}/projects/{project_id}/workflows/{workflow_id}Authorization: Bearer twa_votre_cle_iciContent-Type: application/jsonScope workflows-write. version est obligatoire : si elle ne correspond plus à la fiche, 409 (version_perimee, la réponse donne la version actuelle). Champs : name, description, version, et soit graph, soit trigger, actions, create_case.
Activer ou désactiver
Section intitulée « Activer ou désactiver »PATCH /api/v1/organizations/{org_id}/projects/{project_id}/workflows/{workflow_id}/enabledAuthorization: Bearer twa_votre_cle_iciContent-Type: application/json
{ "enabled": false }Scope workflows-write. Réponse : la fiche, version incrémentée.
Supprimer un workflow
Section intitulée « Supprimer un workflow »DELETE /api/v1/organizations/{org_id}/projects/{project_id}/workflows/{workflow_id}Authorization: Bearer twa_votre_cle_iciScope workflows-write. Réponse 204. 409 si c’est le workflow par défaut du projet, ou le dernier du projet.
Historique d’exécutions
Section intitulée « Historique d’exécutions »GET /api/v1/organizations/{org_id}/projects/{project_id}/workflows/{workflow_id}/runsAuthorization: Bearer twa_votre_cle_iciParamètres de requête
Section intitulée « Paramètres de requête »| Paramètre | Type | Description |
|---|---|---|
limit |
integer |
Nombre d’exécutions, max 200 (défaut 50) |
Réponse 200 OK
Section intitulée « Réponse 200 OK »[ { "id": "018e8888-0000-7000-8000-000000000041", "workflow_id": "018e8888-0000-7000-8000-000000000040", "trigger_event": "cve.new_match", "cve_id": "CVE-2024-3094", "status": "success", "started_at": "2024-07-01T06:05:00Z", "finished_at": "2024-07-01T06:05:02Z" }]Champs — Exécution
Section intitulée « Champs — Exécution »| Champ | Type | Description |
|---|---|---|
id |
string (UUID) |
Identifiant de l’exécution |
workflow_id |
string (UUID) |
Workflow exécuté |
trigger_event |
string |
Événement déclencheur (ex. cve.new_match) |
cve_id |
string | null |
CVE concernée |
status |
string |
success, partial, failed, throttled, dry_run |
started_at |
string (ISO 8601) |
Début |
finished_at |
string (ISO 8601) | null |
Fin (null si en cours) |
| Code | Détail | Cause |
|---|---|---|
404 |
Projet introuvable |
Projet inexistant, d’une autre organisation, ou hors de la restriction de projets de la clé |
404 |
Workflow introuvable |
workflow_id inexistant sur ce projet |
Dernières exécutions en échec
ORG_ID="018e5678-abcd-7000-8000-000000000001"PROJECT_ID="018e1234-abcd-7000-8000-000000000010"WORKFLOW_ID="018e8888-0000-7000-8000-000000000040"
curl -s \ -H "Authorization: Bearer twa_votre_cle_ici" \ "https://app.techwatchalert.com/api/v1/organizations/${ORG_ID}/projects/${PROJECT_ID}/workflows/${WORKFLOW_ID}/runs?limit=100" \ | jq '.[] | select(.status == "failed" or .status == "partial") | {cve_id, status, started_at}'