Vai al contenuto

๐Ÿ“– API Reference

LibreFolio provides a comprehensive RESTful API built with FastAPI.

๐Ÿ–ฅ๏ธ Interactive Documentation

When the LibreFolio server is running, you can access the auto-generated interactive documentation. These pages allow you to explore the API endpoints, see the expected request/response schemas, and even execute requests directly from your browser.

  • ๐Ÿš€ Swagger UI : Best for exploring and testing endpoints.
  • ๐Ÿ’ป ReDoc: Best for reading the documentation in a structured format.

๐Ÿ”€ Dynamic Route Generation

FastAPI generates the API routes dynamically at startup based on the Python function definitions. This ensures that the documentation is always perfectly in sync with the code.

The API is structured into routers, each handling a specific domain (all mounted under /api/v1 by backend/app/api/v1/router.py):

  • /auth: Authentication (login, token refresh).
  • /users: User management.
  • /settings: User settings, admin-managed global settings, scheduler state/logs, and the cache admin routes (/settings/cache/status, /settings/cache/clear/{name}, /settings/cache/clear-all โ€” see Cache Registry & Admin).
  • /system: Server info and plugin diagnostics (/system/plugin-diagnostics).
  • /uploads: File uploads and media serving.
  • /assets: Asset management (CRUD, price history) โ€” includes /prices, /provider (search, live quotes), /events.
  • /transactions: Transaction management.
  • /brokers: Broker management and sharing โ€” includes /import (BRIM broker report import).
  • /backup: Backup & export.
  • /portfolio: Portfolio analysis and metrics.
  • /fx: Foreign exchange operations โ€” includes /fx/providers and /fx/currencies.
  • /signals: Domain-agnostic signal preview (POST /signals/preview).
  • /risk: Risk analysis โ€” analytics catalog, queries, scenario catalog, and per-asset eligibility for a period (POST /risk/eligibility). The Asset Detail risk view and the What ifโ€ฆ? simulation still carry a beta notice.
  • /ai-export: Versioned AI Export datasets and analyses.
  • /tools: Atomic Tool calculations โ€” catalog, batch compute (POST /tools/compute), and per-process diagnostics; see Tool plugins.
  • /utilities: Reference data (ISO currencies, etc.).

๐Ÿ“‹ Pydantic Schemas

The API uses Pydantic models for data validation and serialization. These schemas define the structure of the data exchanged between the frontend and backend. You can find the schema definitions in the backend/app/schemas/ directory.