API documentation
URL de base : https://api.xp-flightdeck.com/licenses-api/v1
Toujours envoyer Content-Type: application/json pour les requêtes POST.
GET /health
Description : Sonde de santé du service.
Auth : aucune
200
{ "ok": true }
curl -sS https://api.xp-flightdeck.com/licenses-api/v1/health
GET /public-key
Description : Renvoie la clé publique Ed25519 (base64) pour vérifier les signatures des jetons.
Auth : aucune
200
{ "ed25519_public_key_b64": "BASE64..." }
curl -sS https://api.xp-flightdeck.com/licenses-api/v1/public-key
POST /activate
Description : Activer une licence sur un appareil. Vérifie l’état, la propriété par email et le quota d’activations.
En-tête d’auth : X-Client-Token
Champs obligatoires : email, license_key, device_hash, device_name
Corps
{
"email": "pilote@example.com",
"license_key": "ABCD-EF23-GH45",
"device_hash": "sha256-de-lappareil",
"device_name": "Mon PC"
}
{ "token": { "...": "voir Guides", "sig": "..." }, "mode": "full" }
400 licence non liée à cet email · 403 licence désactivée · 404 introuvable · 409 quota atteintcURL
curl -sS -X POST -H "X-Client-Token: $CLIENT_TOKEN" -H "Content-Type: application/json" https://api.xp-flightdeck.com/licenses-api/v1/activate -d '{"email":"pilote@example.com","license_key":"ABCD-EF23-GH45","device_hash":"<sha256>","device_name":"PC"}'
POST /deactivate
Description : Désactiver un appareil pour une licence afin de libérer un slot.
En-tête d’auth : X-Client-Token
Champs obligatoires : license_key_hash, device_hash
Corps
{ "license_key_hash": "<64-hex>", "device_hash": "sha256-de-lappareil" }
{ "message": "device deactivated", "updated": 1, "license_ref": "GH45" }
{ "message": "license disabled", "license_ref": "GH45", "updated": 0 }
404 licence introuvable · 422 format license_key_hash invalidecURL
curl -sS -X POST -H "X-Client-Token: $CLIENT_TOKEN" -H "Content-Type: application/json" https://api.xp-flightdeck.com/licenses-api/v1/deactivate -d '{"license_key_hash":"<64-hex>","device_hash":"<sha256>"}'
POST /admin/licenses
Description : Créer une licence pour un utilisateur. La clé en clair est renvoyée une seule fois.
En-tête d’auth : X-Admin-Token
Champs obligatoires : email, product, edition, max_activations
Champs optionnels : features (liste de chaînes)
Corps
{
"email": "pilote@example.com",
"product": "VotreProduit",
"edition": "Pro",
"max_activations": 3,
"features": ["featA", "featB"]
}
{
"license_key": "ABCD-EF23-GH45",
"max_activations": 3,
"created_at": "2025-09-01T10:00:00Z",
"product": "VotreProduit",
"edition": "Pro",
"features": ["featA","featB"]
}
curl -sS -X POST -H "X-Admin-Token: $ADMIN_TOKEN" -H "Content-Type: application/json" https://api.xp-flightdeck.com/licenses-api/v1/admin/licenses -d '{"email":"pilote@example.com","product":"VotreProduit","edition":"Pro","max_activations":3,"features":["featA","featB"]}'
GET /admin/licenses
Description : Lister les licences avec détails d’activation.
En-tête d’auth : X-Admin-Token
Paramètres de requête (tous facultatifs) : email, product, edition, enabled
200
[{
"license_key_hash": "e3b0c442...64hex",
"license_ref": "GH45",
"email": "pilote@example.com",
"product": "VotreProduit",
"edition": "Pro",
"enabled": true,
"active_devices_count": 1,
"max_activations": 3,
"created_at": "2025-09-01T10:00:00Z",
"activations": [
{ "device_hash":"<sha256>", "device_name":"Mon PC", "deactivated": false, "activated_at": "2025-09-01T10:10:00Z" }
]
}]
curl -sS -H "X-Admin-Token: $ADMIN_TOKEN" "https://api.xp-flightdeck.com/licenses-api/v1/admin/licenses?email=pilote@example.com&enabled=true"
POST /admin/licenses/enable
Description : Activer/désactiver une licence.
En-tête d’auth : X-Admin-Token
Champs obligatoires : license_key, enabled, email
Corps
{ "license_key": "ABCD-EF23-GH45", "enabled": true, "email": "pilote@example.com" }
{ "message": "license enabled", "enabled": true, "license_ref": "GH45" }
{ "message": "already enabled", "enabled": true, "license_ref": "GH45" }
curl -sS -X POST -H "X-Admin-Token: $ADMIN_TOKEN" -H "Content-Type: application/json" https://api.xp-flightdeck.com/licenses-api/v1/admin/licenses/enable -d '{"license_key":"ABCD-EF23-GH45","enabled":true,"email":"pilote@example.com"}'
POST /admin/deactivate-device
Description : Forcer la désactivation d’un appareil pour une licence (override admin).
En-tête d’auth : X-Admin-Token
Champs obligatoires : license_key, device_hash, email
Corps
{ "license_key": "ABCD-EF23-GH45", "device_hash": "<sha256>", "email": "pilote@example.com" }
{ "message": "device deactivated", "updated": 1, "license_ref": "GH45" }
curl -sS -X POST -H "X-Admin-Token: $ADMIN_TOKEN" -H "Content-Type: application/json" https://api.xp-flightdeck.com/licenses-api/v1/admin/deactivate-device -d '{"license_key":"ABCD-EF23-GH45","device_hash":"<sha256>","email":"pilote@example.com"}'