Integrează-ți sistemul cu 24/24. Toate endpoint-urile sunt sub https://2424.ro. JSON in, JSON out.
După înregistrare/login, primești un accessToken JWT. Include-l în header:
curl -X POST https://2424.ro/api/auth/login \
-H 'Content-Type: application/json' \
-d '{"email":"you@example.com","password":"yourpass"}'
# Pentru orice cerere autenticată:
curl https://2424.ro/api/wallet \
-H 'Authorization: Bearer <accessToken>'200OK — răspuns normal400Bad request — validare eșuată (Zod schema)401Unauthorized — token lipsă/invalid402Payment required — sold insuficient403Forbidden — rol insuficient404Not found409Conflict — resursă deja exista423Locked — portofel suspendat429Too many requests — rate limit500Internal server error300 req/min global, 50 req/15min pentru /api/auth/*. Returnăm 429 cu X-RateLimit-Reset.
| Method | Path | Description |
|---|---|---|
| POST | /register | Creează cont. Body: { email, password, firstName, lastName, accountType } |
| POST | /login | Autentificare. Body: { email, password, totp? }. Returnează { user, accessToken }. |
| POST | /refresh | Reînnoiește accessToken folosind refresh cookie. |
| POST | /logout | Revocă sesiunea curentă. |
| GET | /me | Profil curent. Necesită Bearer token. |
| POST | /2fa/setup | Generează secret + QR pentru 2FA. |
| POST | /2fa/enable | Activează 2FA. Body: { code }. |
| POST | /2fa/backup-codes | Generează 10 coduri de recuperare. |
| POST | /2fa/recovery | Recuperare 2FA. Body: { email, password, backupCode }. |
| POST | /password/forgot | Inițiază resetarea. Body: { email }. |
| POST | /password/reset | Setează parolă nouă. Body: { token, password }. |
| POST | /password/change | Schimbă parola. Body: { currentPassword, newPassword }. |
| Method | Path | Description |
|---|---|---|
| GET | / | Obține portofelul utilizatorului curent. |
| GET | /transactions | Listă tranzacții (?limit=). |
| POST | /topup | Demo top-up. Body: { amountCents, method }. |
| POST | /transfer | Transfer instant. Body: { toEmail, amountCents, note? }. |
| Method | Path | Description |
|---|---|---|
| POST | /intents | Creează PaymentIntent (Stripe dacă STRIPE_SECRET_KEY este setat). |
| GET | /intents | Istoric intent-uri. |
| POST | /webhook | Stripe webhook (raw body, signature verificată). |
| Method | Path | Description |
|---|---|---|
| POST | /search | Body: { origin, destination, passengers, variant?, modes? }. |
| POST | /bookings | Rezervă o cursă. |
| GET | /bookings | Rezervările tale. |
| POST | /bookings/:id/cancel | Anulează. |
| Method | Path | Description |
|---|---|---|
| GET | /specializations | 37 specializări (online/holistic/weight_balance). |
| GET | /practitioners | Listă practicieni verificați. |
| POST | /consultations | Programează o consultație. |
| POST | /bmi | Calculator IMC. Body: { weightKg, heightCm }. |
| Method | Path | Description |
|---|---|---|
| GET | /types | 9 tipuri (RCA, CASCO, sănătate, viață, locuință, călătorie, etc.). |
| POST | /quote | Compară oferte. Body: { type, params }. |
| POST | /policies | Cumpără poliță. |
| GET | /policies | Polițele mele. |
| Method | Path | Description |
|---|---|---|
| * | aprozar, sos, construction, energy, b2b, freight, eu-funds, culture, forum | Fiecare modul are CRUD + endpoint-uri specifice. Vezi sursa. |
| Method | Path | Description |
|---|---|---|
| GET | /notifications | Lista notificărilor mele. |
| POST | /notifications/:id/read | Marcă citită. |
| POST | /notifications/read-all | Marcă toate citite. |
| POST | /push/subscribe | Înregistrează subscription Web Push (VAPID). |
| WS | /ws | Socket.io endpoint. Auth via `auth.token` handshake. Eveniment: `notification`. |
| Method | Path | Description |
|---|---|---|
| POST | /export | Generează export JSON cu toate datele tale. |
| POST | /delete-request | Cere ștergerea contului (30 zile grace). |
| POST | /cancel-deletion | Anulează cererea de ștergere. |
| GET | /requests | Istoric cereri GDPR. |
| Method | Path | Description |
|---|---|---|
| GET | /stats | KPI overview. |
| GET | /revenue-by-module | Venit per modul. |
| GET | /users | Listă utilizatori (search + filter). |
| PATCH | /users/:id | Modifică rol / status / KYC. |
| GET | /transactions | Ultimele 200 tranzacții. |
| POST | /refunds/transactions/:id | Refund (admin only). Body: { reason? }. |
| GET | /audit-log | Audit trail. |
| GET | /email-log | Email log (ultimele 200). |
| POST | /email-log/:id/retry | Retrimite email. |
| GET | /files | Browser global pentru fișierele utilizatorilor. |
Endpoint-uri pentru a primi evenimente platformă (rezervare, plată, KYC) către sistemul tău. Va fi documentat când lansăm OAuth pentru parteneri.