Base URL: http://localhost:5000/api/v1
Interactive Swagger UI: http://localhost:5000/api/docs
Adding a new endpoint? Read the API Versioning Guide first.
All routes must follow the URI versioning strategy (/api/v{N}/resource).
All protected routes require a Bearer token in the Authorization header:
Authorization: Bearer <access_token>
Register a new user.
{
"email": "farmer@example.com",
"password": "SecurePass123!",
"role": "FARMER",
"full_name": "John Doe",
"phone_number": "+1234567890",
"stellar_address": "GXXX..."
}Response: { access_token, refresh_token, user }
{ "email": "farmer@example.com", "password": "SecurePass123!" }Response: { access_token, refresh_token, user }
{ "refresh_token": "<token>" }Response: { access_token }
Requires Bearer token. Invalidates current session.
Returns all public vaults.
Returns vaults owned by a user.
Returns a single vault by ID.
{ "userId": "uuid", "amount": 500, "idempotencyKey": "optional-key" }{ "userId": "uuid", "amount": 200 }Returns vault-level metrics:
{
"totalVaults": 10,
"activeVaults": 8,
"totalDepositsUsd": 125000,
"totalWithdrawalsUsd": 30000,
"avgUtilizationPct": 72.5
}Returns system-level metrics:
{
"uptimeSeconds": 3600,
"totalApiRequests": 1500,
"totalErrors": 3,
"errorRate": 0.2,
"lastUpdatedAt": "2024-01-01T00:00:00.000Z"
}Returns last sync run results and per-vault drift report.
Manually triggers a state sync run. Returns per-vault reconciliation results.
Query indexed on-chain events. Supports filters: contractId, type, fromLedger, toLedger.
Returns indexer status: enabled, last ledger, total events.
External systems push events to these endpoints. Each request must include an HMAC-SHA256 signature of the raw JSON body in the x-webhook-signature header (sha256=<hex>).
Payment provider confirmation (requires WEBHOOK_PAYMENTS_HMAC_SECRET on the server).
{
"eventId": "evt_unique_123",
"eventType": "payment.confirmed",
"depositId": "uuid",
"transactionHash": "abc123",
"stellarTransactionId": "optional-stellar-tx-id",
"occurredAt": "2026-06-02T10:00:00.000Z"
}eventType may also be payment.failed.
Response: { "accepted": true, "eventId": "...", "duplicate": false }
Chain indexer event ingestion (requires WEBHOOK_CHAIN_EVENTS_HMAC_SECRET on the server).
{
"eventId": "chain_evt_123",
"type": "contract",
"contractId": "CABC...",
"ledger": 12345,
"ledgerClosedAt": "2026-06-02T10:00:00.000Z",
"transactionHash": "tx_hash",
"pagingToken": "paging_token",
"topics": [],
"value": {}
}Returns service health status (DB, Redis connectivity).