{"openapi":"3.0.3","info":{"title":"AgentLedger API","version":"0.3.4","description":"The financial control plane for autonomous agents. Caller-supplied financial state is converted into recommendations and policy decisions; the OKX wallet-history adapter is optional."},"servers":[{"url":"/"}],"paths":{"/api/health":{"get":{"operationId":"health","summary":"Service and configuration health","responses":{"200":{"description":"Service is online; upstream connectivity is not tested.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Health"}}}}}}},"/api/company-health":{"post":{"operationId":"companyHealth","summary":"Analyze financial health","description":"Free production endpoint. Preferred mode accepts caller-supplied factual financialState and requires no OKX Open API credentials. For backward compatibility, address requests use the optional live OKX wallet-history adapter and return LIVE_DATA_UNAVAILABLE when it is not configured.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompanyHealthRequest"},"example":{"source":"provided_state","financialState":{"periodDays":30,"cashFlow":{"inflows":342,"outflows":235},"spendVelocity":{"firstHalf":65,"secondHalf":170},"providers":[{"provider":"research-agent","spend":128,"transactions":6}],"failedTransactions":1},"monthlyBudget":500}}}},"responses":{"200":{"description":"Financial response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompanyHealthResponse"}}}},"400":{"description":"Invalid request or malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Live OKX data could not be retrieved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"The live OKX wallet adapter or payment configuration is unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The OKX upstream timed out.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/demo/company-health":{"post":{"operationId":"demoCompanyHealth","summary":"Analyze deterministic demo financial health","description":"Free explicit demo endpoint using deterministic seeded autonomous-company activity. It never invokes x402.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompanyHealthRequest"},"example":{"address":"0xagentcompany","days":30,"monthlyBudget":500}}}},"responses":{"200":{"description":"Financial response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompanyHealthResponse"}}}},"400":{"description":"Invalid request or malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/recommendations":{"post":{"operationId":"recommendations","summary":"Generate prioritized financial recommendations","description":"Paid production endpoint. The value is financial interpretation and prioritized action, not wallet-data fetching. Preferred mode accepts caller-supplied financialState and optional policy; wallet address remains an optional adapter mode. Price: 0.01 USDT/use via x402. An unpaid request returns HTTP 402.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompanyHealthRequest"},"example":{"source":"provided_state","financialState":{"periodDays":30,"cashFlow":{"inflows":342,"outflows":235},"providers":[{"provider":"research-agent","spend":128,"transactions":6}]},"monthlyBudget":500,"policy":{"reservePct":20,"maxProviderConcentrationPct":35}}}}},"responses":{"200":{"description":"Financial response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecommendationsResponse"}}}},"400":{"description":"Invalid request or malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Payment is required. The official OKX x402 SDK returns HTTP 402 and a protocol-compliant PAYMENT-REQUIRED challenge.","headers":{"PAYMENT-REQUIRED":{"description":"Base64-encoded x402 v2 PaymentRequired challenge generated by the OKX SDK.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredResponse"}}}},"502":{"description":"Live OKX data could not be retrieved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"The live OKX wallet adapter or payment configuration is unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The OKX upstream timed out.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/demo/recommendations":{"post":{"operationId":"demoRecommendations","summary":"Generate deterministic demo recommendations","description":"Free explicit demo endpoint using deterministic seeded activity. It never invokes x402.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompanyHealthRequest"},"example":{"address":"0xagentcompany","days":30,"monthlyBudget":500}}}},"responses":{"200":{"description":"Financial response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecommendationsResponse"}}}},"400":{"description":"Invalid request or malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/evaluate-action":{"post":{"operationId":"evaluateAction","summary":"Evaluate an autonomous financial action against policy","description":"Preferred agent-native control primitive. Service purchases accept caller-supplied financial state or optionally use the OKX wallet adapter. Capital allocation always uses caller-supplied strategy state. No capital movement is executed. x402 pay-per-call price: 0.02 USDT/use; unpaid requests return HTTP 402.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EvaluateActionRequest"},"examples":{"servicePurchaseProvidedState":{"value":{"entity":"agent-123","action":{"type":"service_purchase","amount":25,"provider":"research-agent"},"financialState":{"periodDays":30,"cashFlow":{"inflows":342,"outflows":235},"spendVelocity":{"firstHalf":65,"secondHalf":170},"providers":[{"provider":"research-agent","spend":128,"transactions":6}]},"policy":{"monthlySpendLimit":500,"reservePct":20,"maxProviderConcentrationPct":35,"maxSingleActionAmount":100}}},"capitalAllocation":{"value":{"entity":"trading-agent","action":{"type":"capital_allocation","amount":250,"strategy":"momentum-v2"},"state":{"currentStrategyAllocation":1200,"totalCapital":5000,"dailyLossUsed":76},"policy":{"maxStrategyAllocationAbsolute":1500,"maxStrategyAllocationPct":35,"dailyLossLimit":100}}}}}}},"responses":{"200":{"description":"Approve, caution or reject action decision.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EvaluateActionResponse"}}}},"400":{"description":"Invalid request or malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Payment is required. The official OKX x402 SDK returns HTTP 402 and a protocol-compliant PAYMENT-REQUIRED challenge.","headers":{"PAYMENT-REQUIRED":{"description":"Base64-encoded x402 v2 PaymentRequired challenge generated by the OKX SDK.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredResponse"}}}},"502":{"description":"Live OKX data could not be retrieved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"The live OKX wallet adapter or payment configuration is unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The OKX upstream timed out.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/demo/evaluate-action":{"post":{"operationId":"demoEvaluateAction","summary":"Evaluate a deterministic demo action","description":"Free deterministic demo route. Service purchases use seeded activity; capital allocation uses caller-supplied state.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EvaluateActionRequest"},"examples":{"servicePurchaseProvidedState":{"value":{"entity":"agent-123","action":{"type":"service_purchase","amount":25,"provider":"research-agent"},"financialState":{"periodDays":30,"cashFlow":{"inflows":342,"outflows":235},"spendVelocity":{"firstHalf":65,"secondHalf":170},"providers":[{"provider":"research-agent","spend":128,"transactions":6}]},"policy":{"monthlySpendLimit":500,"reservePct":20,"maxProviderConcentrationPct":35,"maxSingleActionAmount":100}}},"capitalAllocation":{"value":{"entity":"trading-agent","action":{"type":"capital_allocation","amount":250,"strategy":"momentum-v2"},"state":{"currentStrategyAllocation":1200,"totalCapital":5000,"dailyLossUsed":76},"policy":{"maxStrategyAllocationAbsolute":1500,"maxStrategyAllocationPct":35,"dailyLossLimit":100}}}}}}},"responses":{"200":{"description":"Approve, caution or reject action decision.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EvaluateActionResponse"}}}},"400":{"description":"Invalid request or malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/can-i-spend":{"post":{"operationId":"canISpend","summary":"Compatibility pre-spend decision","description":"Free specialist compatibility endpoint using the optional OKX wallet-history adapter. It is not an initial Marketplace service.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CanISpendRequest"}}}},"responses":{"200":{"description":"Spend decision.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CanISpendResponse"}}}},"400":{"description":"Invalid request or malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"The optional OKX wallet adapter is not configured.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/demo/can-i-spend":{"post":{"operationId":"demoCanISpend","summary":"Deterministic demo pre-spend decision","description":"Free explicit demo compatibility endpoint.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CanISpendRequest"}}}},"responses":{"200":{"description":"Spend decision.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CanISpendResponse"}}}},"400":{"description":"Invalid request or malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/can-i-allocate":{"post":{"operationId":"canIAllocate","summary":"Compatibility capital policy decision","description":"Free specialist compatibility endpoint. It evaluates caller-supplied capital state and never executes trades.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CanIAllocateRequest"}}}},"responses":{"200":{"description":"Approve, caution or reject capital allocation decision.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CanIAllocateResponse"}}}},"400":{"description":"Invalid request or malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/demo/can-i-allocate":{"post":{"operationId":"demoCanIAllocate","summary":"Deterministic demo capital policy decision","description":"Free explicit demo compatibility endpoint.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CanIAllocateRequest"}}}},"responses":{"200":{"description":"Approve, caution or reject capital allocation decision.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CanIAllocateResponse"}}}},"400":{"description":"Invalid request or malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["INVALID_REQUEST","INVALID_ADDRESS","LIVE_DATA_UNAVAILABLE","OKX_API_ERROR","UPSTREAM_TIMEOUT","PAYMENT_NOT_CONFIGURED","INTERNAL_ERROR"]},"message":{"type":"string"},"retryable":{"type":"boolean","description":"Present when retrying the request may succeed."}}}}},"Health":{"type":"object","required":["status","service","version","coreEngineAvailable","okxWalletAdapterConfigured","demoEndpointsAvailable","policyEngine","x402Configured","payToConfigured"],"properties":{"status":{"type":"string","enum":["ok"]},"service":{"type":"string","example":"AgentLedger"},"version":{"type":"string","example":"0.3.4"},"coreEngineAvailable":{"type":"boolean","example":true},"okxWalletAdapterConfigured":{"type":"boolean","description":"Whether all live OKX wallet-history credentials are configured."},"liveDataConfigured":{"type":"boolean","description":"Backward-compatible alias for okxWalletAdapterConfigured."},"demoEndpointsAvailable":{"type":"boolean","example":true},"policyEngine":{"type":"boolean","example":true},"x402Configured":{"type":"boolean","description":"Whether the paid-route seller address and OKX facilitator credentials are configured."},"payToConfigured":{"type":"boolean","description":"Whether a valid public X Layer-compatible seller address is configured."}}},"PaymentRequiredResponse":{"type":"object","description":"The x402 v2 challenge is carried in the PAYMENT-REQUIRED response header.","additionalProperties":true},"FinancialPolicy":{"type":"object","additionalProperties":false,"description":"Stateless caller-supplied financial policy. Percentage values are 0-100 and monetary limits are non-negative.","properties":{"monthlySpendLimit":{"type":"number","minimum":0},"reservePct":{"type":"number","minimum":0,"maximum":100,"default":20},"cautionBudgetUtilizationPct":{"type":"number","minimum":0,"maximum":100,"default":75},"criticalBudgetUtilizationPct":{"type":"number","minimum":0,"maximum":100,"default":90},"maxProviderConcentrationPct":{"type":"number","minimum":0,"maximum":100,"default":35},"maxSingleActionAmount":{"type":"number","minimum":0},"maxStrategyAllocationPct":{"type":"number","minimum":0,"maximum":100,"default":35},"maxStrategyAllocationAbsolute":{"type":"number","minimum":0},"dailyLossLimit":{"type":"number","minimum":0},"cautionLossUtilizationPct":{"type":"number","minimum":0,"maximum":100,"default":70},"criticalLossUtilizationPct":{"type":"number","minimum":0,"maximum":100,"default":90}}},"FinancialProvider":{"type":"object","required":["provider","spend","transactions"],"additionalProperties":false,"description":"Provider-level successful outgoing activity. failedTransactions counts failed outgoing attempts separately and may be greater than transactions.","properties":{"provider":{"type":"string","minLength":1,"maxLength":256},"spend":{"type":"number","minimum":0},"transactions":{"type":"integer","minimum":0,"description":"Successful outgoing payments to this provider."},"failedTransactions":{"type":"integer","minimum":0,"description":"Failed outgoing attempts to this provider; not included in transactions or spend."}}},"ProvidedFinancialState":{"type":"object","required":["periodDays","cashFlow"],"additionalProperties":false,"description":"Caller-supplied factual financial state. AgentLedger derives conclusions and does not independently attest to these values. Provider lists may be partial. Provider spend cannot exceed total outflows by more than $0.01; successful provider transaction counts cannot exceed explicit successful outgoingTransactions; and explicit failedTransactions must include all provider failedTransactions.","properties":{"periodDays":{"type":"integer","minimum":1,"maximum":90},"cashFlow":{"type":"object","required":["inflows","outflows"],"additionalProperties":false,"description":"Inflows and outflows for the period. Transaction counts describe successful transactions; failed attempts are tracked separately.","properties":{"inflows":{"type":"number","minimum":0},"outflows":{"type":"number","minimum":0},"incomingTransactions":{"type":"integer","minimum":0,"description":"Successful incoming transactions."},"outgoingTransactions":{"type":"integer","minimum":0,"description":"Successful outgoing transactions. Provider transaction totals cannot exceed this value when supplied."}}},"spendVelocity":{"type":"object","additionalProperties":false,"description":"Observed spend in the two half-periods. The values are used for velocity and are not required to equal total outflows when the caller reports a partial observation.","properties":{"firstHalf":{"type":"number","minimum":0},"secondHalf":{"type":"number","minimum":0}}},"providers":{"type":"array","maxItems":100,"description":"Successful outgoing provider payments. Entries with the same provider name are aggregated case-insensitively; the list may be a subset of total spending.","items":{"$ref":"#/components/schemas/FinancialProvider"}},"failedTransactions":{"type":"integer","minimum":0,"description":"Total failed transactions. If omitted, known provider-level failures are derived; if supplied, it must be at least their sum."}}},"ProvidedCompanyHealthRequest":{"type":"object","required":["source","financialState"],"properties":{"source":{"type":"string","enum":["provided_state"]},"financialState":{"$ref":"#/components/schemas/ProvidedFinancialState"},"address":{"type":"string","description":"Optional caller label; it is not verified by AgentLedger."},"monthlyBudget":{"type":"number","minimum":0},"policy":{"$ref":"#/components/schemas/FinancialPolicy"}}},"WalletCompanyHealthRequest":{"type":"object","required":["address"],"properties":{"source":{"type":"string","enum":["okx"]},"address":{"type":"string","minLength":1},"days":{"type":"integer","minimum":1,"maximum":90,"default":30},"monthlyBudget":{"type":"number","minimum":0},"policy":{"$ref":"#/components/schemas/FinancialPolicy"}}},"CompanyHealthRequest":{"oneOf":[{"$ref":"#/components/schemas/ProvidedCompanyHealthRequest"},{"$ref":"#/components/schemas/WalletCompanyHealthRequest"}],"description":"Use source=provided_state with financialState for the preferred agent-native path, or address (optionally source=okx) for the backward-compatible wallet adapter path."},"ServicePurchaseAction":{"type":"object","required":["type","amount","provider"],"additionalProperties":false,"properties":{"type":{"type":"string","enum":["service_purchase"]},"amount":{"type":"number","minimum":0},"provider":{"type":"string","minLength":1}}},"CapitalAllocationAction":{"type":"object","required":["type","amount","strategy"],"additionalProperties":false,"properties":{"type":{"type":"string","enum":["capital_allocation"]},"amount":{"type":"number","minimum":0},"strategy":{"type":"string","minLength":1}}},"CapitalAllocationState":{"type":"object","required":["currentStrategyAllocation","totalCapital","dailyLossUsed"],"additionalProperties":false,"properties":{"currentStrategyAllocation":{"type":"number","minimum":0},"totalCapital":{"type":"number","minimum":0},"dailyLossUsed":{"type":"number","minimum":0}}},"EvaluateActionRequest":{"type":"object","required":["entity","action"],"additionalProperties":false,"description":"Service purchases may use caller-supplied financialState or the optional OKX adapter. Capital allocation requires state and remains caller-supplied.","properties":{"entity":{"type":"string","minLength":1},"source":{"type":"string","enum":["provided_state","okx"]},"action":{"oneOf":[{"$ref":"#/components/schemas/ServicePurchaseAction"},{"$ref":"#/components/schemas/CapitalAllocationAction"}],"discriminator":{"propertyName":"type"}},"financialState":{"$ref":"#/components/schemas/ProvidedFinancialState"},"context":{"type":"object","additionalProperties":false,"properties":{"days":{"type":"integer","minimum":1,"maximum":90}}},"state":{"$ref":"#/components/schemas/CapitalAllocationState"},"policy":{"$ref":"#/components/schemas/FinancialPolicy"}}},"PolicyStatus":{"type":"object","required":["compliant","violations","warnings"],"properties":{"compliant":{"type":"boolean"},"violations":{"type":"integer","minimum":0},"warnings":{"type":"integer","minimum":0}}},"CompanyHealthResponse":{"type":"object","required":["service","analysisVersion","wallet","dataSource","stateVerification","period","currency","assetsAnalyzed","cashFlow","budget","transactions","spendVelocity","topCounterparties","repeatedVendors","failedCounterparties","insights","recommendationSummary","generatedAt"],"properties":{"service":{"type":"string","example":"AgentLedger"},"analysisVersion":{"type":"string","example":"0.3.4"},"wallet":{"type":"string"},"dataSource":{"type":"string","enum":["provided_state","demo","okx"]},"stateVerification":{"type":"string","enum":["caller_supplied","okx_fetched","demo"]},"period":{"type":"object"},"currency":{"type":"string","example":"USD"},"assetsAnalyzed":{"type":"array","items":{"type":"string","enum":["USDT","USDC","USDG"]}},"cashFlow":{"type":"object"},"budget":{"nullable":true,"type":"object"},"transactions":{"type":"object"},"spendVelocity":{"type":"object"},"topCounterparties":{"type":"array","items":{"$ref":"#/components/schemas/Counterparty"}},"repeatedVendors":{"type":"array","items":{"$ref":"#/components/schemas/Counterparty"}},"failedCounterparties":{"type":"array","items":{"$ref":"#/components/schemas/FailedCounterparty"}},"insights":{"type":"array","items":{"$ref":"#/components/schemas/Insight"}},"policyStatus":{"$ref":"#/components/schemas/PolicyStatus"},"recommendationSummary":{"$ref":"#/components/schemas/RecommendationSummary"},"generatedAt":{"type":"string","format":"date-time"}}},"Counterparty":{"type":"object","required":["address","spend","transactions","shareOfSpendPct"],"properties":{"address":{"type":"string"},"spend":{"type":"number"},"transactions":{"type":"integer"},"shareOfSpendPct":{"type":"number"}}},"FailedCounterparty":{"type":"object","required":["address","transactions"],"properties":{"address":{"type":"string"},"transactions":{"type":"integer"}}},"RecommendationSummary":{"type":"object","required":["financialStatus","topPriority","recommendationsEndpoint"],"properties":{"financialStatus":{"type":"string","enum":["healthy","caution","critical"]},"topPriority":{"type":"string"},"recommendationsEndpoint":{"type":"string"}}},"Insight":{"type":"object","required":["type","severity","title","message","metric"],"properties":{"type":{"type":"string"},"severity":{"type":"string","enum":["info","positive","warning","critical"]},"title":{"type":"string"},"message":{"type":"string"},"metric":{"type":"number"}}},"FinancialRecommendation":{"type":"object","required":["priority","type","severity","title","finding","implication","recommendation","expectedImpact"],"properties":{"priority":{"type":"integer","minimum":1,"maximum":3},"type":{"type":"string"},"severity":{"type":"string","enum":["low","medium","high","critical"]},"title":{"type":"string"},"finding":{"type":"string"},"implication":{"type":"string"},"recommendation":{"type":"string"},"action":{"type":"object"},"target":{"type":"object"},"evidence":{"type":"object"},"expectedImpact":{"type":"string"}}},"RecommendationsResponse":{"type":"object","required":["service","version","dataSource","stateVerification","financialStatus","executiveSummary","recommendedActions","generatedAt"],"properties":{"service":{"type":"string"},"version":{"type":"string"},"dataSource":{"type":"string","enum":["provided_state","demo","okx"]},"stateVerification":{"type":"string","enum":["caller_supplied","okx_fetched","demo"]},"financialStatus":{"type":"string","enum":["healthy","caution","critical"]},"executiveSummary":{"type":"string"},"recommendedActions":{"type":"array","maxItems":3,"items":{"$ref":"#/components/schemas/FinancialRecommendation"}},"generatedAt":{"type":"string","format":"date-time"}}},"PolicyViolation":{"type":"object","required":["rule","severity","limit","current","projected","message"],"properties":{"rule":{"type":"string"},"severity":{"type":"string","enum":["low","medium","high","critical"]},"limit":{"type":"number"},"current":{"type":"number"},"projected":{"type":"number"},"message":{"type":"string"}}},"EvaluateActionResponse":{"type":"object","required":["service","version","actionType","dataSource","stateVerification","decision","approved","risk","reason","violatedPolicies","warnings","recommendation","projectedState","generatedAt"],"properties":{"service":{"type":"string"},"version":{"type":"string"},"actionType":{"type":"string","enum":["service_purchase","capital_allocation"]},"dataSource":{"type":"string","enum":["provided_state","demo","okx"]},"stateVerification":{"type":"string","enum":["caller_supplied","okx_fetched","demo"]},"decision":{"type":"string","enum":["approve","caution","reject"]},"approved":{"type":"boolean"},"risk":{"type":"string","enum":["low","medium","high","critical"]},"reason":{"type":"string"},"violatedPolicies":{"type":"array","items":{"$ref":"#/components/schemas/PolicyViolation"}},"warnings":{"type":"array","items":{"$ref":"#/components/schemas/PolicyViolation"}},"recommendation":{"type":"string"},"recommendedAction":{"type":"object"},"projectedState":{"type":"object"},"generatedAt":{"type":"string","format":"date-time"}}},"CanISpendRequest":{"type":"object","required":["address","proposedSpend","monthlyBudget"],"properties":{"address":{"type":"string","minLength":1},"proposedSpend":{"type":"number","minimum":0},"monthlyBudget":{"type":"number","minimum":0},"days":{"type":"integer","minimum":1,"maximum":90},"vendor":{"type":"string","minLength":1}}},"CanIAllocateRequest":{"type":"object","required":["agent","strategy","proposedCapital","currentStrategyAllocation","totalCapital","strategyCapitalLimit","dailyLossUsed","dailyLossLimit"],"properties":{"agent":{"type":"string","minLength":1},"strategy":{"type":"string","minLength":1},"proposedCapital":{"type":"number","minimum":0},"currentStrategyAllocation":{"type":"number","minimum":0},"totalCapital":{"type":"number","minimum":0},"strategyCapitalLimit":{"type":"number","minimum":0},"dailyLossUsed":{"type":"number","minimum":0},"dailyLossLimit":{"type":"number","minimum":0}}},"CanISpendResponse":{"type":"object","required":["service","analysisVersion","dataSource","decision","approved"],"properties":{"service":{"type":"string"},"analysisVersion":{"type":"string"},"dataSource":{"type":"string","enum":["provided_state","demo","okx"]},"stateVerification":{"type":"string","enum":["caller_supplied","okx_fetched","demo"]},"decision":{"type":"string","enum":["approve","caution","reject"]},"approved":{"type":"boolean"},"risk":{"type":"string","enum":["low","medium","high"]},"reason":{"type":"string"},"financialImpact":{"type":"object"},"recommendation":{"type":"string"},"warnings":{"type":"array","items":{"type":"string"}}}},"CanIAllocateResponse":{"type":"object","required":["service","analysisVersion","dataSource","stateVerification","decision","approved","risk","reason","capital","lossBudget","recommendedAction"],"properties":{"service":{"type":"string"},"analysisVersion":{"type":"string"},"dataSource":{"type":"string","enum":["provided_state","demo","okx"]},"stateVerification":{"type":"string","enum":["caller_supplied","okx_fetched","demo"]},"decision":{"type":"string","enum":["approve","caution","reject"]},"approved":{"type":"boolean"},"risk":{"type":"string","enum":["low","medium","high"]},"reason":{"type":"string"},"capital":{"type":"object"},"lossBudget":{"type":"object"},"recommendedAction":{"type":"object"}}}}}}