{"openapi":"3.0.1","info":{"title":"DcWallet API","description":"DcWallet REST API and Treasury Agent API documentation.","contact":{"name":"DcWallet Engineering"},"license":{"name":"Private"},"version":"1.0.0"},"servers":[{"url":"/","description":"Current host"}],"security":[{"apiKeyAuth":[]}],"tags":[{"name":"8. Treasury Agent","description":"Discover capabilities and manage asynchronous Agent tasks."}],"paths":{"/api/v1/agent/tasks":{"post":{"tags":["8. Treasury Agent"],"summary":"Create an asynchronous Treasury Agent task","operationId":"postAgentTasks","parameters":[{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentTaskRequest"}}},"required":true},"responses":{"400":{"description":"Bad Request","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ApiResponseVoid"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ApiResponseVoid"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ApiResponseVoid"}}}},"202":{"description":"Task accepted for asynchronous processing","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ApiResponseAgentTaskResponse"}}}}}}},"/api/v1/agent/tasks/{taskId}/cancel":{"post":{"tags":["8. Treasury Agent"],"summary":"Cancel a Treasury Agent task","operationId":"postAgentTasksByTaskIdCancel","parameters":[{"name":"taskId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"400":{"description":"Bad Request","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ApiResponseVoid"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ApiResponseVoid"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ApiResponseVoid"}}}},"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ApiResponseAgentTaskResponse"}}}}}}},"/api/v1/agent/tasks/{taskId}":{"get":{"tags":["8. Treasury Agent"],"summary":"Get a Treasury Agent task","operationId":"getAgentTasksByTaskId","parameters":[{"name":"taskId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"400":{"description":"Bad Request","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ApiResponseVoid"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ApiResponseVoid"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ApiResponseVoid"}}}},"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ApiResponseAgentTaskResponse"}}}}}}},"/api/v1/agent/tasks/{taskId}/events":{"get":{"tags":["8. Treasury Agent"],"summary":"List Treasury Agent task events","operationId":"getAgentTasksByTaskIdEvents","parameters":[{"name":"taskId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"400":{"description":"Bad Request","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ApiResponseVoid"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ApiResponseVoid"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ApiResponseVoid"}}}},"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ApiResponseListAgentTaskEventResponse"}}}}}}},"/api/v1/agent/capabilities":{"get":{"tags":["8. Treasury Agent"],"summary":"List Treasury Agent capabilities enabled for the enterprise","operationId":"getAgentCapabilities","responses":{"400":{"description":"Bad Request","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ApiResponseVoid"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ApiResponseVoid"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ApiResponseVoid"}}}},"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ApiResponseListAgentCapabilityResponse"}}}}}}}},"components":{"schemas":{"ApiResponseVoid":{"type":"object","properties":{"code":{"type":"integer","format":"int32"},"message":{"type":"string"},"data":{"type":"object"},"details":{"type":"array","items":{"$ref":"#/components/schemas/ErrorDetail"}},"requestId":{"type":"string"}}},"ErrorDetail":{"type":"object","properties":{"field":{"type":"string"},"reason":{"type":"string"},"allowedValues":{"type":"array","items":{"type":"string"}},"retryable":{"type":"boolean"}}},"AgentTaskRequest":{"required":["capability","input","intent"],"type":"object","properties":{"capability":{"maxLength":80,"minLength":0,"type":"string","description":"Capability code returned by /agent/capabilities.","example":"receivable.invoice.create"},"intent":{"maxLength":2000,"minLength":0,"type":"string","description":"Plain-language objective retained for audit and review.","example":"Prepare a draft invoice for customer-42"},"input":{"type":"object","additionalProperties":{"type":"object","description":"Capability-specific structured input. Discover requirements from the capability before creating a task."},"description":"Capability-specific structured input. Discover requirements from the capability before creating a task."}}},"AgentTaskResponse":{"type":"object","properties":{"id":{"type":"string"},"capability":{"type":"string"},"intent":{"type":"string"},"status":{"type":"string","description":"Task state: created = saved (initial); waiting_authorization = user action required; authorized = approved to run; running = executing; waiting_approval = workflow approval required; completed = finished successfully (terminal); failed = failed (terminal); cancelled = stopped (terminal).","enum":["created","waiting_authorization","authorized","running","waiting_approval","completed","failed","cancelled"]},"requiredActions":{"type":"array","items":{"type":"string"}},"errorMessage":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"completedAt":{"type":"string","format":"date-time"}}},"ApiResponseAgentTaskResponse":{"type":"object","properties":{"code":{"type":"integer","format":"int32"},"message":{"type":"string"},"data":{"$ref":"#/components/schemas/AgentTaskResponse"},"details":{"type":"array","items":{"$ref":"#/components/schemas/ErrorDetail"}},"requestId":{"type":"string"}}},"AgentTaskEventResponse":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","description":"Task event name: task.created = created; task.waiting_authorization = awaiting user authorization; task.authorized = authorized; task.running = executing; task.waiting_approval = approval pending; task.completed = succeeded; task.failed = failed; task.cancelled = cancelled. The final three correspond to terminal task states.","enum":["task.created","task.waiting_authorization","task.authorized","task.running","task.waiting_approval","task.completed","task.failed","task.cancelled"]},"previousStatus":{"type":"string","description":"Task state before the event: created = saved; waiting_authorization = awaiting user; authorized = ready to run; running = executing; waiting_approval = awaiting workflow approval; completed = success (terminal); failed = failure (terminal); cancelled = stopped (terminal).","enum":["created","waiting_authorization","authorized","running","waiting_approval","completed","failed","cancelled"]},"currentStatus":{"type":"string","description":"Task state after the event: created = saved; waiting_authorization = awaiting user; authorized = ready to run; running = executing; waiting_approval = awaiting workflow approval; completed = success (terminal); failed = failure (terminal); cancelled = stopped (terminal).","enum":["created","waiting_authorization","authorized","running","waiting_approval","completed","failed","cancelled"]},"createdAt":{"type":"string","format":"date-time"}}},"ApiResponseListAgentTaskEventResponse":{"type":"object","properties":{"code":{"type":"integer","format":"int32"},"message":{"type":"string"},"data":{"type":"array","items":{"$ref":"#/components/schemas/AgentTaskEventResponse"}},"details":{"type":"array","items":{"$ref":"#/components/schemas/ErrorDetail"}},"requestId":{"type":"string"}}},"AgentCapabilityResponse":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"riskLevel":{"type":"string"},"category":{"type":"string"},"readOnly":{"type":"boolean"},"requiresAuthorization":{"type":"boolean"},"requiresApproval":{"type":"boolean"},"idempotencyRequired":{"type":"boolean"}}},"ApiResponseListAgentCapabilityResponse":{"type":"object","properties":{"code":{"type":"integer","format":"int32"},"message":{"type":"string"},"data":{"type":"array","items":{"$ref":"#/components/schemas/AgentCapabilityResponse"}},"details":{"type":"array","items":{"$ref":"#/components/schemas/ErrorDetail"}},"requestId":{"type":"string"}}}},"securitySchemes":{"apiKeyAuth":{"type":"apiKey","description":"API key from Dashboard > Developer Center. The sk_sandbox_ or sk_live_ prefix selects the isolated environment; the production API host accepts both modes.","name":"X-API-Key","in":"header"}}}}