احراز هویت/api/v1

تحلیلگر پرتفوی

تحلیل تخصیص دارایی و ریسک پرتفوی — نیازمند توکن کاربر.

AI insight card for a user-owned portfolio. Replaces the legacy ai-recommendation endpoint.

Canonical contract: USER_PORTFOLIO_FRONTEND_GUIDE.md · portfolios.md


GET/api/v1/portfolios/{portfolioId}/insights/latest

Auth: Required

Response 200: SuccessResponse<PortfolioInsight> — render data.renderedMarkdown (Persian Markdown).

Response 404: No ready insight yet — show empty state + generate CTA.


POST/api/v1/portfolios/{portfolioId}/insights/refresh

Auth: Required

Response 200: SuccessResponse<InsightRefreshResponse> with jobId, portfolioId, status (typically pending).

Response 422: Insights disabled server-side — hide the refresh button.

Suggested UX: call refresh → poll .../insights/latest every 3–5s until a newer version / createdAt, or timeout.


GET/api/v1/portfolios/{portfolioId}/insights

Insight version history (optional UI).


Deprecated

GET /api/v1/portfolios/{id}/ai-recommendation is not used by the current frontend. Use the insights endpoints above.