API Reference
Programmatic access to the Portfolio Optimization platform. Build custom integrations, automate optimization workflows, and retrieve results using our REST API.
Base URL
All API endpoints are relative to this base URL
https://api.portfolioopt.inAll requests must be made over HTTPS. HTTP requests will be rejected.
Quick Navigation
Authentication Overview
Two authentication methods are supported depending on your use case
JWT Tokens
Best for web applications and interactive use. Tokens are issued via login and automatically refreshed using secure HTTP-only cookies.
API Keys
Best for server-to-server communication, scripts, and CI/CD pipelines. Scoped keys with fine-grained permissions.
See the Authentication page for complete details on sign-up, login, token refresh, API key creation, and security best practices.
Rate Limiting
Fair-use limits to ensure platform stability for all users
10 req/min20 req/min60 req/min30 req/minWhen a rate limit is exceeded, the API responds with HTTP 429 Too Many Requests. The Retry-After header indicates how many seconds to wait before retrying.
Error Response Format
All error responses follow a consistent JSON structure
When an API request fails, the response body contains a JSON object with a human-readable error message:
{
"detail": "Human-readable error message"
}HTTP Status Codes
400Bad RequestThe request body is malformed or missing required fields401UnauthorizedMissing or invalid authentication credentials403ForbiddenValid credentials but insufficient permissions for the resource404Not FoundThe requested resource does not exist409ConflictThe request conflicts with the current state (e.g., duplicate email)500Internal Server ErrorAn unexpected server-side error occurredSupported Optimization Methods
Pass these enum values in the methods array when submitting an optimization job
MVOClassic Markowitz mean-variance portfolio optimizationMinVolMinimize portfolio volatility regardless of returnsMaxQuadraticUtilityMaximize risk-adjusted utility with quadratic penaltyEquiWeightedUniform allocation across all selected assetsHRPTree-based clustering for robust diversificationMinCVaRMinimize Conditional Value-at-Risk (expected shortfall)MinCDaRMinimize Conditional Drawdown-at-RiskHERCHierarchical Equal Risk ContributionNCONested Clustered OptimizationHERC2Enhanced Hierarchical Equal Risk ContributionCriticalLineAlgorithmExact efficient frontier tracing via CLABenchmarkTrackerMinimize tracking error to a benchmark indexMaximumDiversificationMaximize the portfolio diversification ratioRiskBudgetingTarget equal or custom risk contribution per assetDistributionallyRobustCVaRWorst-case CVaR over Wasserstein uncertainty setStackingOptimizationEnsemble meta-optimizer stacking multiple sub-modelsInverseVolatilityWeights inversely proportional to each asset's volatilitySparseMarkowitzL1L1-regularized Markowitz for sparse, concentrated portfoliosHMMRegimeMVOHidden Markov Model regime-switching mean-varianceBlackLittermanBlack-Litterman with market-implied equilibrium returns and momentum viewsExample usage in request body:
{
"stocks": [
{ "ticker": "RELIANCE", "exchange": "NSE" },
{ "ticker": "TCS", "exchange": "NSE" },
{ "ticker": "HDFCBANK", "exchange": "NSE" },
{ "ticker": "INFY", "exchange": "NSE" }
],
"methods": ["MVO", "HRP", "MinCVaR"],
"benchmark": "nifty"
}The risk-free rate is automatically sourced from India 10-year government bond yields and does not need to be specified in the request.