API Reference
L'API GB-FiscalAI est une API REST qui permet d'interagir programmatiquement avec le système.
Base URL
https://api.gbfiscalai.srv1164291.hstgr.cloud/api/v1Authentification
Toutes les requêtes (sauf login) nécessitent un token JWT.
Obtenir un Token
bash
curl -X POST /auth/login \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "username=admin@gbfiscalai.gw&password=admin123"Réponse
json
{
"access_token": "eyJhbGciOiJIUzI1NiIs...",
"token_type": "bearer"
}Utiliser le Token
bash
curl -X GET /endpoint \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..."Format des Réponses
Succès
json
{
"data": { ... },
"message": "Success"
}Erreur
json
{
"detail": "Description de l'erreur"
}Liste Paginée
json
{
"items": [ ... ],
"total": 100,
"page": 1,
"size": 20,
"pages": 5
}Codes HTTP
| Code | Signification |
|---|---|
| 200 | Succès |
| 201 | Créé |
| 400 | Requête invalide |
| 401 | Non authentifié |
| 403 | Non autorisé |
| 404 | Non trouvé |
| 422 | Données invalides |
| 500 | Erreur serveur |
Pagination
Les endpoints de liste supportent la pagination:
| Paramètre | Type | Défaut | Description |
|---|---|---|---|
| page | int | 1 | Numéro de page |
| size | int | 20 | Éléments par page |
bash
GET /declarations?page=2&size=50Filtres
Recherche Textuelle
bash
GET /declarations?search=DEC-2026Filtres Spécifiques
bash
GET /declarations?risk_level=high
GET /alerts?status=openRate Limiting
- 100 requêtes par minute par IP
- 1000 requêtes par heure par utilisateur
Endpoints Disponibles
- Authentification - Login, token, profil
- Déclarations - CRUD déclarations
- Alertes - Gestion alertes
- Importateurs - Liste importateurs
- Import - Import CSV/Excel
SDK & Exemples
Python
python
import requests
BASE_URL = "https://api.gbfiscalai.srv1164291.hstgr.cloud/api/v1"
# Login
response = requests.post(
f"{BASE_URL}/auth/login",
data={"username": "admin@gbfiscalai.gw", "password": "admin123"}
)
token = response.json()["access_token"]
# Get declarations
headers = {"Authorization": f"Bearer {token}"}
declarations = requests.get(f"{BASE_URL}/declarations", headers=headers)
print(declarations.json())JavaScript
javascript
const BASE_URL = 'https://api.gbfiscalai.srv1164291.hstgr.cloud/api/v1';
// Login
const loginResponse = await fetch(`${BASE_URL}/auth/login`, {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: 'username=admin@gbfiscalai.gw&password=admin123'
});
const { access_token } = await loginResponse.json();
// Get declarations
const declarations = await fetch(`${BASE_URL}/declarations`, {
headers: { 'Authorization': `Bearer ${access_token}` }
});
console.log(await declarations.json());Support
Pour les questions sur l'API, contactez l'équipe technique.