{"openapi":"3.1.0","info":{"title":"Breeze API","description":"A comprehensive API for managing yield farming operations, funds, and user authentication","contact":{"name":"Breeze Team","email":"support@breeze.com"},"license":{"name":"Proprietary","url":"https://breeze.com/license"},"version":"1.0.0"},"servers":[{"url":"http://localhost:8080","description":"Local development server"},{"url":"https://api.breeze.com","description":"Production server"}],"paths":{"/admin/agent/metrics":{"get":{"tags":["Admin"],"operationId":"get_agent_metrics","responses":{"200":{"description":"Global and per-asset metrics for tracked agents aggregated from agent_data.tokens and user_fund","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminAgentMetricsResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/admin/assign-fund-to-organization":{"post":{"tags":["Admin"],"operationId":"assign_fund_to_organization","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiAssignFundToOrganization"}}},"required":true},"responses":{"200":{"description":"Fund assigned to partner successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiAssignFundOperationResult"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/admin/close-fund/{fund_id}":{"post":{"tags":["Admin"],"operationId":"close_fund","parameters":[{"name":"fund_id","in":"path","description":"Fund ID to close","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Close fund job submitted successfully"},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/admin/create-fund":{"post":{"tags":["Admin"],"operationId":"process_create_fund","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiCreateFundRequest"}}},"required":true},"responses":{"200":{"description":"Fund created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateFundApiResult"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/admin/create-selective-yield-sources":{"post":{"tags":["Admin"],"operationId":"create_selective_yield_sources","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiSelectiveYieldSources"}}},"required":true},"responses":{"200":{"description":"selective yield sources created successfully"},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/admin/delete-empty-strategy":{"post":{"tags":["Admin"],"operationId":"delete_empty_strategy","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiInputForDeletingEmptyStrategy"}}},"required":true},"responses":{"200":{"description":"Strategy deleted successfully"},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/admin/delete-strategy-template":{"post":{"tags":["Admin"],"operationId":"delete_strategy_template","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiInputForDeletingStrategy"}}},"required":true},"responses":{"200":{"description":"Strategy template deleted successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiDeleteStrategyOperationResult"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/admin/funds":{"get":{"tags":["Admin"],"operationId":"list_all_funds","responses":{"200":{"description":"All funds retrieved successfully","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AdminFundListItem"}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]},"post":{"tags":["Admin"],"operationId":"create_fund_admin","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiCreateFundRequest"}}},"required":true},"responses":{"200":{"description":"Fund created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateFundApiResult"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/admin/funds/{fund_id}":{"get":{"tags":["Admin"],"operationId":"get_fund_detail","parameters":[{"name":"fund_id","in":"path","description":"Fund ID","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Fund detail retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminFundDetail"}}}},"404":{"description":"Fund not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]},"put":{"tags":["Admin"],"operationId":"update_fund_admin","parameters":[{"name":"fund_id","in":"path","description":"Fund ID","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiUpdateFundAdminRequest"}}},"required":true},"responses":{"200":{"description":"Fund updated successfully"},"404":{"description":"Fund not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/admin/funds/{fund_id}/metrics":{"get":{"tags":["Admin"],"operationId":"get_fund_metrics","parameters":[{"name":"fund_id","in":"path","description":"Fund ID","required":true,"schema":{"type":"string"}},{"name":"start_timestamp","in":"query","description":"Start timestamp for metrics range (ISO 8601 format)","required":true,"schema":{"type":"string"}},{"name":"end_timestamp","in":"query","description":"End timestamp for metrics range (ISO 8601 format)","required":true,"schema":{"type":"string"}},{"name":"aggregation_window","in":"query","description":"Aggregation window (e.g., '1h', '1d', '7d', '30d') - defaults to '1d'","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Fund metrics retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiFundMetricsResponse"}}}},"400":{"description":"Invalid parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Fund not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/admin/funds/{fund_id}/rebalance-history":{"get":{"tags":["Admin"],"operationId":"get_fund_rebalance_history_admin","parameters":[{"name":"fund_id","in":"path","description":"Fund ID","required":true,"schema":{"type":"string"}},{"name":"per_page","in":"query","description":"Limit of records to return","required":true,"schema":{"type":"integer","format":"int64","minimum":0}},{"name":"page","in":"query","description":"Offset of records to return","required":true,"schema":{"type":"integer","format":"int64","minimum":0}},{"name":"include_failed","in":"query","description":"Include failed rebalance history","required":true,"schema":{"type":"boolean"}}],"responses":{"200":{"description":"Fund rebalance history retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResponse"}}}},"404":{"description":"Fund not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/admin/jobs/{job_id}/cancel":{"post":{"tags":["Admin"],"operationId":"cancel_job","parameters":[{"name":"job_id","in":"path","description":"Job ID to cancel","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Job cancelled successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiCancelJobResult"}}}},"400":{"description":"Job cannot be cancelled (already completed, failed, or cancelled)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Job not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/admin/jobs/{job_id}/retry":{"post":{"tags":["Admin"],"operationId":"retry_job","parameters":[{"name":"job_id","in":"path","description":"Job ID to retry","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Job queued for retry successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiRetryJobResult"}}}},"400":{"description":"Job cannot be retried (not in failed or cancelled state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Job not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/admin/list-admin-jobs":{"get":{"tags":["Admin"],"operationId":"list_all_admin_jobs","parameters":[{"name":"page","in":"query","description":"Page number for pagination (default: 1)","required":false,"schema":{"type":"integer","format":"int32","minimum":0}},{"name":"per_page","in":"query","description":"Items per page (default: 20, max: 100)","required":false,"schema":{"type":"integer","format":"int32","minimum":0}}],"responses":{"200":{"description":"Admin jobs retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResponse"}}}},"400":{"description":"Invalid query parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/admin/metrics":{"get":{"tags":["Admin"],"operationId":"get_metrics","parameters":[{"name":"start_timestamp","in":"query","description":"Start timestamp for metrics range (ISO 8601 format)","required":true,"schema":{"type":"string"}},{"name":"end_timestamp","in":"query","description":"End timestamp for metrics range (ISO 8601 format)","required":true,"schema":{"type":"string"}},{"name":"aggregation_window","in":"query","description":"Aggregation window (e.g., '1h', '1d', '7d', '30d') - defaults to '30d'","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Platform metrics retrieved successfully (same format as strategy/metrics)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminMetricsResponse"}}}},"400":{"description":"Invalid parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/admin/migrate-org-to-strategy":{"post":{"tags":["Admin"],"operationId":"migrate_org_to_strategy","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiInputForMigratingToStrategy"}}},"required":true},"responses":{"200":{"description":"Strategy migrated org to strategy successfully"},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/admin/org-fund-access":{"get":{"tags":["Admin"],"operationId":"get_org_fund_access","responses":{"200":{"description":"Organization fund access records retrieved successfully","content":{"application/json":{"schema":{"type":"array","items":{}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/admin/organizations":{"get":{"tags":["Admin"],"operationId":"get_organizations","responses":{"200":{"description":"All organizations retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminOrganizationsResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]},"post":{"tags":["Admin"],"operationId":"create_organization_admin","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateOrganizationRequest"}}},"required":true},"responses":{"200":{"description":"Organization created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateOrganizationResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/admin/organizations/{org_id}":{"get":{"tags":["Admin"],"operationId":"get_organization_detail_handler","parameters":[{"name":"org_id","in":"path","description":"Organization ID","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Organization details retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminOrganizationDetailResponse"}}}},"404":{"description":"Organization not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]},"put":{"tags":["Admin"],"operationId":"update_organization_admin","parameters":[{"name":"org_id","in":"path","description":"Organization ID","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiUpdateOrganizationAdminRequest"}}},"required":true},"responses":{"200":{"description":"Organization updated successfully"},"404":{"description":"Organization not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/admin/organizations/{org_id}/invites":{"post":{"tags":["Admin"],"operationId":"create_organization_invite","parameters":[{"name":"org_id","in":"path","description":"Organization ID","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateOrganizationInviteRequest"}}},"required":true},"responses":{"200":{"description":"Invitation created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateOrganizationInviteResponse"}}}},"400":{"description":"Bad request - invalid email or role","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Organization not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/admin/organizations/{org_id}/invites/{invite_id}/revoke":{"post":{"tags":["Admin"],"operationId":"revoke_organization_invite","parameters":[{"name":"org_id","in":"path","description":"Organization ID","required":true,"schema":{"type":"string"}},{"name":"invite_id","in":"path","description":"Invitation ID to revoke","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RevokeOrganizationInviteRequest"}}},"required":true},"responses":{"200":{"description":"Invitation revoked successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RevokeOrganizationInviteResponse"}}}},"404":{"description":"Organization or invitation not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/admin/overview":{"get":{"tags":["Admin"],"operationId":"get_overview","responses":{"200":{"description":"Platform overview with all metrics","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlatformSummary"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/admin/strategies":{"get":{"tags":["Admin"],"operationId":"list_all_strategies","responses":{"200":{"description":"All strategies retrieved successfully","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AdminStrategyListItem"}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/admin/strategies/{strategy_id}":{"get":{"tags":["Admin"],"operationId":"get_strategy_detail","parameters":[{"name":"strategy_id","in":"path","description":"Strategy ID","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Strategy detail retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminStrategyDetail"}}}},"404":{"description":"Strategy not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]},"put":{"tags":["Admin"],"operationId":"update_strategy_admin","parameters":[{"name":"strategy_id","in":"path","description":"Strategy ID","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiInputForUpdatingStrategyInstance"}}},"required":true},"responses":{"200":{"description":"Strategy updated successfully"},"404":{"description":"Strategy not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]},"delete":{"tags":["Admin"],"operationId":"delete_strategy_admin","parameters":[{"name":"strategy_id","in":"path","description":"Strategy ID","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Strategy deleted successfully"},"400":{"description":"Strategy has funds and cannot be deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Strategy not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/admin/strategies/{strategy_id}/close-funds":{"post":{"tags":["Admin"],"operationId":"close_strategy_funds_admin","parameters":[{"name":"strategy_id","in":"path","description":"Strategy ID to close all funds for","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Close fund jobs submitted successfully for all funds in strategy"},"404":{"description":"Strategy not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/admin/strategies/{strategy_id}/metrics":{"get":{"tags":["Admin"],"operationId":"get_strategy_metrics","parameters":[{"name":"strategy_id","in":"path","description":"Strategy ID","required":true,"schema":{"type":"string"}},{"name":"start_timestamp","in":"query","description":"Start timestamp for metrics range (ISO 8601 format)","required":true,"schema":{"type":"string"}},{"name":"end_timestamp","in":"query","description":"End timestamp for metrics range (ISO 8601 format)","required":true,"schema":{"type":"string"}},{"name":"aggregation_window","in":"query","description":"Aggregation window (e.g., '1h', '1d', '7d', '30d') - defaults to '1d'","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Strategy metrics retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiStrategyMetricUniversal"}}}},"400":{"description":"Invalid parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Strategy not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/admin/templates":{"get":{"tags":["Admin"],"operationId":"get_templates","responses":{"200":{"description":"Strategy templates retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Vec"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/admin/unassign-fund-to-organization":{"post":{"tags":["Admin"],"operationId":"unassign_fund_to_organization","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiUnAssignFundFromOrganization"}}},"required":true},"responses":{"200":{"description":"Fund assigned to partner successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiAssignFundOperationResult"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/admin/update-fund":{"post":{"tags":["Admin"],"operationId":"update_fund","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiFundUpdateRequest"}}},"required":true},"responses":{"200":{"description":"Fund constraints updated successfully"},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/admin/update-fund-delegated-withdrawer":{"post":{"tags":["Admin"],"operationId":"update_fund_delegated_withdrawer","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiUpdateFundDelegatedWithdrawerRequest"}}},"required":true},"responses":{"200":{"description":"Fund delegated withdrawer update job submitted successfully"},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/admin/update-fund-fees":{"post":{"tags":["Admin"],"operationId":"update_fund_fees","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiFundFees"}}},"required":true},"responses":{"200":{"description":"Fund fees updated successfully"},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/admin/update-fund-rebalance-settings":{"post":{"tags":["Admin"],"operationId":"update_fund_rebalance_settings","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiFundRebalanceSettings"}}},"required":true},"responses":{"200":{"description":"Fund rebalance settings updated successfully"},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/admin/update-org-tags":{"post":{"tags":["Admin"],"operationId":"update_organization_tags","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiUpdateOrganizationTagsInputs"}}},"required":true},"responses":{"200":{"description":"Organization tags updated successfully"},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/admin/update-selective-yield-sources":{"post":{"tags":["Admin"],"operationId":"update_selective_yield_sources","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiInputForUpdatingSelectiveYieldSource"}}},"required":true},"responses":{"200":{"description":"selective yield sources updated successfully"},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/admin/update-strategy-template":{"put":{"tags":["Admin"],"operationId":"update_strategy_template","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiInputForUpdatingStrategy"}}},"required":true},"responses":{"200":{"description":"Strategy template updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiCreateStrategyTemplateResult"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/admin/yield-sources":{"get":{"tags":["Admin"],"operationId":"get_yield_sources","responses":{"200":{"description":"Yield sources grouped by asset retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminYieldSourcesResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/assets/apy":{"post":{"tags":["Yield Sources"],"summary":"Get maximum APY for a list of asset mints","operationId":"get_assets_apy","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssetsApyRequest"}}},"required":true},"responses":{"200":{"description":"Maximum APY for the given mints","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssetsApyResponse"}}}},"400":{"description":"Invalid request - mints array is required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/deposit/ix":{"post":{"tags":["Deposits"],"operationId":"process_for_deposit_with_instruction","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StructuredInputForDeposit"}}},"required":true},"responses":{"200":{"description":"Deposit instruction prepared successfully"},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"api_key":[]}]}},"/deposit/tx":{"post":{"tags":["Deposits"],"operationId":"process_for_deposit_with_transaction","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StructuredInputForDeposit"}}},"required":true},"responses":{"200":{"description":"Deposit transaction prepared successfully"},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"api_key":[]}]}},"/fund/{fund_id}":{"get":{"tags":["Funds"],"operationId":"get_fund","parameters":[{"name":"fund_id","in":"path","description":"Fund identifier","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Fund retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiFund"}}}},"404":{"description":"Fund not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/fund/{fund_id}/apy":{"get":{"tags":["Funds"],"operationId":"get_fund_apy","parameters":[{"name":"fund_id","in":"path","description":"Fund identifier","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Fund APY retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/f64"}}}},"404":{"description":"Fund not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/fund/{fund_id}/fees":{"get":{"tags":["Funds"],"operationId":"get_fund_fees","parameters":[{"name":"fund_id","in":"path","description":"Fund identifier","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Fund fees retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Option"}}}},"404":{"description":"Fund not found or no fees configured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/fund/{fund_id}/metrics":{"get":{"tags":["Funds"],"operationId":"get_fund_metrics","parameters":[{"name":"start_timestamp","in":"query","description":"Start timestamp for metrics range (ISO 8601 format)","required":true,"schema":{"type":"string"}},{"name":"end_timestamp","in":"query","description":"End timestamp for metrics range (ISO 8601 format)","required":true,"schema":{"type":"string"}},{"name":"aggregation_window","in":"query","description":"Optional aggregation window (e.g., '1h', '1d', '5m') - if not provided, database will choose optimal window","required":false,"schema":{"type":"string"}},{"name":"fund_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Fund metrics retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiFundMetrics"}}}},"400":{"description":"Invalid time range","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Fund not found or no data available","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/fund/{fund_id}/rebalance-history":{"get":{"tags":["Funds"],"operationId":"get_fund_rebalance_history","parameters":[{"name":"per_page","in":"query","description":"Limit of records to return","required":true,"schema":{"type":"integer","format":"int64","minimum":0}},{"name":"page","in":"query","description":"Offset of records to return","required":true,"schema":{"type":"integer","format":"int64","minimum":0}},{"name":"include_failed","in":"query","description":"Include failed rebalance history","required":true,"schema":{"type":"boolean"}},{"name":"fund_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Fund rebalance history retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResponse"}}}},"404":{"description":"Fund not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/funds":{"get":{"tags":["Organization Funds"],"operationId":"get_organization_funds","responses":{"200":{"description":"Organization funds retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationFundsResponse"}}}},"403":{"description":"Organization access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/global-config":{"get":{"tags":["Global Config"],"summary":"Get the global configuration","operationId":"get_global_config","responses":{"200":{"description":"Global configuration retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GlobalConfigResponse"}}}},"404":{"description":"Global configuration not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/global-config/supported-assets":{"get":{"tags":["Global Config"],"summary":"Get only the supported base assets from global configuration","operationId":"get_supported_assets","responses":{"200":{"description":"Supported assets retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SupportedAssetsResponse"}}}},"404":{"description":"Global configuration not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/global-config/supported-assets-by-venue":{"get":{"tags":["Global Config"],"summary":"Get supported base assets grouped by venue.","operationId":"get_supported_assets_by_venue","responses":{"200":{"description":"Supported assets by venue retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SupportedAssetsByVenueResponse"}}}},"404":{"description":"Global configuration not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/needs-onboarding":{"get":{"tags":["Organization"],"operationId":"needs_onboarding","responses":{"200":{"description":"Returns whether the organization needs onboarding (has no strategies)","content":{"text/plain":{"schema":{"type":"boolean"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/organization/api-keys":{"get":{"tags":["Organization API Keys"],"operationId":"get_organization_api_keys","responses":{"200":{"description":"Organization API keys retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyListResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]},"post":{"tags":["Organization API Keys"],"operationId":"create_organization_api_key","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PortalCreateApiKeyRequest"}}},"required":true},"responses":{"200":{"description":"API key created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyCreatedResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/organization/api-keys/{api_key_id}":{"put":{"tags":["Organization API Keys"],"operationId":"update_organization_api_key","parameters":[{"name":"api_key_id","in":"path","description":"API key identifier","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PortalUpdateApiKeyRequest"}}},"required":true},"responses":{"200":{"description":"API key updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKey"}}}},"403":{"description":"Access denied - API key belongs to different organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"API key not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]},"delete":{"tags":["Organization API Keys"],"operationId":"delete_organization_api_key","parameters":[{"name":"api_key_id","in":"path","description":"API key identifier","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"API key deleted successfully"},"403":{"description":"Access denied - API key belongs to different organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"API key not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/organization/create-strategy-template":{"post":{"tags":["Strategies"],"operationId":"create_new_strategy_template","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiInputForCreatingStrategy"}}},"required":true},"responses":{"200":{"description":"Strategy created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiCreateStrategyTemplateResult"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/organization/create-strategy/{organization_id}":{"post":{"tags":["Strategies"],"operationId":"create_new_strategy","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiInputForInitializingStrategy"}}},"required":true},"responses":{"200":{"description":"Fund created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateStrategyApiResult"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/organization/fund-requests":{"get":{"tags":["Funds"],"operationId":"get_organization_request_funds","responses":{"200":{"description":"Fund requests retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiFundRequestListResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/organization/fund-resolver":{"post":{"tags":["Funds"],"operationId":"fund_resolver","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiInputForFundResolver"}}},"required":true},"responses":{"200":{"description":"Fund requested successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiFundResolverResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/organization/get-job-status":{"get":{"tags":["Admin"],"operationId":"get_job_status","parameters":[{"name":"task_id","in":"query","description":"Task ID","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Fund job status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiJobStatus"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/organization/get-selective-yield-sources":{"post":{"tags":["Selective Yield Sources"],"operationId":"get_selective_yield_sources","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiInputToGetSelectiveYieldSources"}}},"required":true},"responses":{"200":{"description":"selective yield sources fetched successfully"},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/organization/get-strategy":{"post":{"tags":["Strategy"],"operationId":"get_strategy_template_by_tags","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiInputForGetStrategyByTags"}}},"required":true},"responses":{"200":{"description":"Strategy template requests retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Vec"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/organization/request-fund":{"post":{"tags":["Funds"],"operationId":"request_new_fund","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiInputsForRequestingFund"}}},"required":true},"responses":{"200":{"description":"Fund requested successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiFundRequest"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/organization/settings":{"put":{"tags":["Organization Settings"],"operationId":"update_organization_settings","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiUpdateOrganizationSettingsRequest"}}},"required":true},"responses":{"200":{"description":"Organization settings updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiOrganizationSettingsResponse"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Organization access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]},"post":{"tags":["Organization Settings"],"operationId":"get_organization_settings","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiGetRequestBasedOrgTagsInput"}}},"required":true},"responses":{"200":{"description":"Organization settings retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiOrganizationSettingsResponse"}}}},"404":{"description":"Organization not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/organization/stats":{"get":{"tags":["fund"],"operationId":"get_organization_stats","responses":{"200":{"description":"Organization stats retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiOrganizationFundStats"}}}}}}},"/organization/strategies":{"get":{"tags":["Strategies"],"operationId":"get_organization_strategies","responses":{"200":{"description":"Strategies with list metrics retrieved successfully","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/StrategyWithListMetrics"}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/organization/{organization_id}/strategies":{"get":{"tags":["Strategies"],"operationId":"get_strategies","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Strategies with metrics retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Vec"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Organization not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/strategy-available-assets":{"get":{"tags":["Strategies"],"summary":"Get available strategy assets with their yield sources","operationId":"get_strategy_available_assets","responses":{"200":{"description":"Available strategy assets with yield sources retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StrategyAvailableAssetsResponse"}}}},"404":{"description":"Global configuration not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/strategy/apy":{"get":{"tags":["Strategies"],"operationId":"get_strategy_apy","parameters":[{"name":"all","in":"query","description":"To calculate combined apy for all the strategy belongs to an org","required":true,"schema":{"type":"boolean"}},{"name":"strategy_id","in":"query","description":"To calculate apy of a single strategy","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Strategy apy retrieved successfully"},"404":{"description":"Strategy not found or no data available","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/strategy/close-funds":{"post":{"tags":["Strategies"],"operationId":"close_strategy_funds","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiCloseStrategyFundsRequest"}}},"required":true},"responses":{"200":{"description":"Close fund jobs submitted successfully for all funds in strategy"},"400":{"description":"Invalid strategy id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Organization access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Strategy not found or access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/strategy/metrics":{"get":{"tags":["Strategies"],"operationId":"get_strategy_metrics","parameters":[{"name":"time_frame","in":"query","description":"Simplified time selector: '24h', '7d', '30d', 'all'. Backend derives start/end/aggregation automatically. Takes precedence over legacy params.","required":false,"schema":{"type":"string"}},{"name":"all","in":"query","description":"To calculate full overview metrics or calculate individual metrics","required":true,"schema":{"type":"boolean"}},{"name":"strategy_id","in":"query","description":"Strategy id for getting single strategy metrics","required":false,"schema":{"type":"string"}},{"name":"start_timestamp","in":"query","description":"Legacy: ISO 8601 start. Use time_frame instead.","required":false,"schema":{"type":"string"}},{"name":"end_timestamp","in":"query","description":"Legacy: ISO 8601 end. Use time_frame instead.","required":false,"schema":{"type":"string"}},{"name":"aggregation_window","in":"query","description":"Legacy: aggregation window. Use time_frame instead.","required":false,"schema":{"type":"string"}},{"name":"all_time","in":"query","description":"Legacy: fetch full history. Use time_frame='all' instead.","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"description":"Strategy metrics retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiStrategyMetricUniversal"}}}},"400":{"description":"Invalid time range","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Fund not found or no data available","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/strategy/metrics/current-data":{"get":{"tags":["Strategies"],"summary":"Returns current aggregate metrics (TVL, deposits, fees, yield, per-protocol breakdowns)\nfor all or a single strategy belonging to the authenticated organization.","description":"All monetary values are returned in USD. Fee amounts are converted from raw token units\nusing per-fund decimals and current asset prices.","operationId":"get_strategy_current_data_for_metric","parameters":[{"name":"all","in":"query","description":"To get combied current data for all the strategy that belongs to an org","required":true,"schema":{"type":"boolean"}},{"name":"strategy_id","in":"query","description":"Strategy id for getting current data of an individual strategy","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Strategy current data retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiStrategyMetricCurrentData"}}}},"404":{"description":"Strategy not found or no data available","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/strategy/strategy-latest-top-rebalance-history":{"get":{"tags":["Strategies"],"operationId":"get_strategy_latest_rebalance_history","parameters":[{"name":"all","in":"query","description":"To include all organization strategies to get the latest top 5 rebalance hisotry of the highest allocated fund per base asset","required":true,"schema":{"type":"boolean"}},{"name":"strategy_id","in":"query","description":"To inlcude only a particular strategy to get the latest top 5 rebalance hisotry of the highest allocated fund per base asset","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Strategy latest rebalance history retrieved successfully","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"array","items":{"$ref":"#/components/schemas/ApiRebalanceHistory"}},"propertyNames":{"type":"string"}}}}},"404":{"description":"Strategy not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/strategy/update-delegated-withdrawer":{"post":{"tags":["Strategies"],"operationId":"update_withdraw_delegate_authority","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiUpdateStrategyDelegatedWithdrawerRequest"}}},"required":true},"responses":{"200":{"description":"Delegated withdrawer update jobs submitted successfully"},"400":{"description":"Invalid strategy or delegated withdrawer pubkey","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Organization access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Strategy not found or access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/strategy/{strategy_id}":{"get":{"tags":["Strategies"],"operationId":"get_strategy","parameters":[{"name":"strategy_id","in":"path","description":"Strategy identifier","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Strategy with detailed metrics retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StrategyDetailResponse"}}}},"404":{"description":"Strategy not found or access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]},"put":{"tags":["Strategies"],"operationId":"update_strategy","parameters":[{"name":"strategy_id","in":"path","description":"Strategy identifier","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiInputForUpdatingStrategyInstance"}}},"required":true},"responses":{"200":{"description":"Strategy updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StrategyInstance"}}}},"404":{"description":"Strategy not found or access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/strategy/{strategy_id}/metrics-old":{"get":{"tags":["Strategies"],"operationId":"get_strategy_metrics_old","parameters":[{"name":"start_timestamp","in":"query","description":"Start timestamp for metrics range (ISO 8601 format)","required":true,"schema":{"type":"string"}},{"name":"end_timestamp","in":"query","description":"End timestamp for metrics range (ISO 8601 format)","required":true,"schema":{"type":"string"}},{"name":"aggregation_window","in":"query","description":"Optional aggregation window (e.g., '1h', '1d', '5m') - if not provided, database will choose optimal window","required":false,"schema":{"type":"string"}},{"name":"strategy_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Strategy metrics retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiStrategyMetrics"}}}},"400":{"description":"Invalid time range","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Fund not found or no data available","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/template/{template_id}":{"get":{"tags":["Strategies"],"operationId":"get_template","parameters":[{"name":"template_id","in":"path","description":"Strategy template identifier","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Strategy template retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiStrategyTemplate"}}}},"404":{"description":"Template not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/user-balances/{fund_user}":{"get":{"tags":["User Data"],"operationId":"get_user_balances","parameters":[{"name":"fund_user","in":"path","description":"Fund user identifier","required":true,"schema":{"type":"string"}},{"name":"asset","in":"query","description":"Filter by specific asset","required":false,"schema":{"type":"string"}},{"name":"sort_by","in":"query","description":"Sort by balance","required":false,"schema":{"type":"string"}},{"name":"sort_order","in":"query","description":"Sort order: 'asc' or 'desc'","required":false,"schema":{"type":"string"}},{"name":"page","in":"query","description":"Page number","required":false,"schema":{"type":"integer","format":"int32","minimum":0}},{"name":"limit","in":"query","description":"Items per page","required":false,"schema":{"type":"integer","format":"int32","minimum":0}}],"responses":{"200":{"description":"User balances retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"api_key":[]}]}},"/user-yield/{fund_user}":{"get":{"tags":["User Data"],"operationId":"get_user_yield","parameters":[{"name":"fund_user","in":"path","description":"Fund user identifier","required":true,"schema":{"type":"string"}},{"name":"fund_id","in":"query","description":"Filter by specific fund","required":false,"schema":{"type":"string"}},{"name":"page","in":"query","description":"Page number","required":false,"schema":{"type":"integer","format":"int32","minimum":0}},{"name":"limit","in":"query","description":"Items per page","required":false,"schema":{"type":"integer","format":"int32","minimum":0}}],"responses":{"200":{"description":"User yield data retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"api_key":[]}]}},"/withdraw/ix":{"post":{"tags":["Withdrawals"],"operationId":"process_for_withdraw_with_instruction","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StructuredInputForWithdraw"}}},"required":true},"responses":{"200":{"description":"Withdraw instruction prepared successfully"},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"api_key":[]}]}},"/withdraw/tx":{"post":{"tags":["Withdrawals"],"operationId":"process_for_withdraw_with_transaction","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StructuredInputForWithdraw"}}},"required":true},"responses":{"200":{"description":"Withdraw transaction prepared successfully"},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"api_key":[]}]}},"/yield-source/{yield_source_id}":{"get":{"tags":["Yield Sources"],"summary":"Get a specific yield source by its ID with basic stats","operationId":"get_yield_source","parameters":[{"name":"yield_source_id","in":"path","description":"Yield source identifier","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Yield source retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/YieldSourceResponse"}}}},"404":{"description":"Yield source not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}},"/yield-sources":{"get":{"tags":["Yield Sources"],"summary":"Get yield sources with optional base asset filter and pagination","operationId":"get_yield_sources","parameters":[{"name":"base_asset","in":"query","description":"Base asset identifier to filter by (e.g., USDC, SOL, ETH)","required":false,"schema":{"type":"string"}},{"name":"page","in":"query","description":"Page number for pagination (default: 1)","required":false,"schema":{"type":"integer","format":"int32","minimum":0}},{"name":"per_page","in":"query","description":"Items per page (default: 20, max: 100)","required":false,"schema":{"type":"integer","format":"int32","minimum":0}}],"responses":{"200":{"description":"Yield sources retrieved successfully grouped by protocol","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResponse"}}}},"400":{"description":"Invalid query parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"bearer_auth":[]}]}}},"components":{"schemas":{"AddAssetsToStrategyApiResult":{"type":"object","required":["task_id","status","message"],"properties":{"message":{"type":"string"},"status":{"type":"string"},"task_id":{"type":"string"}}},"AdminAgentAssetMetrics":{"type":"object","required":["mint","deposit_interactions","withdraw_interactions","deposits","withdrawals","user_fund_deposits"],"properties":{"deposit_interactions":{"type":"integer","format":"int64","description":"Sum of agent deposit interactions for this asset","minimum":0},"deposits":{"type":"integer","description":"Sum of tracked agent deposit amounts for this asset from `agent_data.tokens[*].deposits`","minimum":0},"mint":{"type":"string","description":"Asset mint address"},"user_fund_deposits":{"type":"integer","description":"Sum of `user_fund.deposit` for tracked agents for this asset","minimum":0},"withdraw_interactions":{"type":"integer","format":"int64","description":"Sum of agent withdraw interactions for this asset","minimum":0},"withdrawals":{"type":"integer","description":"Sum of tracked agent withdraw amounts for this asset from `agent_data.tokens[*].withdrawals`","minimum":0}}},"AdminAgentMetricsResponse":{"type":"object","required":["total_agents","total_deposit_interactions","total_withdraw_interactions","asset_metrics","agents_with_user_funds","total_agent_user_fund_records","total_distinct_funds_touched"],"properties":{"agents_with_user_funds":{"type":"integer","format":"int64","description":"Distinct agent users that currently have at least one user_fund row","minimum":0},"asset_metrics":{"type":"array","items":{"$ref":"#/components/schemas/AdminAgentAssetMetrics"},"description":"Per-asset metrics aggregated by mint"},"total_agent_user_fund_records":{"type":"integer","format":"int64","description":"Total number of user_fund rows for tracked agents","minimum":0},"total_agents":{"type":"integer","format":"int64","description":"Total number of tracked agents (rows in agent_data)","minimum":0},"total_deposit_interactions":{"type":"integer","format":"int64","description":"Sum of all agent deposit interactions","minimum":0},"total_distinct_funds_touched":{"type":"integer","format":"int64","description":"Distinct funds touched by tracked agents via user_fund","minimum":0},"total_withdraw_interactions":{"type":"integer","format":"int64","description":"Sum of all agent withdraw interactions","minimum":0}}},"AdminAssetYieldSources":{"type":"object","description":"Yield source configuration for a specific asset (for admin endpoint)","required":["mint","yield_sources"],"properties":{"mint":{"type":"string","description":"Base asset mint address"},"yield_sources":{"$ref":"#/components/schemas/ApiSelectiveYieldSource","description":"Yield sources configured for this asset by protocol"}}},"AdminFundAllocation":{"type":"object","description":"Fund allocation detail for admin","required":["index","yield_source_type","protocol","protocol_id","position_id","deposit_amount","current_value","deposit_timestamp"],"properties":{"apy":{"type":["number","null"],"format":"double","description":"Current APY for the allocation (from yield source)"},"current_value":{"type":"integer","format":"int64","description":"Current value (raw)","minimum":0},"deposit_amount":{"type":"integer","format":"int64","description":"Deposit amount (raw)","minimum":0},"deposit_timestamp":{"type":"integer","format":"int64","description":"Deposit timestamp"},"index":{"type":"integer","format":"int32","description":"Allocation index","minimum":0},"position_id":{"type":"string","description":"Position ID"},"protocol":{"type":"string","description":"Protocol name"},"protocol_id":{"type":"string","description":"Protocol ID (yield source pubkey)"},"yield_source_type":{"type":"string","description":"Yield source type"}}},"AdminFundConstraint":{"type":"object","description":"Fund constraint detail for admin","required":["yield_source_type","protocol","constraint_type","value"],"properties":{"constraint_type":{"type":"string","description":"Constraint type (\"MaxPercentage\" or \"MaxBaseAssetAllocation\")"},"protocol":{"type":"string","description":"Protocol name"},"value":{"type":"integer","format":"int64","description":"Constraint value","minimum":0},"yield_source_type":{"type":"string","description":"Yield source type"}}},"AdminFundDetail":{"type":"object","description":"Detailed fund information for admin back-office views","required":["fund_id","base_asset_mint","base_asset_decimals","base_asset_token_account","authority","index_number","lookup_table","bump","token_account_bump","total_shares","share_price","current_value","status","current_value_usd","allocated_to_yield","allocated_to_yield_usd","unallocated_amount","unallocated_amount_usd","last_value_tracked_at","updated_at_timestamp","updated_at_slot","risk_max","risk_aversion_bps","total_deposits","total_users","has_fees","fees","last_rebalance_slot","allocations","constraints"],"properties":{"allocated_to_yield":{"type":"integer","description":"Amount allocated to yield (raw)","minimum":0},"allocated_to_yield_usd":{"type":"number","format":"double","description":"Amount allocated to yield in USD"},"allocation_percent":{"type":["number","null"],"format":"double","description":"Allocation percent within strategy"},"allocations":{"type":"array","items":{"$ref":"#/components/schemas/AdminFundAllocation"},"description":"Current yield allocations"},"authority":{"type":"string","description":"Fund authority"},"base_asset_decimals":{"type":"integer","format":"int32","description":"Base asset decimals","minimum":0},"base_asset_mint":{"type":"string","description":"Base asset token mint address"},"base_asset_price_usd":{"type":["number","null"],"format":"double","description":"Base asset price in USD"},"base_asset_token_account":{"type":"string","description":"Base asset token account"},"bump":{"type":"integer","format":"int32","description":"Fund bump","minimum":0},"constraints":{"type":"array","items":{"$ref":"#/components/schemas/AdminFundConstraint"},"description":"Fund constraints"},"current_apy":{"type":["number","null"],"format":"double","description":"Current APY"},"current_risk":{"type":["integer","null"],"format":"int32","description":"Current risk level","minimum":0},"current_value":{"type":"integer","description":"Current value in base asset (raw)","minimum":0},"current_value_usd":{"type":"number","format":"double","description":"Current value in USD"},"fees":{"type":"array","items":{"$ref":"#/components/schemas/AdminFundFee"},"description":"Fee configurations"},"fund_id":{"type":"string","description":"Fund ID"},"has_fees":{"type":"boolean","description":"Whether fund has fees configured"},"index_number":{"type":"integer","format":"int64","description":"Fund index number","minimum":0},"last_rebalance_slot":{"type":"integer","format":"int64","description":"Last rebalance slot","minimum":0},"last_rebalance_timestamp":{"type":["integer","null"],"format":"int64","description":"Last rebalance timestamp","minimum":0},"last_refresh_timestamp":{"type":["integer","null"],"format":"int64","description":"Last refresh timestamp","minimum":0},"last_snapshot_timestamp":{"type":["integer","null"],"format":"int64","description":"Last snapshot timestamp","minimum":0},"last_value_tracked_at":{"type":"integer","format":"int64","description":"Last value tracked at slot","minimum":0},"lookup_table":{"type":"string","description":"Lookup table address"},"min_position_settle_time":{"type":["integer","null"],"format":"int64","description":"Minimum position settle time","minimum":0},"min_rebalance_value":{"type":["integer","null"],"format":"int64","description":"Minimum rebalance value","minimum":0},"organization_id":{"type":["string","null"],"description":"Organization ID (if known)"},"organization_name":{"type":["string","null"],"description":"Organization name (if known)"},"rebalance_error":{"type":["string","null"],"description":"Last rebalance error (if any)"},"rebalance_period":{"type":["integer","null"],"format":"int64","description":"Rebalance period in seconds","minimum":0},"risk_aversion_bps":{"type":"integer","format":"int64","description":"Risk aversion basis points","minimum":0},"risk_max":{"type":"integer","format":"int64","description":"Risk max setting","minimum":0},"share_price":{"type":"integer","format":"int64","description":"Current share price","minimum":0},"status":{"type":"string","description":"Fund status (Live, Paused, WithdrawOnly)"},"strategy_id":{"type":["string","null"],"description":"Strategy ID this fund belongs to (if any)"},"strategy_name":{"type":["string","null"],"description":"Strategy name (if any)"},"token_account_bump":{"type":"integer","format":"int32","description":"Token account bump","minimum":0},"total_deposits":{"type":"integer","description":"Total deposits in base asset (raw)","minimum":0},"total_shares":{"type":"integer","description":"Current total shares","minimum":0},"total_users":{"type":"integer","format":"int64","description":"Total unique users","minimum":0},"unallocated_amount":{"type":"integer","description":"Unallocated amount (raw)","minimum":0},"unallocated_amount_usd":{"type":"number","format":"double","description":"Unallocated amount in USD"},"unallocated_threshold":{"type":["integer","null"],"format":"int64","description":"Unallocated threshold for triggering rebalance","minimum":0},"updated_at_slot":{"type":"integer","format":"int64","description":"Updated at slot","minimum":0},"updated_at_timestamp":{"type":"integer","format":"int64","description":"Updated at timestamp","minimum":0}}},"AdminFundFee":{"type":"object","description":"Fund fee detail for admin","required":["fee_type","fee_bps","recipient"],"properties":{"fee_bps":{"type":"integer","format":"int32","description":"Fee in basis points (100 = 1%)","minimum":0},"fee_type":{"type":"string","description":"Fee type (e.g., \"ProtocolBase\", \"App\", \"Performance\")"},"recipient":{"type":"string","description":"Fee recipient address"}}},"AdminFundListItem":{"type":"object","description":"Fund list item for admin back-office views (minimal for fast listing)","required":["fund_id","base_asset_mint","status","current_value"],"properties":{"base_asset_mint":{"type":"string","description":"Base asset token mint address"},"current_value":{"type":"integer","description":"Current value in base asset (raw)","minimum":0},"fund_id":{"type":"string","description":"Fund ID"},"organization_id":{"type":["string","null"],"description":"Organization ID (if known)"},"organization_name":{"type":["string","null"],"description":"Organization name (if known)"},"status":{"type":"string","description":"Fund status (Live, Paused, WithdrawOnly)"},"strategy_name":{"type":["string","null"],"description":"Strategy name (if any)"}}},"AdminMetricsRequest":{"type":"object","description":"Admin platform metrics request parameters","required":["start_timestamp","end_timestamp"],"properties":{"aggregation_window":{"type":["string","null"],"description":"Optional aggregation window (e.g., \"1h\", \"1d\", \"5m\")"},"end_timestamp":{"type":"string","description":"End timestamp for metrics range (ISO 8601 format)"},"start_timestamp":{"type":"string","description":"Start timestamp for metrics range (ISO 8601 format)"}}},"AdminMetricsResponse":{"type":"object","description":"Admin metrics response - aggregates ALL strategies/funds platform-wide\nSame structure as strategy/metrics but for entire platform","required":["start","end","aggregation_window","total_strategies","total_funds","data","combined_asset_value_over_time","per_asset_value_over_time","fee_distribution_metrics"],"properties":{"aggregation_window":{"type":"string","description":"Aggregation window (e.g., \"1h\", \"1d\", \"5m\")"},"combined_asset_value_over_time":{"type":"array","items":{"$ref":"#/components/schemas/CombinedAssetValueOverTime"},"description":"Combined asset value over time (all assets)"},"data":{"type":"array","items":{"$ref":"#/components/schemas/UniversalStrategyMetrics"},"description":"Array of aggregated metric data points over time"},"end":{"type":"string","description":"End timestamp of the data range"},"fee_distribution_metrics":{"type":"array","items":{"$ref":"#/components/schemas/ApiDailyFeeDistribution"},"description":"Fee distribution metrics over time"},"per_asset_value_over_time":{"type":"object","description":"Per-asset value over time","additionalProperties":{"type":"array","items":{"$ref":"#/components/schemas/AssetValuePair"}},"propertyNames":{"type":"string"}},"start":{"type":"string","description":"Start timestamp of the data range"},"total_funds":{"type":"integer","description":"Total number of funds included","minimum":0},"total_strategies":{"type":"integer","description":"Total number of strategies included","minimum":0}}},"AdminOrganization":{"type":"object","description":"Admin organization item with Clerk info and platform data","required":["id","name","slug","created_at","updated_at","tags","strategy_count","fund_count"],"properties":{"created_at":{"type":"integer","format":"int64","description":"Created timestamp (from Clerk)","minimum":0},"fee_distribution_key":{"type":["string","null"],"description":"Fee distribution key (from Breeze DB)"},"fund_count":{"type":"integer","description":"Number of funds for this organization","minimum":0},"id":{"type":"string","description":"Organization ID (Clerk ID)"},"name":{"type":"string","description":"Organization name"},"slug":{"type":"string","description":"Organization slug"},"strategy_count":{"type":"integer","description":"Number of strategies for this organization","minimum":0},"tags":{"type":"array","items":{"type":"string"},"description":"Tags assigned to this organization (from Breeze DB)"},"updated_at":{"type":"integer","format":"int64","description":"Updated timestamp (from Clerk)","minimum":0}}},"AdminOrganizationDetailResponse":{"type":"object","description":"Response for single organization detail endpoint","required":["id","name","created_at","updated_at","tags","strategy_count","fund_count","members","invitations"],"properties":{"created_at":{"type":"integer","format":"int64","description":"When the organization was created (Unix timestamp)","minimum":0},"fee_distribution_key":{"type":["string","null"],"description":"Fee distribution public key"},"fund_count":{"type":"integer","description":"Number of funds in this organization","minimum":0},"id":{"type":"string","description":"Organization ID"},"invitations":{"type":"array","items":{"$ref":"#/components/schemas/AdminOrganizationInvitation"},"description":"Pending invitations for this organization"},"members":{"type":"array","items":{"$ref":"#/components/schemas/AdminOrganizationMember"},"description":"Current members of this organization"},"name":{"type":"string","description":"Organization name"},"slug":{"type":["string","null"],"description":"Organization slug"},"strategy_count":{"type":"integer","description":"Number of strategies in this organization","minimum":0},"tags":{"type":"array","items":{"type":"string"},"description":"Tags associated with the organization"},"updated_at":{"type":"integer","format":"int64","description":"When the organization was last updated (Unix timestamp)","minimum":0}}},"AdminOrganizationInvitation":{"type":"object","description":"Organization invitation from Clerk","required":["id","email_address","role","status","created_at"],"properties":{"created_at":{"type":"integer","format":"int64","description":"When the invitation was created (Unix timestamp)","minimum":0},"email_address":{"type":"string","description":"Email address the invitation was sent to"},"id":{"type":"string","description":"Invitation ID"},"role":{"type":"string","description":"Role assigned to the invitation"},"status":{"type":"string","description":"Status of the invitation (pending, accepted, revoked)"}}},"AdminOrganizationMember":{"type":"object","description":"Organization member from Clerk","required":["id","user_id","identifier","role","created_at"],"properties":{"created_at":{"type":"integer","format":"int64","description":"When the membership was created (Unix timestamp)","minimum":0},"first_name":{"type":["string","null"],"description":"User's first name"},"id":{"type":"string","description":"Membership ID"},"identifier":{"type":"string","description":"User's email or identifier"},"image_url":{"type":["string","null"],"description":"User's profile image URL"},"last_name":{"type":["string","null"],"description":"User's last name"},"role":{"type":"string","description":"Role in the organization (e.g., \"org:admin\", \"org:member\")"},"user_id":{"type":"string","description":"User ID"}}},"AdminOrganizationsResponse":{"type":"object","description":"Response for admin organizations endpoint","required":["total","organizations"],"properties":{"organizations":{"type":"array","items":{"$ref":"#/components/schemas/AdminOrganization"},"description":"List of organizations"},"total":{"type":"integer","description":"Total number of organizations","minimum":0}}},"AdminStrategyCurrentData":{"type":"object","description":"Current live data for admin strategy detail","required":["tvl_usd","total_deposits_usd","yield_earnings_usd","total_users","total_fees_distributed_usd","apy","allocated_usd","unallocated_usd","protocol_allocations"],"properties":{"allocated_usd":{"type":"number","format":"double","description":"Allocated to yield (USD)"},"apy":{"type":"number","format":"double","description":"Weighted APY"},"protocol_allocations":{"type":"array","items":{"$ref":"#/components/schemas/ProtocolValues"},"description":"Protocol breakdown"},"total_deposits_usd":{"type":"number","format":"double","description":"Total deposits (USD) - from user_fund table"},"total_fees_distributed_usd":{"type":"number","format":"double","description":"Total fees distributed (USD)"},"total_users":{"type":"integer","format":"int64","description":"Total unique users","minimum":0},"tvl_usd":{"type":"number","format":"double","description":"Total value locked (USD)"},"unallocated_usd":{"type":"number","format":"double","description":"Unallocated amount (USD)"},"yield_earnings_usd":{"type":"number","format":"double","description":"Yield earnings: TVL - deposits"}}},"AdminStrategyDetail":{"type":"object","description":"Detailed admin strategy response with current live data","required":["id","name","template_id","organization_id","organization_name","status","created_at","updated_at","fees","current_data","funds"],"properties":{"created_at":{"type":"integer","format":"int64","description":"Created timestamp","minimum":0},"current_data":{"$ref":"#/components/schemas/AdminStrategyCurrentData","description":"Current live metrics"},"description":{"type":["string","null"],"description":"Strategy description"},"fees":{"type":"array","items":{"$ref":"#/components/schemas/AdminStrategyFee"},"description":"Fee configuration"},"funds":{"type":"array","items":{"$ref":"#/components/schemas/AdminStrategyFundDetail"},"description":"Fund details"},"id":{"type":"string","description":"Strategy ID"},"name":{"type":"string","description":"Strategy name"},"organization_id":{"type":"string","description":"Organization ID that owns this strategy"},"organization_name":{"type":"string","description":"Organization name (from Breeze DB or Clerk)"},"status":{"type":"string","description":"Strategy status"},"template_id":{"type":"string","description":"Template ID this strategy was created from"},"updated_at":{"type":"integer","format":"int64","description":"Updated timestamp","minimum":0}}},"AdminStrategyFee":{"type":"object","description":"Fee info for admin strategy detail","required":["fee_bps","fee_recipient","fee_type","frequency_seconds"],"properties":{"fee_bps":{"type":"integer","format":"int32","minimum":0},"fee_recipient":{"type":"string"},"fee_type":{"type":"string"},"frequency_seconds":{"type":"integer","format":"int64","minimum":0}}},"AdminStrategyFundDetail":{"type":"object","description":"Fund detail for admin strategy detail","required":["fund_id","base_asset_mint","base_asset_decimals","current_value","current_value_usd","deposits","deposits_usd","allocated_to_yield","allocated_to_yield_usd","unallocated","unallocated_usd","user_count","asset_price_usd"],"properties":{"allocated_to_yield":{"type":"integer","description":"Allocated to yield in base asset","minimum":0},"allocated_to_yield_usd":{"type":"number","format":"double","description":"Allocated to yield in USD"},"asset_price_usd":{"type":"number","format":"double","description":"Current asset price (USD)"},"base_asset_decimals":{"type":"integer","format":"int32","description":"Base asset decimals","minimum":0},"base_asset_mint":{"type":"string","description":"Base asset token mint"},"current_value":{"type":"integer","description":"Current value in base asset","minimum":0},"current_value_usd":{"type":"number","format":"double","description":"Current value in USD"},"deposits":{"type":"integer","description":"Total deposits in base asset","minimum":0},"deposits_usd":{"type":"number","format":"double","description":"Total deposits in USD"},"fund_id":{"type":"string","description":"Fund ID"},"unallocated":{"type":"integer","description":"Unallocated in base asset","minimum":0},"unallocated_usd":{"type":"number","format":"double","description":"Unallocated in USD"},"user_count":{"type":"integer","format":"int64","description":"User count for this fund","minimum":0}}},"AdminStrategyListItem":{"type":"object","description":"Strategy list item for admin back-office views (minimal for fast listing)","required":["id","name","organization_name","assets","status","created_at","updated_at"],"properties":{"assets":{"type":"array","items":{"type":"string"},"description":"List of asset mints in this strategy"},"created_at":{"type":"integer","format":"int64","description":"Created timestamp","minimum":0},"id":{"type":"string","description":"Strategy ID"},"name":{"type":"string","description":"Strategy name"},"organization_name":{"type":"string","description":"Organization name (from Breeze DB or Clerk)"},"status":{"type":"string","description":"Strategy status"},"updated_at":{"type":"integer","format":"int64","description":"Updated timestamp","minimum":0}}},"AdminYieldSourcesResponse":{"type":"object","description":"Response type for admin yield sources grouped by asset","required":["total_assets","assets"],"properties":{"assets":{"type":"array","items":{"$ref":"#/components/schemas/AdminAssetYieldSources"},"description":"Yield sources by asset"},"total_assets":{"type":"integer","description":"Total number of assets with yield sources configured","minimum":0}}},"ApiAssignFundOperationResult":{"type":"object","required":["message","fund_id","organization_id"],"properties":{"fund_id":{"type":"string"},"message":{"type":"string"},"organization_id":{"type":"string"}}},"ApiAssignFundToOrganization":{"type":"object","required":["organization_id","organization_fund_id"],"properties":{"organization_fund_id":{"type":"string"},"organization_id":{"type":"string"}}},"ApiCancelJobResult":{"type":"object","required":["message","job_id","previous_state","new_state"],"properties":{"job_id":{"type":"string"},"message":{"type":"string"},"new_state":{"type":"string"},"previous_state":{"type":"string"}}},"ApiCloseStrategyFundsRequest":{"type":"object","required":["strategy_id"],"properties":{"strategy_id":{"type":"string"}}},"ApiConstraintType":{"type":"string","enum":["MaxPercentage","MaxBaseAssetAmount"]},"ApiCreateFundRebalanceSettings":{"type":"object","properties":{"min_position_settle_time":{"type":["integer","null"],"format":"int64","description":"Minimum position settle time in seconds","minimum":0},"min_rebalance_value":{"type":["integer","null"],"format":"int64","description":"Minimum rebalance value in lamports","minimum":0},"rebalance_period":{"type":["integer","null"],"format":"int64","description":"Rebalance period in seconds","minimum":0},"unallocated_threshold":{"type":["integer","null"],"format":"int64","description":"Unallocated threshold in lamports","minimum":0}}},"ApiCreateFundRequest":{"type":"object","required":["base_asset_mint","yield_source_ids","strategy_id","risk_aversion_bps","risk_max"],"properties":{"base_asset_mint":{"type":"string","description":"Base asset mint address (e.g., USDC mint)"},"constraints":{"type":["array","null"],"items":{"$ref":"#/components/schemas/ApiFundConstraint"},"description":"Optional constraints for yield strategies"},"fees":{"type":["array","null"],"items":{"$ref":"#/components/schemas/ApiFundFee"},"description":"Optional fees configuration"},"organization_id":{"type":["string","null"],"description":"Optional organization ID to associate with the fund"},"rebalance_settings":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ApiCreateFundRebalanceSettings","description":"Optional rebalance settings"}]},"risk_aversion_bps":{"type":"integer","format":"int64","description":"Risk aversion in basis points (0-10000)","minimum":0},"risk_max":{"type":"integer","format":"int64","description":"Maximum risk level (0-100)","minimum":0},"strategy_id":{"type":"string","description":"Strategy instance ID this fund belongs to"},"yield_source_ids":{"$ref":"#/components/schemas/ApiYieldSourceIds","description":"Yield source IDs - one per protocol, must match base asset mint"}}},"ApiCreateStrategyTemplateResult":{"type":"object","required":["message","strategy_name","template_id"],"properties":{"message":{"type":"string"},"strategy_name":{"type":"string"},"template_id":{"type":"string"}}},"ApiDailyFeeDistribution":{"type":"object","required":["time","total_amount_distributed"],"properties":{"time":{"type":"string"},"total_amount_distributed":{"type":"number","format":"double"}}},"ApiDeleteStrategyOperationResult":{"type":"object","required":["message","strategy_id"],"properties":{"message":{"type":"string"},"strategy_id":{"type":"string"}}},"ApiFund":{"type":"object","required":["fund_id","base_asset_token_mint","base_asset_token_decimals","base_asset_token_account","total_deposits","total_users","last_value_tracked_at","total_shares","share_price","current_value","authority","updated_at_timestamp","updated_at_slot","risk_max","risk_aversion_bps","allocated_to_yield","unallocated_amount","bump","token_account_bump","index_number","lookup_table","has_fees","constraints","allocations","protocol_options","last_rebalance_slot","status"],"properties":{"allocated_to_yield":{"type":"integer","minimum":0},"allocations":{"type":"array","items":{"$ref":"#/components/schemas/ApiYieldAllocation"}},"assigned_org":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ApiFundOrganization"}]},"authority":{"type":"string"},"base_asset_token_account":{"type":"string"},"base_asset_token_decimals":{"type":"integer","format":"int32","minimum":0},"base_asset_token_mint":{"type":"string"},"bump":{"type":"integer","format":"int32","minimum":0},"constraints":{"type":"array","items":{"$ref":"#/components/schemas/ApiFundConstraint"}},"current_value":{"type":"integer","minimum":0},"fund_id":{"type":"string"},"has_fees":{"type":"boolean"},"index_number":{"type":"integer","format":"int64","minimum":0},"last_rebalance_slot":{"type":"integer","format":"int64","minimum":0},"last_value_tracked_at":{"type":"integer","format":"int64","minimum":0},"lookup_table":{"type":"string"},"protocol_options":{"$ref":"#/components/schemas/ApiProtocolOptions"},"risk_aversion_bps":{"type":"integer","format":"int64","minimum":0},"risk_max":{"type":"integer","format":"int64","minimum":0},"share_price":{"type":"integer","format":"int64","minimum":0},"status":{"$ref":"#/components/schemas/ApiLendFundStatus"},"token_account_bump":{"type":"integer","format":"int32","minimum":0},"total_deposits":{"type":"integer","minimum":0},"total_shares":{"type":"integer","minimum":0},"total_users":{"type":"integer","minimum":0},"unallocated_amount":{"type":"integer","minimum":0},"updated_at_slot":{"type":"integer","format":"int64","minimum":0},"updated_at_timestamp":{"type":"integer","format":"int64","minimum":0},"withdraw_authority":{"type":["string","null"]}}},"ApiFundConstraint":{"type":"object","required":["yield_source_target","constraint_type","value"],"properties":{"constraint_type":{"$ref":"#/components/schemas/ApiConstraintType"},"value":{"type":"integer","format":"int64","minimum":0},"yield_source_target":{"$ref":"#/components/schemas/ApiYieldSourceTarget"}}},"ApiFundFee":{"type":"object","required":["fee_type","fee_bps","recipient"],"properties":{"fee_bps":{"type":"integer","format":"int32","minimum":0},"fee_type":{"type":"string"},"recipient":{"type":"string"}}},"ApiFundFeeDistribution":{"type":"object","description":"Fee distribution data point for fund metrics","required":["time","total_amount_distributed"],"properties":{"time":{"type":"string","description":"Timestamp (ISO 8601)"},"total_amount_distributed":{"type":"number","format":"double","description":"Total amount distributed"}}},"ApiFundFees":{"type":"object","required":["fund_id","fees"],"properties":{"fees":{"type":"array","items":{"$ref":"#/components/schemas/ApiFundFee"}},"fund_id":{"type":"string"}}},"ApiFundMetricDataPoint":{"type":"object","required":["time","allocated_to_yield","current_value","current_value_usd","unallocated_amount","unallocated_amount_usd","allocation_count","user_count","total_deposits","current_apy","risk_level","share_price","base_asset_price_usd"],"properties":{"allocated_to_yield":{"type":"integer","minimum":0},"allocation_count":{"type":"integer","minimum":0},"base_asset_price_usd":{"type":"number","format":"double"},"current_apy":{"type":"number","format":"double"},"current_value":{"type":"integer","minimum":0},"current_value_usd":{"type":"number","format":"double"},"risk_level":{"type":"integer","format":"int64","minimum":0},"share_price":{"type":"integer","format":"int64","minimum":0},"time":{"type":"string"},"total_deposits":{"type":"integer","minimum":0},"unallocated_amount":{"type":"integer","minimum":0},"unallocated_amount_usd":{"type":"number","format":"double"},"user_count":{"type":"integer","format":"int64","minimum":0}}},"ApiFundMetrics":{"type":"object","required":["start","end","aggregation_window","fund_id","data"],"properties":{"aggregation_window":{"type":"string","description":"Aggregation window (e.g., \"1h\", \"1d\", \"5m\") representing time between data points"},"data":{"type":"array","items":{"$ref":"#/components/schemas/ApiFundMetricDataPoint"},"description":"Array of aggregated metric data points"},"end":{"type":"string","description":"End timestamp of the data range"},"fund_id":{"type":"string","description":"Fund ID for the metrics"},"start":{"type":"string","description":"Start timestamp of the data range"}}},"ApiFundMetricsRequest":{"type":"object","required":["start_timestamp","end_timestamp"],"properties":{"aggregation_window":{"type":["string","null"],"description":"Optional aggregation window (e.g., \"1h\", \"1d\", \"5m\") - if not provided, database will choose optimal window"},"end_timestamp":{"type":"string","description":"End timestamp for metrics range (Unix timestamp)"},"start_timestamp":{"type":"string","description":"Start timestamp for metrics range (Unix timestamp)"}}},"ApiFundMetricsResponse":{"type":"object","description":"Fund metrics response for admin back-office","required":["start","end","aggregation_window","fund_id","base_asset_mint","data","fee_distribution_metrics"],"properties":{"aggregation_window":{"type":"string","description":"Aggregation window (e.g., \"1h\", \"1d\", \"7d\")"},"base_asset_mint":{"type":"string","description":"Base asset mint"},"data":{"type":"array","items":{"$ref":"#/components/schemas/FundMetricDataPoint"},"description":"Array of metric data points"},"end":{"type":"string","description":"End timestamp of the data range"},"fee_distribution_metrics":{"type":"array","items":{"$ref":"#/components/schemas/ApiFundFeeDistribution"},"description":"Fee distribution data over time"},"fund_id":{"type":"string","description":"Fund ID"},"start":{"type":"string","description":"Start timestamp of the data range"}}},"ApiFundOrganization":{"type":"object","required":["id","name"],"properties":{"id":{"type":"string"},"name":{"type":"string"}}},"ApiFundRebalanceSettings":{"type":"object","required":["fund_id"],"properties":{"fund_id":{"type":"string"},"min_position_settle_time":{"type":["integer","null"],"format":"int64","minimum":0},"min_rebalance_value":{"type":["integer","null"],"format":"int64","minimum":0},"rebalance_period":{"type":["integer","null"],"format":"int64","minimum":0},"unallocated_threshold":{"type":["integer","null"],"format":"int64","minimum":0}}},"ApiFundRequest":{"type":"object","required":["id","organization_id","yield_target","risk_aversion","base_assets","fund_type","status"],"properties":{"base_assets":{"type":"array","items":{"type":"string"}},"fund_type":{"$ref":"#/components/schemas/ApiFundType"},"id":{"type":"string"},"organization_id":{"type":"string"},"risk_aversion":{"$ref":"#/components/schemas/ApiRiskAversion"},"status":{"$ref":"#/components/schemas/ApiRequestStatus"},"yield_target":{"type":"number","format":"double"}}},"ApiFundRequestListResponse":{"type":"object","required":["requests"],"properties":{"requests":{"type":"array","items":{"$ref":"#/components/schemas/ApiFundRequest"}}}},"ApiFundResolverResponse":{"type":"object","required":["fund_id"],"properties":{"fund_id":{"type":"string"}}},"ApiFundType":{"type":"string","enum":["LendBorrow","LST","Staking","Mixed"]},"ApiFundUpdateRequest":{"type":"object","required":["fund_id","constraints"],"properties":{"constraints":{"type":"array","items":{"$ref":"#/components/schemas/ApiFundConstraint"}},"fund_id":{"type":"string"},"risk_aversion_bps":{"type":["integer","null"],"format":"int64","minimum":0},"risk_max":{"type":["integer","null"],"format":"int64","minimum":0}}},"ApiFundWithBaseAssetMapper":{"type":"object","required":["fund_id","mint"],"properties":{"fund_id":{"type":"string"},"mint":{"type":"string"}}},"ApiFundWithStrategyInfo":{"type":"object","required":["fund"],"properties":{"assigned_org":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ApiFundOrganization"}]},"fund":{"$ref":"#/components/schemas/ApiFund"},"strategy_name":{"type":["string","null"]}}},"ApiGetRequestBasedOrgTagsInput":{"type":"object","properties":{"organization_id":{"type":["string","null"]}}},"ApiGlobalConfig":{"type":"object","required":["program_admin","initialized","paused","bump","fund_counter","supported_base_assets","updated_at_timestamp","updated_at_slot"],"properties":{"bump":{"type":"integer","format":"int32","description":"Program derived address bump","minimum":0},"fund_counter":{"type":"integer","format":"int64","description":"Counter for funds created","minimum":0},"initialized":{"type":"boolean","description":"Whether the program is initialized"},"paused":{"type":"boolean","description":"Whether the program is paused"},"program_admin":{"type":"string","description":"Program admin pubkey"},"supported_base_assets":{"type":"array","items":{"type":"string"},"description":"List of supported base asset mint addresses"},"updated_at_slot":{"type":"integer","format":"int64","description":"Slot when the config was last updated","minimum":0},"updated_at_timestamp":{"type":"integer","format":"int64","description":"Timestamp when the config was last updated","minimum":0}}},"ApiInputForAddingAssetsToStrategy":{"type":"object","required":["strategy_id"],"properties":{"mints":{"type":["array","null"],"items":{"type":"string"},"description":"Optional list of specific mints to add. If not provided, adds all assets from template that don't have funds yet."},"strategy_id":{"type":"string"}}},"ApiInputForCreatingStrategy":{"type":"object","required":["name","visibility_tags","assets","fees"],"properties":{"assets":{"type":"array","items":{"$ref":"#/components/schemas/ApiTemplateAsset"}},"description":{"type":["string","null"]},"fees":{"type":"array","items":{"$ref":"#/components/schemas/ApiStrategyFee"}},"name":{"type":"string"},"visibility_tags":{"type":"array","items":{"type":"string"}}}},"ApiInputForDeletingEmptyStrategy":{"type":"object","required":["org_id","strategy_name"],"properties":{"org_id":{"type":"string"},"strategy_name":{"type":"string"}}},"ApiInputForDeletingStrategy":{"type":"object","required":["strategy_id"],"properties":{"strategy_id":{"type":"string"}}},"ApiInputForFundResolver":{"type":"object","required":["strategy_id","base_asset"],"properties":{"base_asset":{"type":"string"},"strategy_id":{"type":"string"}}},"ApiInputForGetStrategyByTags":{"type":"object","required":["tags"],"properties":{"tags":{"type":"array","items":{"type":"string"}}}},"ApiInputForInitializingStrategy":{"type":"object","required":["name","template_id","fee_recipient","fee_percentage","frequency_seconds"],"properties":{"delegated_withdrawer":{"type":["string","null"],"description":"Optional delegated withdraw authority applied to each fund created for this strategy."},"description":{"type":["string","null"]},"fee_percentage":{"type":"number","format":"double"},"fee_recipient":{"type":"string"},"frequency_seconds":{"type":"integer","format":"int64","minimum":0},"name":{"type":"string"},"squads_usage":{"type":"boolean","description":"Optional, if the user uses squads multisig / grid"},"template_id":{"type":"string"}}},"ApiInputForMigratingToStrategy":{"type":"object","required":["strategy_name","org_id","breeze_fee_recipient_key","breeze_fee_percentage","fee_payout_frequency_seconds"],"properties":{"breeze_fee_percentage":{"type":"number","format":"double"},"breeze_fee_recipient_key":{"type":"string"},"fee_payout_frequency_seconds":{"type":"string"},"org_id":{"type":"string"},"strategy_name":{"type":"string"}}},"ApiInputForUpdatingSelectiveYieldSource":{"type":"object","required":["mint","yield_sources"],"properties":{"mint":{"type":"string"},"yield_sources":{"$ref":"#/components/schemas/ApiSelectiveYieldSource"}}},"ApiInputForUpdatingStrategy":{"type":"object","required":["template_id","name","visibility_tags","assets","fees"],"properties":{"assets":{"type":"array","items":{"$ref":"#/components/schemas/ApiTemplateAsset"}},"description":{"type":["string","null"]},"fees":{"type":"array","items":{"$ref":"#/components/schemas/ApiStrategyFee"}},"name":{"type":"string"},"template_id":{"type":"string"},"visibility_tags":{"type":"array","items":{"type":"string"}}}},"ApiInputForUpdatingStrategyInstance":{"type":"object","properties":{"name":{"type":["string","null"],"description":"New name for the strategy (optional)"}}},"ApiInputToGetSelectiveYieldSources":{"type":"object","required":["mint"],"properties":{"mint":{"type":"string"}}},"ApiInputsForRequestingFund":{"type":"object","required":["base_assets","fund_type","yield_target","risk_aversion"],"properties":{"base_assets":{"type":"array","items":{"type":"string"}},"fund_type":{"$ref":"#/components/schemas/ApiFundType"},"risk_aversion":{"$ref":"#/components/schemas/ApiRiskAversion"},"yield_target":{"type":"number","format":"double"}}},"ApiJobStatus":{"type":"object","required":["job_id","job_type","payload","state","created_at","updated_at"],"properties":{"additional_fund_metadata":{"type":["array","null"],"items":{"$ref":"#/components/schemas/ApiFundWithBaseAssetMapper"}},"created_at":{"type":"integer","format":"int64","minimum":0},"error":{"type":["string","null"]},"job_id":{"type":"string"},"job_type":{"type":"string"},"payload":{"type":"string"},"state":{"type":"string"},"updated_at":{"type":"integer","format":"int64","minimum":0}}},"ApiKey":{"type":"object","required":["api_key","organization_id","active","created_at","scopes"],"properties":{"active":{"type":"boolean","description":"Whether the API key is active"},"api_key":{"type":"string","description":"Unique API key identifier"},"created_at":{"type":"integer","format":"int64","description":"Timestamp when the API key was created","minimum":0},"expires_at":{"type":["integer","null"],"format":"int64","description":"Expiration timestamp (optional)","minimum":0},"last_used_at":{"type":["integer","null"],"format":"int64","description":"Timestamp when the API key was last used","minimum":0},"name":{"type":["string","null"],"description":"Name/description for the API key"},"organization_id":{"type":"string","description":"Organization identifier"},"scopes":{"type":"array","items":{"type":"string"},"description":"Permissions or scopes for the API key"}}},"ApiKeyCreatedResponse":{"type":"object","required":["api_key","message"],"properties":{"api_key":{"$ref":"#/components/schemas/ApiKey","description":"The newly created API key data"},"message":{"type":"string","description":"Success message"}}},"ApiKeyListResponse":{"type":"object","required":["api_keys","total"],"properties":{"api_keys":{"type":"array","items":{"$ref":"#/components/schemas/ApiKey"},"description":"List of API keys for the organization"},"total":{"type":"integer","description":"Total count of API keys","minimum":0}}},"ApiLendFundStatus":{"type":"string","enum":["Live","Paused","WithdrawOnly"]},"ApiOrganizationFundStats":{"type":"object","required":["total_funds","total_deposits","total_users","total_values","total_currencies"],"properties":{"total_currencies":{"type":"integer","format":"int64","minimum":0},"total_deposits":{"type":"array","items":{"$ref":"#/components/schemas/ApiTokenPair"}},"total_funds":{"type":"integer","format":"int64","minimum":0},"total_users":{"type":"integer","format":"int64","minimum":0},"total_values":{"type":"array","items":{"$ref":"#/components/schemas/ApiTokenPair"}}}},"ApiOrganizationSettings":{"type":"object","required":["organization_id","fee_distribution_key","tags"],"properties":{"fee_distribution_key":{"type":"string","description":"Fee distribution key for the organization"},"organization_id":{"type":"string","description":"Organization ID"},"tags":{"type":"array","items":{"type":"string"},"description":"Tags for the organization"}}},"ApiOrganizationSettingsResponse":{"type":"object","required":["settings"],"properties":{"settings":{"$ref":"#/components/schemas/ApiOrganizationSettings","description":"Organization settings"}}},"ApiPreRebalanceAllocation":{"type":"object","required":["protocol_id","position_id","current_value","yield_source_type","protocol"],"properties":{"current_value":{"type":"integer","format":"int64","minimum":0},"position_id":{"type":"string"},"protocol":{"type":"string"},"protocol_id":{"type":"string"},"yield_source_type":{"type":"string"}}},"ApiProtocolOptions":{"type":"object","required":["kamino_reserve","marginfi_bank","drift_market","jup_lend_market","jup_lend_reserve"],"properties":{"drift_market":{"type":"string"},"jup_lend_market":{"type":"string"},"jup_lend_reserve":{"type":"string"},"kamino_reserve":{"type":"string"},"marginfi_bank":{"type":"string"}}},"ApiRebalanceHistory":{"type":"object","required":["audit_id","fund_id","timestamp","rebalance_status","fee_amount","pre_rebalance_current_value","pre_rebalance_unallocated_amount","pre_rebalance_current_risk","pre_rebalance_allocations","target_allocations","rebalance_instructions"],"properties":{"audit_id":{"type":"string"},"error_message":{"type":["string","null"]},"execution_slot":{"type":["integer","null"],"format":"int64","minimum":0},"fee_amount":{"type":"integer","format":"int64","minimum":0},"fund_id":{"type":"string"},"pre_rebalance_allocations":{"type":"array","items":{"$ref":"#/components/schemas/ApiPreRebalanceAllocation"}},"pre_rebalance_current_risk":{"type":"integer","format":"int32","minimum":0},"pre_rebalance_current_value":{"type":"integer","format":"int64","minimum":0},"pre_rebalance_unallocated_amount":{"type":"integer","format":"int64","minimum":0},"rebalance_instructions":{"type":"array","items":{"$ref":"#/components/schemas/ApiRebalanceInstruction"}},"rebalance_status":{"type":"string"},"target_allocations":{"type":"array","items":{"$ref":"#/components/schemas/ApiTargetAllocation"}},"timestamp":{"type":"integer","format":"int64","minimum":0},"transaction_id":{"type":["string","null"]}}},"ApiRebalanceInstruction":{"type":"object","required":["yield_source_type","protocol","position_id","amount"],"properties":{"amount":{"type":"integer","format":"int64"},"position_id":{"type":"string"},"protocol":{"type":"string"},"yield_source_type":{"type":"string"}}},"ApiRequestStatus":{"type":"string","enum":["PENDING","APPROVED","REJECTED"]},"ApiRequestToGetStrategyCurrentData":{"type":"object","required":["all"],"properties":{"all":{"type":"boolean"},"strategy_id":{"type":["string","null"]}}},"ApiRetryJobResult":{"type":"object","required":["message","job_id","previous_state","new_state"],"properties":{"job_id":{"type":"string"},"message":{"type":"string"},"new_state":{"type":"string"},"previous_state":{"type":"string"}}},"ApiRiskAversion":{"type":"string","enum":["LOW","MEDIUM","HIGH"]},"ApiSelectiveYieldSource":{"type":"object","properties":{"drift_lending":{"type":["string","null"]},"jup_lend":{"type":["string","null"]},"kamino":{"type":["string","null"]},"marginfiv2":{"type":["string","null"]}}},"ApiSelectiveYieldSources":{"type":"object","required":["mint","yield_sources"],"properties":{"mint":{"type":"string"},"yield_sources":{"$ref":"#/components/schemas/ApiSelectiveYieldSource"}}},"ApiSetDelegatedWithdrawerIxRequest":{"type":"object","required":["fund_authority"],"properties":{"delegated_withdrawer":{"type":["string","null"],"description":"Set to `null` to clear the delegated withdrawer."},"fund_authority":{"type":"string","description":"Wallet pubkey expected to sign this instruction (must equal fund.authority)."},"fund_id":{"type":["string","null"],"description":"Fund identifier (fund PDA base58 string). Provide this OR `fund_index`."},"fund_index":{"type":["integer","null"],"format":"int64","description":"On-chain fund index number. Provide this OR `fund_id`.","minimum":0}}},"ApiStrategyFee":{"type":"object","required":["fee_type","percentage","recipient","frequency_seconds"],"properties":{"fee_type":{"type":"string"},"frequency_seconds":{"type":"integer","format":"int64","minimum":0},"percentage":{"type":"number","format":"double"},"recipient":{"type":"string"}}},"ApiStrategyLatestRebalanceHistoryRequest":{"type":"object","required":["all"],"properties":{"all":{"type":"boolean","description":"To include all organization strategies to get the latest top 5 rebalance hisotry of the highest allocated fund per base asset"},"strategy_id":{"type":["string","null"],"description":"To inlcude only a particular strategy to get the latest top 5 rebalance hisotry of the highest allocated fund per base asset"}}},"ApiStrategyMetricCurrentData":{"type":"object","required":["total_deposit","total_strategy","tvl","yield_earnings","strategy_user_count","total_deposits_in_karmino","total_deposits_in_drift_lending","total_deposits_in_marginfi","total_deposits_in_jup_lend","total_earnings_in_fees"],"properties":{"strategy_user_count":{"type":"integer","minimum":0},"total_deposit":{"type":"number","format":"double"},"total_deposits_in_drift_lending":{"type":"number","format":"double"},"total_deposits_in_jup_lend":{"type":"number","format":"double"},"total_deposits_in_karmino":{"type":"number","format":"double"},"total_deposits_in_marginfi":{"type":"number","format":"double"},"total_earnings_in_fees":{"type":"number","format":"double"},"total_strategy":{"type":"integer","format":"int32","minimum":0},"tvl":{"type":"number","format":"double"},"yield_earnings":{"type":"number","format":"double"}}},"ApiStrategyMetricUniversal":{"type":"object","required":["start","end","aggregation_window","strategy_id","data","combined_asset_value_over_time","per_asset_value_over_time","fee_distribution_metrics"],"properties":{"aggregation_window":{"type":"string","description":"Aggregation window (e.g., \"1h\", \"1d\", \"5m\") representing time between data points"},"combined_asset_value_over_time":{"type":"array","items":{"$ref":"#/components/schemas/CombinedAssetValueOverTime"}},"data":{"type":"array","items":{"$ref":"#/components/schemas/UniversalStrategyMetrics"},"description":"Array of aggregated metric data points"},"end":{"type":"string","description":"End timestamp of the data range"},"fee_distribution_metrics":{"type":"array","items":{"$ref":"#/components/schemas/ApiDailyFeeDistribution"}},"per_asset_value_over_time":{"type":"object","additionalProperties":{"type":"array","items":{"$ref":"#/components/schemas/AssetValuePair"}},"propertyNames":{"type":"string"}},"start":{"type":"string","description":"Start timestamp of the data range"},"strategy_id":{"type":"array","items":{"type":"string"},"description":"Strategy ID for the metrics"}}},"ApiStrategyMetrics":{"type":"object","required":["start","end","aggregation_window","strategy_id","current_data","data"],"properties":{"aggregation_window":{"type":"string","description":"Aggregation window (e.g., \"1h\", \"1d\", \"5m\") representing time between data points"},"current_data":{"$ref":"#/components/schemas/CurrentStrategyData","description":"Current strategy data"},"data":{"type":"array","items":{"$ref":"#/components/schemas/StrategyMetrics"},"description":"Array of aggregated metric data points"},"end":{"type":"string","description":"End timestamp of the data range"},"start":{"type":"string","description":"Start timestamp of the data range"},"strategy_id":{"type":"string","description":"Strategy ID for the metrics"}}},"ApiStrategyMetricsRequest":{"type":"object","required":["all"],"properties":{"aggregation_window":{"type":["string","null"],"description":"Optional aggregation window (e.g., \"1h\", \"1d\", \"5m\") - if not provided, database will choose optimal window"},"all":{"type":"boolean"},"all_time":{"type":["boolean","null"],"description":"Fetch full history across available snapshots"},"end_timestamp":{"type":["string","null"],"description":"End timestamp for metrics range (Unix timestamp)"},"start_timestamp":{"type":["string","null"],"description":"Start timestamp for metrics range (Unix timestamp)"},"strategy_id":{"type":["string","null"]},"time_frame":{"type":["string","null"],"description":"Simplified time frame selector. When provided, the backend derives\nstart/end timestamps and aggregation window automatically.\nValid values: \"24h\", \"7d\", \"30d\", \"all\".\nTakes precedence over start_timestamp/end_timestamp/all_time/aggregation_window."}}},"ApiStrategyTemplate":{"type":"object","required":["id","name","visibility_tags","assets","fees","created_at","updated_at"],"properties":{"assets":{"type":"array","items":{"$ref":"#/components/schemas/ApiTemplateAsset"}},"created_at":{"type":"integer","format":"int64","minimum":0},"description":{"type":["string","null"]},"fees":{"type":"array","items":{"$ref":"#/components/schemas/ApiStrategyFee"}},"id":{"type":"string"},"name":{"type":"string"},"updated_at":{"type":"integer","format":"int64","minimum":0},"visibility_tags":{"type":"array","items":{"type":"string"}}}},"ApiStrategyTemplateUpdate":{"type":"object","required":["name","visibility_tags","assets","fees","updated_at"],"properties":{"assets":{"type":"array","items":{"$ref":"#/components/schemas/ApiTemplateAsset"}},"description":{"type":["string","null"]},"fees":{"type":"array","items":{"$ref":"#/components/schemas/ApiStrategyFee"}},"name":{"type":"string"},"updated_at":{"type":"integer","format":"int64","minimum":0},"visibility_tags":{"type":"array","items":{"type":"string"}}}},"ApiTargetAllocation":{"type":"object","required":["yield_source_pubkey","yield_source_type","protocol","target_amount","objective_function_score"],"properties":{"objective_function_score":{"type":"number","format":"double"},"protocol":{"type":"string"},"target_amount":{"type":"integer","format":"int64","minimum":0},"yield_source_pubkey":{"type":"string"},"yield_source_type":{"type":"string"}}},"ApiTemplateAsset":{"type":"object","required":["mint","yield_sources"],"properties":{"mint":{"type":"string"},"yield_sources":{"$ref":"#/components/schemas/ApiTemplateYieldSource"}}},"ApiTemplateYieldSource":{"type":"object","properties":{"drift_lending":{"type":["string","null"]},"jup_lend":{"type":["string","null"]},"kamino":{"type":["string","null"]},"marginfiv2":{"type":["string","null"]}}},"ApiTokenPair":{"type":"object","required":["token_mint","amount"],"properties":{"amount":{"type":"integer","minimum":0},"token_mint":{"type":"string"}}},"ApiUnAssignFundFromOrganization":{"type":"object","required":["organization_fund_id"],"properties":{"organization_fund_id":{"type":"string"}}},"ApiUpdateFundAdminRequest":{"type":"object","description":"Request body for updating a fund via admin endpoint","properties":{"delegated_withdrawer":{"type":["string","null"],"description":"Optional delegated withdraw authority (submits an admin job). Set `null` to clear."},"fees_settings":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ApiUpdateFundFeesSettings","description":"Optional fee settings to update (submits an admin job)"}]},"fund_settings":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ApiUpdateFundConstraintsSettings","description":"Optional fund constraints and risk settings to update (submits an admin job)"}]},"rebalance_settings":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ApiUpdateFundRebalanceSettings","description":"Optional rebalance settings to update"}]}}},"ApiUpdateFundConstraintsSettings":{"type":"object","description":"Constraints and risk settings for updating a fund (without fund_id since it's in the path)","properties":{"constraints":{"type":["array","null"],"items":{"$ref":"#/components/schemas/ApiFundConstraint"},"description":"Fund constraints (yield strategy limits)"},"risk_aversion_bps":{"type":["integer","null"],"format":"int64","description":"Risk aversion in basis points (0-10000)","minimum":0},"risk_max":{"type":["integer","null"],"format":"int64","description":"Maximum risk level (0-100)","minimum":0}}},"ApiUpdateFundDelegatedWithdrawerRequest":{"type":"object","required":["fund_id"],"properties":{"delegated_withdrawer":{"type":["string","null"],"description":"Set to `null` to clear the delegated withdrawer."},"fund_id":{"type":"string"}}},"ApiUpdateFundFeesSettings":{"type":"object","description":"Fee settings for updating a fund (without fund_id since it's in the path)","required":["fees"],"properties":{"fees":{"type":"array","items":{"$ref":"#/components/schemas/ApiFundFee"},"description":"List of fee configurations for the fund"}}},"ApiUpdateFundRebalanceSettings":{"type":"object","description":"Rebalance settings for updating a fund (without fund_id since it's in the path)","properties":{"min_position_settle_time":{"type":["integer","null"],"format":"int64","description":"Minimum time to wait before settling a position (in seconds)","minimum":0},"min_rebalance_value":{"type":["integer","null"],"format":"int64","description":"Minimum value required to trigger a rebalance","minimum":0},"rebalance_period":{"type":["integer","null"],"format":"int64","description":"Rebalance period in seconds","minimum":0},"unallocated_threshold":{"type":["integer","null"],"format":"int64","description":"Unallocated threshold amount","minimum":0}}},"ApiUpdateOrganizationAdminRequest":{"type":"object","description":"Request body for updating an organization via admin endpoint","properties":{"name":{"type":["string","null"],"description":"Optional new name for the organization"},"tags":{"type":["array","null"],"items":{"type":"string"},"description":"Optional tags to set for the organization (replaces existing tags)"}}},"ApiUpdateOrganizationSettingsRequest":{"type":"object","properties":{"fee_distribution_key":{"type":["string","null"],"description":"Fee distribution key for the organization"},"tags":{"type":["array","null"],"items":{"type":"string"},"description":"Tags for the organization"}}},"ApiUpdateOrganizationTagsInputs":{"type":"object","required":["organization_id","tags"],"properties":{"organization_id":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}}}},"ApiUpdateOrganizationTagsResult":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}},"ApiUpdateStrategyDelegatedWithdrawerRequest":{"type":"object","required":["strategy_id"],"properties":{"delegated_withdrawer":{"type":["string","null"],"description":"Set to `null` to clear the delegated withdrawer on every fund in the strategy."},"strategy_id":{"type":"string"}}},"ApiUserFund":{"type":"object","required":["fund_user","fund_id","shares","updated_at_timestamp","updated_at_slot","deposit"],"properties":{"deposit":{"type":"integer","format":"int64","minimum":0},"fund_id":{"type":"string"},"fund_user":{"type":"string"},"shares":{"type":"integer","minimum":0},"updated_at_slot":{"type":"integer","format":"int64","minimum":0},"updated_at_timestamp":{"type":"integer","format":"int64","minimum":0}}},"ApiYieldAllocation":{"type":"object","required":["index","yield_source_type","protocol","protocol_id","position_id","deposit_amount","deposit_timestamp","current_value","time_weighted_value"],"properties":{"current_value":{"type":"integer","format":"int64","minimum":0},"deposit_amount":{"type":"integer","format":"int64","minimum":0},"deposit_timestamp":{"type":"integer","format":"int64"},"index":{"type":"integer","format":"int32","minimum":0},"position_id":{"type":"string"},"protocol":{"type":"string"},"protocol_id":{"type":"string"},"time_weighted_value":{"type":"integer","minimum":0},"yield_source_type":{"type":"string"}}},"ApiYieldSource":{"type":"object","required":["pubkey","source","yield_type","current_apy","risk","updated_at_timestamp","base_assets"],"properties":{"base_assets":{"type":"array","items":{"type":"string"},"description":"List of supported base assets"},"current_apy":{"type":"number","format":"double","description":"Current annual percentage yield"},"pubkey":{"type":"string","description":"Unique identifier for the yield source"},"risk":{"type":"integer","format":"int32","description":"Risk level (0-255, lower is safer)","minimum":0},"source":{"type":"string","description":"Protocol/source name (e.g., \"kamino\", \"marginfi\", \"drift\")"},"updated_at_timestamp":{"type":"integer","format":"int64","description":"Timestamp when the data was last updated","minimum":0},"yield_type":{"type":"string","description":"Type of yield source (e.g., \"Lending\", \"TokenStaking\", etc.)"}}},"ApiYieldSourceIds":{"type":"object","required":["drift","kamino","marginfi","jupiter_lend"],"properties":{"drift":{"type":"string","description":"Drift protocol yield source ID (Put the Pubkey::default() if not used)"},"jupiter_lend":{"type":"string","description":"Jupiter Lend protocol yield source ID (Put the Pubkey::default() if not used)"},"kamino":{"type":"string","description":"Kamino protocol yield source ID (Put the Pubkey::default() if not used)"},"marginfi":{"type":"string","description":"MarginFi protocol yield source ID (Put the Pubkey::default() if not used)"}}},"ApiYieldSourceTarget":{"type":"object","required":["yield_source_type","protocol"],"properties":{"protocol":{"type":"string"},"yield_source_type":{"type":"string"}}},"AssetValuePair":{"type":"object","required":["time","asset","usd_value","value_in_base_asset"],"properties":{"asset":{"type":"string"},"fund_id":{"type":["string","null"]},"time":{"type":"string"},"usd_value":{"type":"number","format":"double"},"value_in_base_asset":{"type":"number","format":"double"}}},"AssetsApyRequest":{"type":"object","description":"Request body for assets APY endpoint","required":["mints"],"properties":{"mints":{"type":"array","items":{"type":"string"},"description":"Array of asset mint addresses to get APY for"}}},"AssetsApyResponse":{"type":"object","description":"Response for assets APY endpoint","required":["apy"],"properties":{"apy":{"type":"string","description":"Maximum APY percentage across all yield sources for the given mints (e.g., \"5.25\")"}}},"CodexToken":{"type":"object","required":["address","symbol","name","decimals"],"properties":{"address":{"type":"string"},"decimals":{"type":"integer","format":"int32"},"logo_uri":{"type":["string","null"]},"name":{"type":"string"},"symbol":{"type":"string"}}},"CombinedAssetValueOverTime":{"type":"object","required":["time","assets"],"properties":{"assets":{"type":"object","additionalProperties":{"type":"number","format":"double"},"propertyNames":{"type":"string"}},"time":{"type":"string"}}},"CreateFundApiResult":{"type":"object","required":["status","task_id","message"],"properties":{"message":{"type":"string"},"status":{"type":"string"},"task_id":{"type":"string"}}},"CreateOrganizationInviteRequest":{"type":"object","description":"Request body for creating an organization invitation","required":["email_address"],"properties":{"email_address":{"type":"string","description":"Email address to send the invitation to"},"inviter_user_id":{"type":["string","null"],"description":"Optional: User ID of the person creating the invitation (for tracking purposes)"},"role":{"type":"string","description":"Role to assign to the invited user (e.g., \"org:member\", \"org:admin\")"}}},"CreateOrganizationInviteResponse":{"type":"object","description":"Response for creating an organization invitation","required":["invitation","message"],"properties":{"invitation":{"$ref":"#/components/schemas/AdminOrganizationInvitation","description":"The created invitation details"},"message":{"type":"string","description":"Success message"}}},"CreateOrganizationRequest":{"type":"object","description":"Request body for creating a new organization via Clerk","required":["name"],"properties":{"name":{"type":"string","description":"Organization name"},"slug":{"type":["string","null"],"description":"Optional slug override"},"tags":{"type":"array","items":{"type":"string"},"description":"Optional tags to set for the organization"}}},"CreateOrganizationResponse":{"type":"object","description":"Response for creating a new organization","required":["organization","message"],"properties":{"message":{"type":"string","description":"Success message"},"organization":{"$ref":"#/components/schemas/AdminOrganization","description":"The created organization details"}}},"CreateStrategyApiResult":{"type":"object","required":["task_id_for_creating_all_funds","status","message"],"properties":{"message":{"type":"string"},"status":{"type":"string"},"strategy_id":{"type":["string","null"]},"task_id_for_creating_all_funds":{"type":"string"}}},"CreateUserFundApiWithInstructionSchema":{"type":"object","required":["create_user_fund_instruction"],"properties":{"create_user_fund_instruction":{"type":"string"}}},"CurrentStrategyData":{"type":"object","required":["current_usd_value","total_users","apy","net_yield","total_deposits_usd","current_earnings_usd","risk","protocol_values","average_strategy_rebalance_cadence"],"properties":{"apy":{"type":"number","format":"double"},"average_strategy_rebalance_cadence":{"type":"integer","format":"int64","minimum":0},"current_earnings_usd":{"type":"number","format":"double"},"current_usd_value":{"type":"number","format":"double"},"net_yield":{"type":"number","format":"double"},"protocol_values":{"type":"array","items":{"$ref":"#/components/schemas/ProtocolValues"}},"risk":{"type":"number","format":"double"},"total_deposits_usd":{"type":"number","format":"double"},"total_users":{"type":"integer","format":"int64","minimum":0}}},"ErrorResponse":{"type":"object","required":["message"],"properties":{"message":{"type":"string","description":"Error message description"}}},"FeeInfoForStrategy":{"type":"object","required":["fee_bps","fee_recipient","frequency_seconds","fee_type"],"properties":{"fee_bps":{"type":"integer","format":"int32","minimum":0},"fee_recipient":{"type":"string"},"fee_type":{"type":"string"},"frequency_seconds":{"type":"integer","format":"int64","minimum":0}}},"FeeTypeForStrategy":{"type":"string","enum":["Uninitialized","ProtocolBase","App","Performance","Referral"]},"FundMetricDataPoint":{"type":"object","description":"Single fund metric data point","required":["time","current_value_usd","current_value","allocated_to_yield_usd","allocated_to_yield","unallocated_amount_usd","unallocated_amount","total_deposits","deposits_usd","withdrawals_usd","current_apy","risk_level","share_price","base_asset_price_usd","user_count","allocation_count"],"properties":{"allocated_to_yield":{"type":"number","format":"double","description":"Amount allocated to yield in base asset"},"allocated_to_yield_usd":{"type":"number","format":"double","description":"Amount allocated to yield in USD"},"allocation_count":{"type":"number","format":"double","description":"Number of allocations"},"base_asset_price_usd":{"type":"number","format":"double","description":"Base asset price in USD"},"current_apy":{"type":"number","format":"double","description":"Current APY"},"current_value":{"type":"number","format":"double","description":"Current value in base asset (with decimals applied)"},"current_value_usd":{"type":"number","format":"double","description":"Current value in USD"},"deposits_usd":{"type":"number","format":"double","description":"Deposits in USD"},"risk_level":{"type":"number","format":"double","description":"Risk level"},"share_price":{"type":"number","format":"double","description":"Share price"},"time":{"type":"string","description":"Timestamp (ISO 8601)"},"total_deposits":{"type":"number","format":"double","description":"Total deposits in base asset"},"unallocated_amount":{"type":"number","format":"double","description":"Unallocated amount in base asset"},"unallocated_amount_usd":{"type":"number","format":"double","description":"Unallocated amount in USD"},"user_count":{"type":"number","format":"double","description":"User count"},"withdrawals_usd":{"type":"number","format":"double","description":"Withdrawals in USD"}}},"FundRef":{"type":"object","required":["mint","fund_id"],"properties":{"allocation_percent":{"type":["number","null"],"format":"double"},"fund_id":{"type":"string"},"mint":{"type":"string"}}},"GlobalConfigResponse":{"type":"object","required":["global_config"],"properties":{"global_config":{"$ref":"#/components/schemas/ApiGlobalConfig","description":"Global configuration information"}}},"InputForCreatingUserFund":{"type":"object","properties":{"fund_id":{"type":["string","null"]},"user_key":{"type":["string","null"]}}},"InputForDeposit":{"type":"object","properties":{"all":{"type":["boolean","null"]},"amount":{"type":["integer","null"],"format":"int64","minimum":0},"base_asset":{"type":["string","null"]},"fund_id":{"type":["string","null"],"description":"Deprecated: `fund_id` is no longer supported for deposits.\nUse `strategy_id` + `base_asset` instead.","deprecated":true},"is_agent":{"type":["boolean","null"]},"payer_key":{"type":["string","null"]},"strategy_id":{"type":["string","null"]},"user_key":{"type":["string","null"]},"user_token_account":{"type":["string","null"]}}},"InputForWithdraw":{"type":"object","properties":{"all":{"type":["boolean","null"]},"amount":{"type":["integer","null"],"format":"int64","minimum":0},"base_asset":{"type":["string","null"]},"create_wsol_ata":{"type":["boolean","null"],"description":"If base asset is WSOL and `user_token_account` is not provided, prepend an ATA-create ix.\nDefaults to `true` when omitted."},"detect_wsol_ata":{"type":["boolean","null"],"description":"If `true`, the API will do an RPC round-trip to detect whether the user's WSOL ATA exists.\nWhen enabled (and base asset is WSOL), this overrides the other WSOL ATA flags:\n- If the WSOL ATA does not exist: `create_wsol_ata=true` and `unwrap_wsol_ata=true`\n- If the WSOL ATA exists: `create_wsol_ata=false` and `unwrap_wsol_ata=false`\n\nDefaults to `false` when omitted."},"exclude_fees":{"type":["boolean","null"],"description":"Defaults to `false`, when true excludes fees from the amount"},"fund_id":{"type":["string","null"],"description":"Deprecated: `fund_id` is no longer supported for withdrawals.\nUse `strategy_id` + `base_asset` instead.","deprecated":true},"is_agent":{"type":["boolean","null"]},"no_balance_checks":{"type":["boolean","null"],"description":"When `true`, skips API-side balance preflight checks: the \"insufficient shares\"\nerror and the requirement that a `user_fund` record exist for the (user, fund)\npair. Intended for test environments like surfpool / mainnet forks where the\non-chain state has balances the API database doesn't know about. The on-chain\nBreeze program still validates share availability, so this only relaxes\nAPI-side preflight — it does not let anyone withdraw funds they don't actually\nown on-chain. Defaults to `false`."},"payer_key":{"type":["string","null"]},"strategy_id":{"type":["string","null"]},"unwrap_wsol_ata":{"type":["boolean","null"],"description":"If base asset is WSOL, unwrap to SOL by syncing and closing the user's WSOL ATA at the end.\nDefaults to `false` when omitted."},"user_key":{"type":["string","null"]},"user_token_account":{"type":["string","null"]}}},"JobsPaginationQuery":{"type":"object","properties":{"page":{"type":["integer","null"],"format":"int32","description":"Page number for pagination (default: 1)","minimum":0},"per_page":{"type":["integer","null"],"format":"int32","description":"Items per page (default: 20, max: 100)","minimum":0}}},"Option":{"oneOf":[{"type":"null"},{"type":"object","required":["fund_id","fees"],"properties":{"fees":{"type":"array","items":{"$ref":"#/components/schemas/ApiFundFee"}},"fund_id":{"type":"string"}}}]},"OrganizationFundsResponse":{"type":"object","description":"Organization funds response with admin flag","required":["funds","is_admin"],"properties":{"funds":{"type":"array","items":{"$ref":"#/components/schemas/ApiFundWithStrategyInfo"}},"is_admin":{"type":"boolean"}}},"PaginatedResponse":{"type":"object","description":"Paginated response wrapper","required":["data","meta"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ProtocolYieldSources"}},"meta":{"$ref":"#/components/schemas/PaginationMeta","description":"Pagination metadata"}}},"PaginationInfo":{"type":"object","required":["page","limit","total_items","total_pages"],"properties":{"limit":{"type":"integer","format":"int32","minimum":0},"page":{"type":"integer","format":"int32","minimum":0},"total_items":{"type":"integer","format":"int32","minimum":0},"total_pages":{"type":"integer","format":"int32","minimum":0}}},"PaginationMeta":{"type":"object","description":"Pagination metadata","required":["page","per_page","total","total_pages","has_more"],"properties":{"has_more":{"type":"boolean","description":"Whether there are more pages"},"page":{"type":"integer","format":"int32","description":"Current page number","minimum":0},"per_page":{"type":"integer","format":"int32","description":"Number of items per page","minimum":0},"total":{"type":"integer","format":"int64","description":"Total number of items","minimum":0},"total_pages":{"type":"integer","format":"int32","description":"Total number of pages","minimum":0}}},"PlatformSummary":{"type":"object","description":"Platform-wide summary metrics","required":["total_tvl_usd","total_users","total_strategies","total_funds","total_organizations","total_allocated_usd","total_unallocated_usd","total_fees_earned_usd","total_yield_earned_usd","average_apy"],"properties":{"average_apy":{"type":"number","format":"double","description":"Platform-wide average APY (weighted by TVL)"},"total_allocated_usd":{"type":"number","format":"double","description":"Total allocated to yield (USD)"},"total_fees_earned_usd":{"type":"number","format":"double","description":"Total fees earned across all strategies (USD)"},"total_funds":{"type":"integer","description":"Total number of funds","minimum":0},"total_organizations":{"type":"integer","description":"Total number of organizations","minimum":0},"total_strategies":{"type":"integer","description":"Total number of strategies","minimum":0},"total_tvl_usd":{"type":"number","format":"double","description":"Total value locked across all funds (USD)"},"total_unallocated_usd":{"type":"number","format":"double","description":"Total unallocated (USD)"},"total_users":{"type":"integer","format":"int64","description":"Total unique users across all funds","minimum":0},"total_yield_earned_usd":{"type":"number","format":"double","description":"Total yield earned across all strategies (USD)"}}},"PortalCreateApiKeyRequest":{"type":"object","properties":{"expires_at":{"type":["integer","null"],"format":"int64","description":"Expiration timestamp (optional)","minimum":0},"name":{"type":["string","null"],"description":"Name/description for the API key"},"scopes":{"type":["array","null"],"items":{"type":"string"},"description":"Permissions or scopes for the API key"}}},"PortalUpdateApiKeyRequest":{"type":"object","properties":{"active":{"type":["boolean","null"],"description":"Whether the API key is active"},"expires_at":{"type":["integer","null"],"format":"int64","description":"Expiration timestamp (optional)","minimum":0},"name":{"type":["string","null"],"description":"Name/description for the API key"}}},"ProtocolValues":{"type":"object","required":["asset","usd_value","protocol","apy"],"properties":{"apy":{"type":"number","format":"double"},"asset":{"type":"string"},"protocol":{"type":"string"},"usd_value":{"type":"number","format":"double"}}},"ProtocolYieldSources":{"type":"object","required":["protocol","yield_sources","count"],"properties":{"count":{"type":"integer","description":"Number of yield sources in this protocol","minimum":0},"protocol":{"type":"string","description":"Protocol/source name (e.g., \"kamino\", \"marginfi\", \"drift\")"},"yield_sources":{"type":"array","items":{"$ref":"#/components/schemas/ApiYieldSource"},"description":"List of yield sources for this protocol"}}},"RevokeOrganizationInviteRequest":{"type":"object","description":"Request body for revoking an organization invitation","required":["requesting_user_id"],"properties":{"requesting_user_id":{"type":"string","description":"User ID of the person requesting the revocation"}}},"RevokeOrganizationInviteResponse":{"type":"object","description":"Response for revoking an organization invitation","required":["invitation","message"],"properties":{"invitation":{"$ref":"#/components/schemas/AdminOrganizationInvitation","description":"The revoked invitation details"},"message":{"type":"string","description":"Success message"}}},"StrategyAvailableAsset":{"type":"object","required":["token_info"],"properties":{"token_info":{"$ref":"#/components/schemas/CodexToken"},"yield_sources":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ApiSelectiveYieldSource"}]}}},"StrategyAvailableAssetsResponse":{"type":"object","required":["assets"],"properties":{"assets":{"type":"array","items":{"$ref":"#/components/schemas/StrategyAvailableAsset"},"description":"List of available strategy assets with their yield sources"}}},"StrategyDetailResponse":{"allOf":[{"$ref":"#/components/schemas/StrategyInstance","description":"The full strategy instance data"},{"type":"object","required":["apy","protocol_allocations"],"properties":{"apy":{"type":"number","format":"double","description":"Computed APY (average of non-zero yield source APYs across allocations)"},"protocol_allocations":{"type":"array","items":{"$ref":"#/components/schemas/ProtocolValues"}}}}],"description":"Detailed strategy response with all computed metrics (optimized batch queries)"},"StrategyInstance":{"type":"object","required":["id","org_id","name","template_id","funds","fee_info","created_at","updated_at"],"properties":{"created_at":{"type":"integer","format":"int64","minimum":0},"description":{"type":["string","null"]},"fee_info":{"type":"array","items":{"$ref":"#/components/schemas/FeeInfoForStrategy"}},"funds":{"type":"array","items":{"$ref":"#/components/schemas/FundRef"}},"id":{"type":"string"},"name":{"type":"string"},"org_id":{"type":"string"},"status":{"$ref":"#/components/schemas/StrategyInstanceStatus"},"template_id":{"type":"string"},"updated_at":{"type":"integer","format":"int64","minimum":0}}},"StrategyInstanceStatus":{"type":"string","enum":["active","pending","failed","updating"]},"StrategyMetrics":{"type":"object","required":["time","usd_value","asset_value_pairs","total_users","apy","organization_cumulative_earnings","deposits_usd","withdrawals_usd"],"properties":{"apy":{"type":"number","format":"double","description":"Weighted APY of the strategy"},"asset_value_pairs":{"type":"array","items":{"$ref":"#/components/schemas/AssetValuePair"},"description":"Values of each asset both in usd and in asset"},"deposits_usd":{"type":"number","format":"double","description":"Total deposits and withdrawals in usd"},"organization_cumulative_earnings":{"type":"number","format":"double","description":"Entire earnings of the strategy in usd"},"time":{"type":"string"},"total_users":{"type":"integer","format":"int64","description":"Amount of unique users in the strategy","minimum":0},"usd_value":{"type":"number","format":"double","description":"Values of entire strategy"},"withdrawals_usd":{"type":"number","format":"double"}}},"StrategyWithListMetrics":{"allOf":[{"$ref":"#/components/schemas/StrategyInstance","description":"The full strategy instance data"},{"type":"object","required":["apy","total_users","tvl_usd","fees_collected_usd"],"properties":{"apy":{"type":"number","format":"double","description":"Weighted APY of the strategy."},"fees_collected_usd":{"type":"number","format":"double","description":"Total fees collected (sum of amount_distributed) across all funds in the strategy."},"total_users":{"type":"integer","format":"int64","description":"Total unique users in the strategy.","minimum":0},"tvl_usd":{"type":"number","format":"double","description":"Total value locked in USD across all funds in the strategy."}}}],"description":"Strategy with full list metrics (TVL, fees, APY, users) for GET /organization/strategies."},"String":{"type":"string"},"StructuredInputForCreatingUserFund":{"type":"object","required":["params"],"properties":{"params":{"$ref":"#/components/schemas/InputForCreatingUserFund"}}},"StructuredInputForDeposit":{"type":"object","required":["params"],"properties":{"params":{"$ref":"#/components/schemas/InputForDeposit"}}},"StructuredInputForWithdraw":{"type":"object","required":["params"],"properties":{"params":{"$ref":"#/components/schemas/InputForWithdraw"}}},"SupportedAssetsByVenueResponse":{"type":"object","required":["venues","venue_to_supported_assets"],"properties":{"venue_to_supported_assets":{"type":"object","description":"Mapping from venue to its supported base assets.","additionalProperties":{"type":"array","items":{"$ref":"#/components/schemas/SupportedVenueAsset"}},"propertyNames":{"type":"string"}},"venues":{"type":"array","items":{"type":"string"},"description":"Canonical venue names."}}},"SupportedAssetsResponse":{"type":"object","required":["supported_base_assets"],"properties":{"supported_base_assets":{"type":"array","items":{"$ref":"#/components/schemas/CodexToken"},"description":"List of supported base assets with metadata"}}},"SupportedVenueAsset":{"type":"object","required":["mint","name","apy"],"properties":{"apy":{"type":"number","format":"double","description":"Current APY for this venue + mint pair (decimal, e.g. 0.052 for 5.2%)"},"mint":{"type":"string","description":"Base asset mint address"},"name":{"type":"string","description":"Common token name (typically symbol, e.g. USDC)"}}},"UniversalStrategyMetrics":{"type":"object","required":["time","allocated_to_yield_usd","current_value_usd","number_of_snapshots","total_deposits_usd","unallocated_amount_usd","organization_cumulative_earnings","deposits_usd","withdrawals_usd","current_apy","risk_level"],"properties":{"allocated_to_yield_usd":{"type":"number","format":"double"},"current_apy":{"type":"number","format":"double"},"current_value_usd":{"type":"number","format":"double"},"deposits_usd":{"type":"number","format":"double"},"number_of_snapshots":{"type":"number","format":"double"},"organization_cumulative_earnings":{"type":"number","format":"double"},"risk_level":{"type":"number","format":"double"},"time":{"type":"string"},"total_deposits_usd":{"type":"number","format":"double"},"unallocated_amount_usd":{"type":"number","format":"double"},"withdrawals_usd":{"type":"number","format":"double"}}},"UserBalance":{"type":"object","required":["token_address","token_symbol","token_name","decimals","total_balance"],"properties":{"decimals":{"type":"integer","format":"int32"},"token_address":{"type":"string"},"token_name":{"type":"string"},"token_symbol":{"type":"string"},"total_balance":{"type":"integer","minimum":0},"yield_balance":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/YieldBalance"}]}}},"UserYield":{"type":"object","required":["fund_id","fund_name","base_asset","position_value","yield_earned","apy","entry_date","last_updated"],"properties":{"apy":{"type":"number","format":"double"},"base_asset":{"type":"string"},"entry_date":{"type":"string"},"fund_id":{"type":"string"},"fund_name":{"type":"string"},"last_updated":{"type":"string"},"position_value":{"type":"integer","minimum":0},"yield_earned":{"type":"integer","minimum":0}}},"Vec":{"type":"array","items":{"allOf":[{"$ref":"#/components/schemas/StrategyInstance","description":"The full strategy instance data"},{"type":"object","required":["apy","total_users"],"properties":{"apy":{"type":"number","format":"double","description":"Weighted APY of the strategy (from latest snapshot, may be stale). Defaults to 0 if no snapshot."},"total_users":{"type":"integer","format":"int64","description":"Total unique users in the strategy (from latest snapshot, may be stale). Defaults to 0 if no snapshot.","minimum":0}}}],"description":"Strategy with pre-computed metrics for list views (avoids N+1 queries)"}},"YieldBalance":{"type":"object","required":["fund_id","funds","amount_of_yield","fund_apy"],"properties":{"amount_of_yield":{"type":"string"},"fund_apy":{"type":"number","format":"double"},"fund_id":{"type":"string"},"funds":{"type":"string"}}},"YieldSourceResponse":{"type":"object","required":["yield_source"],"properties":{"yield_source":{"$ref":"#/components/schemas/ApiYieldSource","description":"Yield source information"}}},"YieldSourcesQuery":{"type":"object","properties":{"base_asset":{"type":["string","null"],"description":"Base asset to filter by (e.g., \"USDC\", \"SOL\", \"ETH\")"},"page":{"type":["integer","null"],"format":"int32","description":"Page number for pagination (default: 1)","minimum":0},"per_page":{"type":["integer","null"],"format":"int32","description":"Items per page (default: 20, max: 100)","minimum":0}}},"f64":{"type":"number","format":"double"}},"securitySchemes":{"api_key":{"type":"apiKey","in":"header","name":"x-api-key"},"bearer_auth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}}},"tags":[{"name":"Admin","description":"Administrative operations"},{"name":"Deposits","description":"Deposit operations"},{"name":"Withdrawals","description":"Withdrawal operations"},{"name":"User Data","description":"User balance and yield data"},{"name":"Funds","description":"Fund management operations"},{"name":"Organization API Keys","description":"Organization API key management"},{"name":"Organization Management","description":"Organization configuration and settings"},{"name":"Partner Stats","description":"Partner statistics and analytics"},{"name":"Global Config","description":"Global configuration and supported assets"},{"name":"Yield Sources","description":"Yield source information and statistics"},{"name":"External APIs","description":"External API integrations and health checks"},{"name":"Organization","description":"Organization onboarding and status"}]}