Points de terminaison de l'API REST

Spécification complète de l'API pour la vérification des licences, l'authentification et les points de terminaison de heartbeat.

Vue d'ensemble

URL de base : https://iamgravity.eu/api

Tous les points de terminaison acceptent et renvoient du JSON. Authentification par jeton Bearer (le jeton de session obtenu à la connexion).

API de licence

Vérifier la licence

POST /license/verify

POST /api/license/verify
Content-Type: application/json

{
  "licenseKey": "GRAV-XXXX-XXXX-XXXX-XXXX",
  "machineId": "sha256-hash",
  "machineName": "DESKTOP-ABC123",
  "appVersion": "1.2.3"
}

Réponse :

{
  "valid": true,
  "license": { "plan": "Pro", "maxMachines": 3, "expiresAt": "..." },
  "machine": { "id": "...", "name": "...", "activatedAt": "..." },
  "gracePeriodDays": 7
}

List Activations (Admin)

GET /api/license/activations?licenseKey=... - Requires admin API key

Revoke Machine (Admin)

DELETE /api/license/activations/{machineId}?licenseKey=... - Requires admin API key

API d'authentification

Connexion

POST /api/auth/login

POST /api/auth/login
Content-Type: application/json

{
  "email": "[email protected]",
  "password": "...",
  "machineId": "sha256-hash",
  "machineName": "DESKTOP-ABC123",
  "appVersion": "1.2.3"
}

Réponse :

{
  "sessionToken": "eyJhbGciOiJIUzI1NiIs...",
  "expiresAt": "2025-01-15T10:30:00Z",
  "license": { "plan": "Pro", "maxMachines": 3 }
}

Déconnexion

POST /api/auth/logout - Requires Authorization: Bearer {sessionToken}

API de heartbeat

Envoyer un heartbeat

POST /api/auth/heartbeat - Requires Authorization: Bearer {sessionToken}

POST /api/auth/heartbeat
Authorization: Bearer {sessionToken}
Content-Type: application/json

{
  "machineId": "sha256-hash",
  "appVersion": "1.2.3"
}

Réponse :

{
  "valid": true,
  "license": { "plan": "Pro", "maxMachines": 3 },
  "serverTime": "2025-01-15T10:30:00Z"
}