{"service":"wever-trading-mandate-v1","schemas":{"mandate-issue":{"type":"object","properties":{"mandate":{"oneOf":[{"type":"object","properties":{"mandate_id":{"type":"string","pattern":"^[a-f0-9]{64}$"},"version":{"type":"integer","minimum":1,"maximum":10000},"previous_fingerprint":{"anyOf":[{"type":"string","pattern":"^[a-f0-9]{64}$"},{"type":"null"}]},"principal":{"type":"object","properties":{"account_id":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9_.:-]+$"},"wallet":{"type":["string","null"],"pattern":"^0x[0-9a-fA-F]{40}$"}},"required":["account_id","wallet"],"additionalProperties":false},"approval_path":{"enum":["wallet_signature","broker_attestation"]},"agent_key":{"type":"string","minLength":50,"maxLength":256},"broker":{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-f0-9]{64}$"},"key":{"type":"string","minLength":50,"maxLength":256}},"required":["id","key"],"additionalProperties":false},"venues":{"type":"array","items":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9_.:-]+$"},"minItems":1,"maxItems":16,"uniqueItems":true},"assets":{"type":"array","items":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9_.:-]+$"},"minItems":1,"maxItems":16,"uniqueItems":true},"max_leverage_milli":{"type":"integer","minimum":1000,"maximum":100000},"position_caps":{"type":"object","properties":{"per_asset":{"type":"object","minProperties":1,"maxProperties":16,"propertyNames":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9_.:-]+$"},"additionalProperties":{"type":"integer","minimum":1,"maximum":1000000000000}},"total":{"type":"integer","minimum":1,"maximum":1000000000000}},"required":["per_asset","total"],"additionalProperties":false},"daily_loss_cap":{"type":"integer","minimum":1,"maximum":1000000000000},"daily_reset":{"const":"00:00 UTC"},"order_types":{"type":"array","items":{"enum":["limit","market","reduce-only"]},"minItems":1,"maxItems":16,"uniqueItems":true},"valid_from":{"type":"integer","minimum":1,"maximum":4102444800},"valid_to":{"type":"integer","minimum":1,"maximum":4102444800},"usage":{"enum":["operational","synthetic"]},"profile":{"const":"trading"}},"required":["mandate_id","version","previous_fingerprint","principal","approval_path","agent_key","broker","venues","assets","max_leverage_milli","position_caps","daily_loss_cap","daily_reset","order_types","valid_from","valid_to","usage","profile"],"additionalProperties":false},{"type":"object","properties":{"mandate_id":{"type":"string","pattern":"^[a-f0-9]{64}$"},"version":{"type":"integer","minimum":1,"maximum":10000},"previous_fingerprint":{"anyOf":[{"type":"string","pattern":"^[a-f0-9]{64}$"},{"type":"null"}]},"principal":{"type":"object","properties":{"account_id":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9_.:-]+$"},"wallet":{"type":["string","null"],"pattern":"^0x[0-9a-fA-F]{40}$"}},"required":["account_id","wallet"],"additionalProperties":false},"approval_path":{"enum":["wallet_signature","broker_attestation"]},"agent_key":{"type":"string","minLength":50,"maxLength":256},"broker":{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-f0-9]{64}$"},"key":{"type":"string","minLength":50,"maxLength":256}},"required":["id","key"],"additionalProperties":false},"valid_from":{"type":"integer","minimum":1,"maximum":4102444800},"valid_to":{"type":"integer","minimum":1,"maximum":4102444800},"usage":{"enum":["operational","synthetic"]},"daily_reset":{"const":"00:00 UTC"},"profile":{"const":"treasury"},"asset":{"const":"USDC"},"destination_allowlist":{"type":"array","minItems":1,"maxItems":32,"uniqueItems":true,"items":{"type":"object","properties":{"network":{"type":"string","pattern":"^(paper|eip155:[1-9][0-9]{0,12})$"},"address":{"type":"string","pattern":"^0x[0-9a-f]{40}$"}},"required":["network","address"],"additionalProperties":false}},"per_transaction_cap":{"type":"integer","minimum":1,"maximum":1000000000000},"daily_withdrawal_cap":{"type":"integer","minimum":1,"maximum":1000000000000},"dual_approval":{"type":"object","properties":{"threshold":{"type":"integer","minimum":0,"maximum":1000000000000},"principal_wallets":{"type":"array","minItems":2,"maxItems":8,"uniqueItems":true,"items":{"type":"string","pattern":"^0x[0-9a-f]{40}$"}}},"required":["threshold","principal_wallets"],"additionalProperties":false}},"required":["mandate_id","version","previous_fingerprint","principal","approval_path","agent_key","broker","valid_from","valid_to","usage","daily_reset","profile","asset","destination_allowlist","per_transaction_cap","daily_withdrawal_cap","dual_approval"],"additionalProperties":false}]},"approval":{"type":"object","properties":{"path":{"enum":["wallet_signature","broker_attestation"]},"approved_at":{"type":"integer","minimum":1,"maximum":4102444800},"signature":{"type":"string","maxLength":160},"attestation":{"type":"object","properties":{"context":{"const":"wever.trading-mandate.v1"},"algorithm":{"const":"Ed25519"},"key_id":{"type":"string","pattern":"^[a-f0-9]{64}$"},"payload":{"type":"object"},"signature":{"type":"string","pattern":"^[A-Za-z0-9_-]{86}$"}},"required":["context","algorithm","key_id","payload","signature"],"additionalProperties":false}},"required":["path","approved_at"],"additionalProperties":false}},"required":["mandate","approval"],"additionalProperties":false},"mandate-amend":{"type":"object","properties":{"mandate":{"oneOf":[{"type":"object","properties":{"mandate_id":{"type":"string","pattern":"^[a-f0-9]{64}$"},"version":{"type":"integer","minimum":1,"maximum":10000},"previous_fingerprint":{"anyOf":[{"type":"string","pattern":"^[a-f0-9]{64}$"},{"type":"null"}]},"principal":{"type":"object","properties":{"account_id":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9_.:-]+$"},"wallet":{"type":["string","null"],"pattern":"^0x[0-9a-fA-F]{40}$"}},"required":["account_id","wallet"],"additionalProperties":false},"approval_path":{"enum":["wallet_signature","broker_attestation"]},"agent_key":{"type":"string","minLength":50,"maxLength":256},"broker":{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-f0-9]{64}$"},"key":{"type":"string","minLength":50,"maxLength":256}},"required":["id","key"],"additionalProperties":false},"venues":{"type":"array","items":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9_.:-]+$"},"minItems":1,"maxItems":16,"uniqueItems":true},"assets":{"type":"array","items":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9_.:-]+$"},"minItems":1,"maxItems":16,"uniqueItems":true},"max_leverage_milli":{"type":"integer","minimum":1000,"maximum":100000},"position_caps":{"type":"object","properties":{"per_asset":{"type":"object","minProperties":1,"maxProperties":16,"propertyNames":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9_.:-]+$"},"additionalProperties":{"type":"integer","minimum":1,"maximum":1000000000000}},"total":{"type":"integer","minimum":1,"maximum":1000000000000}},"required":["per_asset","total"],"additionalProperties":false},"daily_loss_cap":{"type":"integer","minimum":1,"maximum":1000000000000},"daily_reset":{"const":"00:00 UTC"},"order_types":{"type":"array","items":{"enum":["limit","market","reduce-only"]},"minItems":1,"maxItems":16,"uniqueItems":true},"valid_from":{"type":"integer","minimum":1,"maximum":4102444800},"valid_to":{"type":"integer","minimum":1,"maximum":4102444800},"usage":{"enum":["operational","synthetic"]},"profile":{"const":"trading"}},"required":["mandate_id","version","previous_fingerprint","principal","approval_path","agent_key","broker","venues","assets","max_leverage_milli","position_caps","daily_loss_cap","daily_reset","order_types","valid_from","valid_to","usage","profile"],"additionalProperties":false},{"type":"object","properties":{"mandate_id":{"type":"string","pattern":"^[a-f0-9]{64}$"},"version":{"type":"integer","minimum":1,"maximum":10000},"previous_fingerprint":{"anyOf":[{"type":"string","pattern":"^[a-f0-9]{64}$"},{"type":"null"}]},"principal":{"type":"object","properties":{"account_id":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9_.:-]+$"},"wallet":{"type":["string","null"],"pattern":"^0x[0-9a-fA-F]{40}$"}},"required":["account_id","wallet"],"additionalProperties":false},"approval_path":{"enum":["wallet_signature","broker_attestation"]},"agent_key":{"type":"string","minLength":50,"maxLength":256},"broker":{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-f0-9]{64}$"},"key":{"type":"string","minLength":50,"maxLength":256}},"required":["id","key"],"additionalProperties":false},"valid_from":{"type":"integer","minimum":1,"maximum":4102444800},"valid_to":{"type":"integer","minimum":1,"maximum":4102444800},"usage":{"enum":["operational","synthetic"]},"daily_reset":{"const":"00:00 UTC"},"profile":{"const":"treasury"},"asset":{"const":"USDC"},"destination_allowlist":{"type":"array","minItems":1,"maxItems":32,"uniqueItems":true,"items":{"type":"object","properties":{"network":{"type":"string","pattern":"^(paper|eip155:[1-9][0-9]{0,12})$"},"address":{"type":"string","pattern":"^0x[0-9a-f]{40}$"}},"required":["network","address"],"additionalProperties":false}},"per_transaction_cap":{"type":"integer","minimum":1,"maximum":1000000000000},"daily_withdrawal_cap":{"type":"integer","minimum":1,"maximum":1000000000000},"dual_approval":{"type":"object","properties":{"threshold":{"type":"integer","minimum":0,"maximum":1000000000000},"principal_wallets":{"type":"array","minItems":2,"maxItems":8,"uniqueItems":true,"items":{"type":"string","pattern":"^0x[0-9a-f]{40}$"}}},"required":["threshold","principal_wallets"],"additionalProperties":false}},"required":["mandate_id","version","previous_fingerprint","principal","approval_path","agent_key","broker","valid_from","valid_to","usage","daily_reset","profile","asset","destination_allowlist","per_transaction_cap","daily_withdrawal_cap","dual_approval"],"additionalProperties":false}]},"approval":{"type":"object","properties":{"path":{"enum":["wallet_signature","broker_attestation"]},"approved_at":{"type":"integer","minimum":1,"maximum":4102444800},"signature":{"type":"string","maxLength":160},"attestation":{"type":"object","properties":{"context":{"const":"wever.trading-mandate.v1"},"algorithm":{"const":"Ed25519"},"key_id":{"type":"string","pattern":"^[a-f0-9]{64}$"},"payload":{"type":"object"},"signature":{"type":"string","pattern":"^[A-Za-z0-9_-]{86}$"}},"required":["context","algorithm","key_id","payload","signature"],"additionalProperties":false}},"required":["path","approved_at"],"additionalProperties":false},"proposal":{"anyOf":[{"type":"object","properties":{"context":{"const":"wever.trading-mandate.v1"},"algorithm":{"const":"Ed25519"},"key_id":{"type":"string","pattern":"^[a-f0-9]{64}$"},"payload":{"type":"object"},"signature":{"type":"string","pattern":"^[A-Za-z0-9_-]{86}$"}},"required":["context","algorithm","key_id","payload","signature"],"additionalProperties":false},{"type":"object","properties":{"payload":{"type":"object"}},"required":["payload"],"additionalProperties":false}]},"proposal_wallet_signature":{"type":"string","maxLength":160}},"required":["mandate","approval","proposal"],"additionalProperties":false},"mandate-status":{"type":"object","properties":{"mandate_id":{"type":"string","pattern":"^[a-f0-9]{64}$"},"fingerprint":{"type":"string","pattern":"^[a-f0-9]{64}$"}},"required":["mandate_id"],"additionalProperties":false},"mandate-halt":{"type":"object","properties":{"mandate_id":{"type":"string","pattern":"^[a-f0-9]{64}$"},"action":{"anyOf":[{"type":"object","properties":{"context":{"const":"wever.trading-mandate.v1"},"algorithm":{"const":"Ed25519"},"key_id":{"type":"string","pattern":"^[a-f0-9]{64}$"},"payload":{"type":"object"},"signature":{"type":"string","pattern":"^[A-Za-z0-9_-]{86}$"}},"required":["context","algorithm","key_id","payload","signature"],"additionalProperties":false},{"type":"object","properties":{"payload":{"type":"object"}},"required":["payload"],"additionalProperties":false}]},"wallet_signature":{"type":"string","maxLength":160}},"required":["mandate_id","action"],"additionalProperties":false},"mandate-revoke":{"type":"object","properties":{"mandate_id":{"type":"string","pattern":"^[a-f0-9]{64}$"},"action":{"anyOf":[{"type":"object","properties":{"context":{"const":"wever.trading-mandate.v1"},"algorithm":{"const":"Ed25519"},"key_id":{"type":"string","pattern":"^[a-f0-9]{64}$"},"payload":{"type":"object"},"signature":{"type":"string","pattern":"^[A-Za-z0-9_-]{86}$"}},"required":["context","algorithm","key_id","payload","signature"],"additionalProperties":false},{"type":"object","properties":{"payload":{"type":"object"}},"required":["payload"],"additionalProperties":false}]},"wallet_signature":{"type":"string","maxLength":160}},"required":["mandate_id","action"],"additionalProperties":false},"mandate-witness":{"type":"object","properties":{"mandate_id":{"type":"string","pattern":"^[a-f0-9]{64}$"},"witness":{"type":"object","properties":{"context":{"const":"wever.trading-mandate.v1"},"algorithm":{"const":"Ed25519"},"key_id":{"type":"string","pattern":"^[a-f0-9]{64}$"},"payload":{"type":"object"},"signature":{"type":"string","pattern":"^[A-Za-z0-9_-]{86}$"}},"required":["context","algorithm","key_id","payload","signature"],"additionalProperties":false}},"required":["mandate_id","witness"],"additionalProperties":false}},"units":{"money":"integer USD millionths","size":"integer asset millionths","leverage":"integer thousandths","time":"Unix seconds UTC"},"prices":{"issue":"2.00 USDC","amend":"2.00 USDC","halt":"Free","revoke":"Free","status":"Free","witness":"Free"},"broker_registration":"Broker ID is SHA-256 of the canonical Ed25519 SPKI PEM public key. Principal approval pins this key to the account and mandate. Broker-attested accounts use the broker key as their approval trust root. Wallet-approved versions additionally bind the principal wallet. A broker key change requires a new mandate.","approval":"Approve the exact canonical version fingerprint with the published personal_sign message or a broker-signed principal_approval attestation. The attestation contains broker_key, account_id, login_method, approved_at, version_fingerprint, version and principal_approved:true. Login methods: passkey, password_mfa, broker_sso. Approval activates a version within five minutes of signing.","evidence":"Executing parties retain hash-chained per-order evidence and signed cancellation records. POST /api/mandate-witness submits only mandate_id and a broker-signed chain_witness with sequence, latest_fingerprint and previous_witness. The registrar retains the timestamp and chain tip.","registry":"GET /api/mandate-status?mandate_id=...&fingerprint=... returns the exact version status with no caching. Live versions also publish active_now for the start time. Poll before routing and while orders rest. On unavailability cancel resting orders and block new risk, while authenticated reduce-only exits remain available.","lifecycle":"Halt and revoke stop every new order and cancel resting orders. Expiry and registry outages still permit authenticated reduce-only exits. A principal-approved amendment can resume a halt. Revocation requires a new mandate. Agent proposals must narrow an active mandate; blocked-order reports remain evidence only.","adapters":{"treasury_paper":{"manifest":"/adapters/treasury-paper/manifest.json","executable":"/adapters/treasury-paper/treasury-paper.mjs","guide":"/adapters/treasury-paper/README.md","executor":"owner-hosted","transport":"http://127.0.0.1:<port>","paper_only":true,"poll_interval_seconds":5},"alpaca_paper":{"manifest":"/adapters/alpaca-paper/manifest.json","executable":"/adapters/alpaca-paper/alpaca-paper.mjs","guide":"/adapters/alpaca-paper/README.md","executor":"owner-hosted","trading_origin":"https://paper-api.alpaca.markets"}},"profiles":{"trading":"Trading limits and reduce-only exits. Previously registered versions without a profile retain trading semantics and their original fingerprints.","treasury":"USDC integer millionths. Destination network/address pairs are exact lowercase EVM-style addresses. Per-transaction and UTC daily caps include maximum fees and all pending reservations. Amount plus maximum fee strictly above the threshold requires two distinct principal wallet signatures pinned in dual_approval.principal_wallets. Both sign actionMessage({kind:treasury_withdrawal_approval,mandate_fingerprint,withdrawal_fingerprint,approved_at,expires_at}); withdrawal_fingerprint hashes the exact agent payload. Approval lifetime is at most 300 seconds. All withdrawals stop after expiry or during registry outages. Profile is immutable across amendments."},"paper_demo":"/api/mandate-demo","page":"/trading-mandate/","workload":{"versions_per_account_generation":240,"mandate_generations_per_account":64,"assets":16,"venues":16,"max_validity_days":30,"registry_read_max_age_seconds":2,"paper_market_max_age_seconds":5,"paper_resting_orders":32}}