API REST
Référence de l'API REST Scanyze — auth JWT, API keys, endpoints principaux, exemples curl, Swagger
API REST Scanyze
L'API Scanyze expose 160+ endpoints REST organisés en sections (auth, targets, scans, findings, code, pentest, cloud, dark web, partner, admin). Tous les endpoints sont protégés par JWT ou API key, avec isolation multi-tenant via Row-Level Security PostgreSQL.
URLs de base
| Environnement | URL |
|---|---|
| Production | https://api.scanyze.com/v1 |
| Staging OVH | https://api.scanyze.secuaas.ovh/v1 |
| Dev (interne) | https://api.secuscan.secuaas.dev/v1 |
Le préfixe est /v1 (pas /api/v1). Tous les endpoints documentés ci-dessous sont préfixés implicitement.
Documentation interactive
Swagger UI disponible :
- Production :
https://api.scanyze.com/v1/docs/ - Staging :
https://api.scanyze.secuaas.ovh/v1/docs/
Le fichier OpenAPI 3.0 brut est exposé sur /v1/docs/swagger.json et /v1/docs/swagger.yaml. Disponible plan Starter+ (l'API est désactivée pour les plans Free et Essentiel).
Authentification
JWT (utilisateurs interactifs)
-
Login :
curl -X POST https://api.scanyze.com/v1/auth/login \ -H "Content-Type: application/json" \ -d '{"email":"vous@monentreprise.ca","password":"VotreMotDePasse"}'Réponse :
{ "access_token": "eyJhbGc...", "refresh_token": "eyJhbGc...", "expires_in": 3600, "token_type": "Bearer" } -
Requêtes authentifiées :
curl https://api.scanyze.com/v1/targets \ -H "Authorization: Bearer eyJhbGc..." -
Refresh du token (à expiration) :
curl -X POST https://api.scanyze.com/v1/auth/refresh \ -H "Content-Type: application/json" \ -d '{"refresh_token":"eyJhbGc..."}'
SSO Zitadel (Enterprise)
GET /v1/auth/sso/zitadelRedirige vers auth.secuaas.com pour l'authentification OIDC. À l'issue, le frontend reçoit un code d'autorisation qu'il échange contre des tokens JWT via POST /v1/auth/sso/callback.
API Keys (intégrations programmatiques)
Recommandé pour les scripts, CI/CD, intégrations.
- Créez une clé via
/settings/api-docsouPOST /v1/api-keys(frontend ou API). - Choisissez les scopes :
targets:read/targets:writescans:read/scans:write/scans:launchfindings:read/findings:writecode:read/code:write/code:scanagents:read/agents:writereports:readadmin:*(pour admin endpoints — réservé tenant_admin)
- Copiez la clé immédiatement (affichée une seule fois). Format :
sk_live_xxxxxxxxxxxx. - Utilisation :
curl https://api.scanyze.com/v1/targets \ -H "X-API-Key: sk_live_xxxxxxxxxxxx"
Les API keys peuvent être révoquées à tout moment via /settings/api-docs → bouton Révoquer.
Rate limiting
| Plan | Requêtes / minute | Burst |
|---|---|---|
| Starter | 60 | 100 |
| Pro | 300 | 500 |
| Business | 1 000 | 2 000 |
| Enterprise | 5 000 | 10 000 |
Headers de réponse pour suivre votre consommation :
X-RateLimit-Limit: 300
X-RateLimit-Remaining: 287
X-RateLimit-Reset: 1714398312En cas de dépassement : 429 Too Many Requests avec Retry-After en secondes.
Endpoints principaux
Liste non exhaustive — voir Swagger pour la référence complète. Source : secuscan-api/internal/bootstrap/routes.go.
Targets
| Méthode | Path | Description |
|---|---|---|
GET | /v1/targets | Liste des cibles (filtres : workspaceId, status, riskLevel, search) |
POST | /v1/targets | Créer une cible |
GET | /v1/targets/{id} | Détails d'une cible |
PATCH | /v1/targets/{id} | Mettre à jour |
DELETE | /v1/targets/{id} | Supprimer |
GET | /v1/targets/{id}/assets | Sous-domaines + IP découverts |
GET | /v1/targets/{id}/scans | Scans associés |
GET | /v1/targets/{id}/findings | Findings associés |
GET | /v1/targets/{id}/posture | Score de posture courant |
POST | /v1/targets/{id}/posture | Re-calculer la posture |
GET | /v1/targets/{id}/sbom | SBOM CycloneDX |
GET | /v1/targets/{id}/attack-paths | Liste des attack paths |
GET/POST/POST | /v1/targets/{id}/verify-domain | Statut + déclencher la vérification de domaine |
GET/PATCH | /v1/targets/{id}/schedule | Planification de scans |
Scans
| Méthode | Path | Description |
|---|---|---|
GET | /v1/scans | Liste des scans (filtres : status, target, dates) |
POST | /v1/scans | Lancer un scan (body = ScanConfig) |
GET | /v1/scans/{id} | Détails d'un scan |
DELETE | /v1/scans/{id} | Annuler un scan en cours |
GET | /v1/scans/{id}/findings | Findings du scan |
GET | /v1/scans/{id}/report.pdf | Rapport PDF (exec ou tech selon ?type=) |
GET | /v1/scans/{id}/report.json | Rapport JSON brut |
GET | /v1/scans/{id}/report.md | Rapport Markdown |
GET | /v1/scans/{id}/sbom | SBOM CycloneDX |
Findings
| Méthode | Path | Description |
|---|---|---|
GET | /v1/findings | Liste filtrable (severity, status, target, module, search) |
GET | /v1/findings/{id} | Détails d'un finding |
PATCH | /v1/findings/{id} | Modifier statut, assigné, commentaires |
POST | /v1/findings/{id}/ai-analysis | Lancer une analyse IA (GPU ou Premium selon body) |
GET | /v1/findings/{id}/ai-analysis | Résultat de l'analyse IA |
POST | /v1/findings/{id}/jira | Créer un ticket Jira |
Code
| Méthode | Path | Description |
|---|---|---|
GET | /v1/code/repositories | Liste des repos importés |
POST | /v1/code/repositories | Importer un repo |
POST | /v1/code/scans | Lancer un scan |
GET | /v1/code/scans/{id} | Détails d'un scan |
GET | /v1/code/issues | Liste des findings code |
GET | /v1/code/scans/{id}/sarif | Export SARIF 2.1.0 |
GET | /v1/code/scans/{id}/ai-report/executive.pdf | Rapport AI exécutif |
GET | /v1/code/scans/{id}/ai-report/technical.pdf | Rapport AI technique |
GET | /v1/code/scans/{id}/ai-report/machine.md | Rapport AI machine-readable |
Pentest
| Méthode | Path | Description |
|---|---|---|
POST | /v1/pentest/authorizations | Créer une autorisation |
GET | /v1/pentest/authorizations | Liste des autorisations |
POST | /v1/pentests | Lancer un pentest |
GET | /v1/pentests/{id} | Statut d'un pentest |
POST | /v1/pentests/{id}/pause | Mettre en pause |
POST | /v1/pentests/{id}/stop | Arrêter |
Dark Web
| Méthode | Path | Description |
|---|---|---|
GET | /v1/dark-web/breaches | Breaches détectés |
POST | /v1/dark-web/search | Recherche manuelle |
GET/POST/PATCH/DELETE | /v1/dark-web/providers | CRUD configuration providers |
GET | /v1/dark-web/quota | Status quota par provider |
Cloud
| Méthode | Path | Description |
|---|---|---|
GET/POST/DELETE | /v1/cloud/connectors | CRUD connecteurs (m365, gws, aws, azure, gcp) |
POST | /v1/cloud/connectors/{id}/scan | Lancer un scan |
GET | /v1/cloud/findings | Findings cloud |
AI Credits
| Méthode | Path | Description |
|---|---|---|
GET | /v1/ai-credits/summary | Solde courant + période |
GET | /v1/ai-credits/history | Historique des transactions |
POST | /v1/ai-credits/purchase | Acheter un top-up (redirige vers SecuCFO checkout) |
Notifications (SSE)
GET /v1/notifications/stream
Accept: text/event-stream
Authorization: Bearer eyJhbGc...Stream Server-Sent Events temps réel : nouveaux scans, findings, breaches, alertes quota, etc.
Admin (réservé tenant_admin)
/v1/admin/users— gestion des utilisateurs du tenant/v1/admin/audit— logs d'audit/v1/admin/settings— config tenant
Partner (réservé MSP, voir doc MSP)
/v1/partner/account/v1/partner/tenants/v1/partner/dashboard/v1/partner/billing- ...
Exemples complets
Créer une cible et lancer un scan
# 1. Créer la cible
curl -X POST https://api.scanyze.com/v1/targets \
-H "X-API-Key: sk_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"name": "Site corporatif",
"domain": "monentreprise.ca",
"scanConfig": {
"scanProfile": "gentle",
"scanSubdomains": true,
"portScan": true,
"sslCheck": true,
"vulnScan": true,
"dnsAudit": true,
"emailSecurity": true,
"httpHeaders": true
}
}'
# Réponse: {"id": "uuid", "status": "active", ...}
# 2. Lancer un scan complet
curl -X POST https://api.scanyze.com/v1/scans \
-H "X-API-Key: sk_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"targetId": "uuid-de-la-cible"
}'
# Réponse: {"id": "scan-uuid", "status": "pending", ...}
# 3. Suivre l'avancement (polling)
curl https://api.scanyze.com/v1/scans/scan-uuid \
-H "X-API-Key: sk_live_xxx"
# Réponse: {"status": "running", "progress": 42, ...}
# 4. Une fois completed, récupérer les findings
curl https://api.scanyze.com/v1/scans/scan-uuid/findings \
-H "X-API-Key: sk_live_xxx"
# 5. Télécharger le rapport PDF technique
curl https://api.scanyze.com/v1/scans/scan-uuid/report.pdf?type=technical \
-H "X-API-Key: sk_live_xxx" \
-o rapport-technique.pdfLancer une analyse IA sur un finding
curl -X POST https://api.scanyze.com/v1/findings/finding-uuid/ai-analysis \
-H "X-API-Key: sk_live_xxx" \
-H "Content-Type: application/json" \
-d '{"provider": "gpu"}'
# Réponse: {"jobId": "uuid", "status": "pending"}
# Polling jusqu'à completion
curl https://api.scanyze.com/v1/findings/finding-uuid/ai-analysis \
-H "X-API-Key: sk_live_xxx"
# Réponse: {"status": "completed", "analysis": "...", "creditsConsumed": 1, ...}Codes d'erreur
| Code | Description |
|---|---|
200 | OK |
201 | Created (POST réussi) |
204 | No Content (DELETE réussi) |
400 | Validation error — voir le champ errors |
401 | Auth manquante ou invalide |
403 | Pas la permission ou quota dépassé (champ code: quota_exceeded) |
404 | Ressource introuvable (ou n'appartient pas à votre tenant — RLS) |
409 | Conflit (ex. cible avec ce domaine existe déjà) |
422 | Validation métier échouée (ex. profil aggressive sans domaine vérifié) |
429 | Rate limit dépassé |
500 | Erreur interne |
503 | Service indisponible (ex. SecuTools down — réessayer dans 30s) |
Format d'erreur standard :
{
"error": "validation_error",
"message": "Field 'domain' must be a valid FQDN",
"details": {
"field": "domain",
"value": "not-valid"
},
"request_id": "req_abc123"
}Le request_id permet de retrouver la trace exacte côté Scanyze (utile pour le support).
Webhooks entrants
Pour les intégrations Git (push events) :
POST /v1/webhooks/git/github(HMAC-SHA256 dansX-Hub-Signature-256)POST /v1/webhooks/git/gitlab(token dansX-Gitlab-Token)POST /v1/webhooks/git/bitbucket(UUID dansX-Hook-UUID)POST /v1/webhooks/git/forgejo(HMAC dansX-Forgejo-Signature)POST /v1/webhooks/git/azure(HMAC dansX-Vss-Subscriptionid)
Le secret est généré dans /settings/integrations → onglet Webhooks Git → bouton Régénérer.
SDK clients
Aucun SDK officiel publié pour l'instant. L'API étant standard REST + OpenAPI, vous pouvez générer un client dans votre langage préféré via :
# Exemple : générer un client Go
openapi-generator-cli generate -i https://api.scanyze.com/v1/docs/swagger.json -g go -o ./scanyze-client-go
# Python
openapi-generator-cli generate -i https://api.scanyze.com/v1/docs/swagger.json -g python -o ./scanyze-client-pythonSources de cette page
- Routes :
secuscan-api/internal/bootstrap/routes.go - Handlers : 183 fichiers dans
secuscan-api/internal/api/handlers/ - Swagger : généré via
swaggo/swag— annotations dans le code Go
À jour pour Scanyze v0.130.x.