{"openapi":"3.1.0","info":{"title":"Mapae Agent Payment API","version":"0.2.0","description":"Direct REST interface for commercial AI assistants and agent runtimes. All signing keys stay inside the isolated Mapae Signer Credential Proxy."},"servers":[{"url":"https://mapae.web-three.net"}],"components":{"securitySchemes":{"OwnerSession":{"type":"apiKey","in":"header","name":"X-Mapae-Owner-Session","description":"Owner PWA session token authorizing approval, drift override, revocation, and wallet controls"},"ProxyToken":{"type":"apiKey","in":"header","name":"X-Mapae-Token","description":"Task-scoped assistant proxy token (mpt_...) with zero private keys"}}},"paths":{"/api/v1/health":{"get":{"summary":"Check network, CCIP router, deployed contracts, and HSP adapter mode","responses":{"200":{"description":"Service health"}}}},"/api/v1/workspace":{"get":{"summary":"Fetch authoritative isolated console workspace snapshot","responses":{"200":{"description":"Workspace snapshot"}}}},"/api/v1/owner/session":{"post":{"summary":"Bootstrap an isolated owner workspace session token","responses":{"200":{"description":"Owner session token and isolated workspace cookie"}}}},"/api/v1/mapae":{"post":{"summary":"Request a task-scoped Mapae payment mandate (returns pending_approval without proxyToken)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["task"],"properties":{"assistantName":{"type":"string"},"task":{"type":"string"},"capUsd":{"type":"number","minimum":0.01},"budgetKrw":{"type":"integer","minimum":1},"category":{"type":"string"},"allowedCategories":{"type":"array","items":{"type":"string"}},"walletId":{"type":"string"},"ttlHours":{"type":"integer","minimum":1}}}}}},"responses":{"201":{"description":"Pending Mapae created"}}}},"/api/v1/mapae/{id}/approve":{"post":{"summary":"Owner 1-tap approval; mints scoped mpt_ proxy token once","security":[{"OwnerSession":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Resource identifier (mandateId bytes32 hex or activityId)"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"capUsd":{"type":"number","minimum":0.01},"budgetKrw":{"type":"integer","minimum":1}}}}}},"responses":{"200":{"description":"Active Mapae with one-time proxyToken"},"401":{"description":"Owner session required"}}}},"/api/v1/mapae/{id}/delegate":{"post":{"summary":"Delegate a bounded child Mapae to a sub-agent","security":[{"ProxyToken":[]},{"OwnerSession":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Resource identifier (mandateId bytes32 hex or activityId)"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["subAgentName"],"properties":{"subAgentName":{"type":"string"},"capUsd":{"type":"number","minimum":0.01},"budgetKrw":{"type":"integer","minimum":1}}}}}},"responses":{"201":{"description":"Child Mapae created"}}}},"/api/v1/quote":{"post":{"summary":"Create an authoritative HSP order quote and lock the price snapshot","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["merchantId"],"properties":{"merchantId":{"type":"string"},"sku":{"type":"string"}}}}}},"responses":{"201":{"description":"HSP quote"}}}},"/api/v1/pay":{"post":{"summary":"Execute 7-step HSP settlement using a scoped proxyToken (mpt_...)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["orderId","proxyToken"],"properties":{"orderId":{"type":"string"},"proxyToken":{"type":"string"},"driftApprovalId":{"type":"string"}}}}}},"responses":{"200":{"description":"Settled receipt"},"402":{"description":"Blocked or held (cap exceeded, drift, revoked, scope, expired, replay)"}}}},"/api/v1/mapae/{id}/approve-drift":{"post":{"summary":"Owner 1-tap price-drift confirmation bound immutably to current price and payee","security":[{"OwnerSession":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Resource identifier (mandateId bytes32 hex or activityId)"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["orderId"],"properties":{"orderId":{"type":"string"}}}}}},"responses":{"200":{"description":"One-time drift approval token"}}}},"/api/v1/activities/{id}/approve-drift":{"post":{"summary":"Owner 1-tap drift approval and immediate isolated EIP-712 settlement for a held activity","security":[{"OwnerSession":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Resource identifier (mandateId bytes32 hex or activityId)"}],"responses":{"200":{"description":"Settled receipt and updated workspace"},"402":{"description":"Settlement blocked by cap or policy"}}}},"/api/v1/mapae/{id}/revoke":{"post":{"summary":"Owner emergency revoke on HSK Chain + Chainlink CCIP kill-switch propagation","security":[{"OwnerSession":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Resource identifier (mandateId bytes32 hex or activityId)"}],"responses":{"200":{"description":"Revoked Mapae with CCIP message ID"}}}},"/api/v1/mapae/{id}/close":{"post":{"summary":"Close mission Mapae and anchor receipt Merkle root on HSK Chain","security":[{"ProxyToken":[]},{"OwnerSession":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Resource identifier (mandateId bytes32 hex or activityId)"}],"responses":{"200":{"description":"Closed Mapae with Merkle root"}}}},"/api/v1/scenario/humidifier":{"post":{"summary":"Run end-to-end commercial assistant mission (HTTP 402 lookups + HSP 7-step checkout + cap guard)","security":[{"OwnerSession":[]}],"responses":{"200":{"description":"Mission receipts and updated workspace"}}}},"/api/v1/receipts.csv":{"get":{"summary":"Download formula-safe expense report CSV","responses":{"200":{"description":"CSV attachment"}}}}}}