{"openapi":"3.1.0","info":{"title":"KeyScrow rental actions","version":"1.0.0","description":"Scooter-rental deposit and rent escrow on BNB Chain. Reads return JSON; prepare_* return UNSIGNED, simulated transactions for the caller's own wallet: this API never holds a key and never sends a transaction. The same actions are MCP tools on the KeyScrow Inspector agent (docs/AGENT.md). Amounts: USDT has 18 decimals; `units` fields are base units."},"paths":{"/api/v1/get_lease":{"get":{"operationId":"get_lease","summary":"Get a rental","description":"Read one KeyScrow rental straight from the chain: owner, renter, dispute desk, rent and deposit (in mUSDT, with baht/dollar equivalents), rent period, periods paid and paid out, the current deposit proposal and any running deadline. Use explain_status for a plain-language summary instead. Who: anyone.","tags":["Reads"],"x-roles":["anyone"],"responses":{"200":{"description":"Result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown action, or not a KeyScrow rental","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Wrong role or rental status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The transaction would revert (simulated); `error` says why","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Chain node or price source unreachable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"lease","in":"query","required":true,"description":"Address of the rental's RentalEscrow contract.","schema":{"title":"Rental (escrow) address","description":"Address of the rental's RentalEscrow contract.","type":"string"}},{"name":"chainId","in":"query","required":false,"description":"56 (31337 = local anvil, 97 = BSC testnet, 5611 = opBNB testnet, 56 = BSC mainnet). Defaults to the chain this server is configured for.","schema":{"title":"Chain","description":"56 (31337 = local anvil, 97 = BSC testnet, 5611 = opBNB testnet, 56 = BSC mainnet). Defaults to the chain this server is configured for.","type":"number"}}]}},"/api/v1/list_leases":{"get":{"operationId":"list_leases","summary":"List rentals of a wallet","description":"List the KeyScrow rentals a wallet is part of, newest first, from the factory's on-chain index (no indexer needed). Give `role` to only list rentals where the wallet is the owner, the renter or the dispute desk. Who: anyone.","tags":["Reads"],"x-roles":["anyone"],"responses":{"200":{"description":"Result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown action, or not a KeyScrow rental","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Wrong role or rental status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The transaction would revert (simulated); `error` says why","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Chain node or price source unreachable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"party","in":"query","required":true,"description":"The wallet whose rentals to list.","schema":{"title":"Wallet","description":"The wallet whose rentals to list.","type":"string"}},{"name":"role","in":"query","required":false,"description":"Only rentals where the wallet has this role (owner = landlord, renter = tenant, arbiter = dispute desk). Default: all three.","schema":{"title":"Role","description":"Only rentals where the wallet has this role (owner = landlord, renter = tenant, arbiter = dispute desk). Default: all three.","type":"string","enum":["owner","renter","arbiter"]}},{"name":"limit","in":"query","required":false,"description":"Most rentals to return per role (newest first).","schema":{"default":20,"type":"integer","minimum":1,"maximum":50,"title":"Limit","description":"Most rentals to return per role (newest first)."}},{"name":"chainId","in":"query","required":false,"description":"56 (31337 = local anvil, 97 = BSC testnet, 5611 = opBNB testnet, 56 = BSC mainnet). Defaults to the chain this server is configured for.","schema":{"title":"Chain","description":"56 (31337 = local anvil, 97 = BSC testnet, 5611 = opBNB testnet, 56 = BSC mainnet). Defaults to the chain this server is configured for.","type":"number"}}]}},"/api/v1/explain_status":{"get":{"operationId":"explain_status","summary":"Explain where the deposit is","description":"Plain-language answer to \"where is my deposit and what happens next?\" for one rental: who holds the deposit, what each party can do now (with the prepare_* tool for it), and who must act by when (deadlines in UTC, from chain time). Pass `viewer` to phrase it for that wallet. Show the `text` field to the person as is. Who: anyone.","tags":["Reads"],"x-roles":["anyone"],"responses":{"200":{"description":"Result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown action, or not a KeyScrow rental","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Wrong role or rental status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The transaction would revert (simulated); `error` says why","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Chain node or price source unreachable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"lease","in":"query","required":true,"description":"Address of the rental's RentalEscrow contract.","schema":{"title":"Rental (escrow) address","description":"Address of the rental's RentalEscrow contract.","type":"string"}},{"name":"viewer","in":"query","required":false,"description":"Optional: the person asking, so the answer says what *they* can do.","schema":{"title":"Viewer wallet","description":"Optional: the person asking, so the answer says what *they* can do.","type":"string"}},{"name":"chainId","in":"query","required":false,"description":"56 (31337 = local anvil, 97 = BSC testnet, 5611 = opBNB testnet, 56 = BSC mainnet). Defaults to the chain this server is configured for.","schema":{"title":"Chain","description":"56 (31337 = local anvil, 97 = BSC testnet, 5611 = opBNB testnet, 56 = BSC mainnet). Defaults to the chain this server is configured for.","type":"number"}}]}},"/api/v1/quote":{"get":{"operationId":"quote","summary":"Convert baht / dollars / mUSDT","description":"Convert an amount between Thai baht (THB), US dollars (USD) and the rental token (mUSDT, a test USDT) at the current rate (Atlas on-chain feeds, then CoinMarketCap, else clearly marked demo rates: check `mock`). Use it to turn \"3,000 baht a month\" into the mUSDT amount the contract stores. Who: anyone.","tags":["Reads"],"x-roles":["anyone"],"responses":{"200":{"description":"Result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown action, or not a KeyScrow rental","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Wrong role or rental status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The transaction would revert (simulated); `error` says why","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Chain node or price source unreachable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"amount","in":"query","required":true,"description":"Amount to convert, e.g. \"18000\".","schema":{"title":"Amount","description":"Amount to convert, e.g. \"18000\".","type":["string","number"]}},{"name":"currency","in":"query","required":false,"description":"Currency of `amount`: THB, USD or USDT (= mUSDT).","schema":{"default":"THB","type":"string","enum":["THB","USD","USDT"],"title":"Currency","description":"Currency of `amount`: THB, USD or USDT (= mUSDT)."}}]}},"/api/v1/wallet_history":{"get":{"operationId":"wallet_history","summary":"Wallet history for the dispute desk","description":"A wallet's track record on KeyScrow, for a dispute: rentals as renter and as owner, how many settled, every dispute (who opened it, who got what), the owner's deposit claims next to the AI inspection's proposal, rent paid on time vs late, and timeouts. Exact numbers from the chain; `summary` says it in plain sentences. `memory` lists what Living Brain remembers about the wallet (one factual entry per settled rental, with its transaction). Wallet addresses only, no names. The AI summarises; the dispute desk decides. Who: anyone.","tags":["Reads"],"x-roles":["anyone"],"responses":{"200":{"description":"Result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown action, or not a KeyScrow rental","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Wrong role or rental status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The transaction would revert (simulated); `error` says why","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Chain node or price source unreachable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"wallet","in":"query","required":true,"description":"The renter's or owner's wallet.","schema":{"title":"Wallet","description":"The renter's or owner's wallet.","type":"string"}},{"name":"chainId","in":"query","required":false,"description":"56 (31337 = local anvil, 97 = BSC testnet, 5611 = opBNB testnet, 56 = BSC mainnet). Defaults to the chain this server is configured for.","schema":{"title":"Chain","description":"56 (31337 = local anvil, 97 = BSC testnet, 5611 = opBNB testnet, 56 = BSC mainnet). Defaults to the chain this server is configured for.","type":"number"}}]}},"/api/v1/prepare_create_lease":{"post":{"operationId":"prepare_create_lease","summary":"Create a rental","description":"Prepare the transaction that creates a rental offer, signed by the owner. Amounts can be given in baht, dollars or mUSDT; baht/dollars are converted at the current rate (see `summary`). `rent` is a monthly price; with weekly or two-weekly rent (`rentPeriodDays` 7 or 14) the rent per period is monthly x days / 30, rounded down. The deposit is either an amount or a number of months of rent. The renter then funds it with prepare_fund. Returns the unsigned transaction and, in `expected.lease`, the rental's address if nobody else creates one first. Who: the owner (landlord on-chain). Returns {chainId, steps:[{to, data, value, description}], summary} with UNSIGNED transactions, already simulated on the chain; show the summary, then have the person sign the steps in order with their own wallet. Nothing is sent by this tool.","tags":["Prepare (unsigned transactions)"],"x-roles":["owner"],"responses":{"200":{"description":"Unsigned, simulated transactions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Prepared"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown action, or not a KeyScrow rental","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Wrong role or rental status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The transaction would revert (simulated); `error` says why","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Chain node or price source unreachable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"from":{"title":"Signer address","description":"Wallet that will sign these transactions (the owner, who becomes the landlord on-chain). Used to check permissions and to simulate; no key is needed.","type":"string"},"renter":{"title":"Renter wallet","description":"Wallet of the renter (tenant on-chain); it pays the deposit and rent.","type":"string"},"rent":{"title":"Monthly rent","description":"Rent per 30-day month, in `currency`, e.g. \"3000\". Charged per rent period (see `rentPeriodDays`).","x-unit":"currency","type":["string","number"]},"rentPeriodDays":{"default":30,"title":"Rent period","description":"How often rent is paid: every 7, 14 or 30 days (default 30).","x-unit":"days","type":"number"},"currency":{"default":"THB","type":"string","enum":["THB","USD","USDT"],"title":"Currency","description":"Currency of `rent` and `deposit`: THB (default), USD or USDT (= mUSDT, stored as is)."},"deposit":{"title":"Deposit","description":"Security deposit, in `currency`. Give this or `depositMonths`.","type":["string","number"]},"depositMonths":{"type":"integer","minimum":1,"maximum":12,"title":"Deposit (months of rent)","description":"Security deposit as a number of months of rent, e.g. 2. Give this or `deposit`.","x-unit":"months"},"termPeriods":{"type":"integer","minimum":1,"maximum":60,"title":"Term","description":"Length of the rental in rent periods (1 to 60), e.g. 4 with weekly rent = 4 weeks.","x-unit":"periods"},"responseWindowDays":{"default":7,"type":"integer","minimum":1,"maximum":60,"title":"Owner's reply window","description":"Days the owner has to answer the renter's return proposal; if silent, the full deposit goes back to the renter.","x-unit":"days"},"arbiterWindowDays":{"default":14,"type":"integer","minimum":1,"maximum":90,"title":"Dispute desk deadline","description":"Days the dispute desk has to rule on a dispute; after that the full deposit can go back to the renter.","x-unit":"days"},"arbiter":{"title":"Dispute desk","description":"Optional: your own neutral reviewer. Omit to use the KeyScrow dispute desk.","type":"string"},"leaseHash":{"title":"Rental agreement hash","description":"Optional sha256 of the signed agreement (from POST /api/evidence).","type":"string"},"payee":{"title":"Payout address","description":"Optional: where the owner's rent and any deposit claim are paid, e.g. a Fleet Vault whose shareholders own the scooter. The owner keeps every role. Default: the owner.","type":"string"},"chainId":{"title":"Chain","description":"56 (31337 = local anvil, 97 = BSC testnet, 5611 = opBNB testnet, 56 = BSC mainnet). Defaults to the chain this server is configured for.","type":"number"}},"required":["from","renter","rent","termPeriods"],"additionalProperties":false},"example":{"from":"0x70997970C51812dc3A010C7d01b50e0d17dc79C8","renter":"0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC","rent":"18000","currency":"THB","depositMonths":2,"termPeriods":12}}}}}},"/api/v1/prepare_fund":{"post":{"operationId":"prepare_fund","summary":"Fund the rental (renter)","description":"Prepare the renter's transactions to start the rental: approve the escrow to take deposit + the first period's rent (skipped if already approved), then fund(). Sign them in order. Who: the renter (tenant on-chain). Needs rental status: Created. Returns {chainId, steps:[{to, data, value, description}], summary} with UNSIGNED transactions, already simulated on the chain; show the summary, then have the person sign the steps in order with their own wallet. Nothing is sent by this tool.","tags":["Prepare (unsigned transactions)"],"x-roles":["renter"],"x-statuses":["Created"],"responses":{"200":{"description":"Unsigned, simulated transactions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Prepared"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown action, or not a KeyScrow rental","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Wrong role or rental status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The transaction would revert (simulated); `error` says why","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Chain node or price source unreachable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"lease":{"title":"Rental (escrow) address","description":"Address of the rental's RentalEscrow contract.","type":"string"},"from":{"title":"Signer address","description":"Wallet that will sign these transactions (the renter). Used to check permissions and to simulate; no key is needed.","type":"string"},"chainId":{"title":"Chain","description":"56 (31337 = local anvil, 97 = BSC testnet, 5611 = opBNB testnet, 56 = BSC mainnet). Defaults to the chain this server is configured for.","type":"number"}},"required":["lease","from"],"additionalProperties":false},"example":{"lease":"0x9f1ac54BEF0DD2f6f3462EA0fa94fC62300d3a8e","from":"0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC"}}}}}},"/api/v1/prepare_release_rent":{"post":{"operationId":"prepare_release_rent","summary":"Pay out due rent","description":"Prepare the transaction that pays funded rent out to the owner. Anyone may release rent periods that are due; the renter may also release prepaid periods early. Who: anyone. Needs rental status: Active or MoveOut or Disputed. Returns {chainId, steps:[{to, data, value, description}], summary} with UNSIGNED transactions, already simulated on the chain; show the summary, then have the person sign the steps in order with their own wallet. Nothing is sent by this tool.","tags":["Prepare (unsigned transactions)"],"x-roles":["anyone"],"x-statuses":["Active","MoveOut","Disputed"],"responses":{"200":{"description":"Unsigned, simulated transactions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Prepared"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown action, or not a KeyScrow rental","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Wrong role or rental status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The transaction would revert (simulated); `error` says why","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Chain node or price source unreachable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"lease":{"title":"Rental (escrow) address","description":"Address of the rental's RentalEscrow contract.","type":"string"},"from":{"title":"Signer address","description":"Wallet that will sign these transactions (anyone; the renter may also release early). Used to check permissions and to simulate; no key is needed.","type":"string"},"chainId":{"title":"Chain","description":"56 (31337 = local anvil, 97 = BSC testnet, 5611 = opBNB testnet, 56 = BSC mainnet). Defaults to the chain this server is configured for.","type":"number"}},"required":["lease","from"],"additionalProperties":false},"example":{"lease":"0x9f1ac54BEF0DD2f6f3462EA0fa94fC62300d3a8e","from":"0x70997970C51812dc3A010C7d01b50e0d17dc79C8"}}}}}},"/api/v1/prepare_add_evidence":{"post":{"operationId":"prepare_add_evidence","summary":"Anchor photos or a document","description":"Prepare the transaction that anchors the hash of off-chain evidence (pickup photos, return photos, a report) on the rental. Upload the file first with POST /api/evidence and pass the returned sha256 `hash` here. Who: the owner (landlord on-chain) or the renter (tenant on-chain). Needs rental status: Created or Active or MoveOut or Disputed. Returns {chainId, steps:[{to, data, value, description}], summary} with UNSIGNED transactions, already simulated on the chain; show the summary, then have the person sign the steps in order with their own wallet. Nothing is sent by this tool.","tags":["Prepare (unsigned transactions)"],"x-roles":["owner","renter"],"x-statuses":["Created","Active","MoveOut","Disputed"],"responses":{"200":{"description":"Unsigned, simulated transactions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Prepared"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown action, or not a KeyScrow rental","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Wrong role or rental status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The transaction would revert (simulated); `error` says why","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Chain node or price source unreachable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"lease":{"title":"Rental (escrow) address","description":"Address of the rental's RentalEscrow contract.","type":"string"},"from":{"title":"Signer address","description":"Wallet that will sign these transactions (the owner or the renter). Used to check permissions and to simulate; no key is needed.","type":"string"},"kind":{"type":"string","enum":["check_in","check_out","other"],"title":"Kind","description":"check_in = pickup photos, check_out = return photos, other = anything else."},"contentHash":{"title":"Content hash","description":"sha256 of the file (or photo manifest) from POST /api/evidence.","type":"string"},"chainId":{"title":"Chain","description":"56 (31337 = local anvil, 97 = BSC testnet, 5611 = opBNB testnet, 56 = BSC mainnet). Defaults to the chain this server is configured for.","type":"number"}},"required":["lease","from","kind","contentHash"],"additionalProperties":false},"example":{"lease":"0x9f1ac54BEF0DD2f6f3462EA0fa94fC62300d3a8e","from":"0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC","kind":"check_out","contentHash":"0x9d9e1f7ac51b4a8f8a3c1f0b3d8f0f6e3e2b1c0d9a8b7c6d5e4f3a2b1c0d9e8f"}}}}}},"/api/v1/prepare_propose_settlement":{"post":{"operationId":"prepare_propose_settlement","summary":"Propose the deposit split","description":"Prepare the transaction that proposes how the deposit is split at return. Either pass the AI inspection result (`inspection`, from inspect_move_out) or an amount (`toRenter`) with an optional `note`. A new proposal replaces the previous one. If the renter proposes and the owner stays silent past the reply window, the full deposit goes back to the renter. Who: the owner (landlord on-chain) or the renter (tenant on-chain). Needs rental status: Active or MoveOut. Returns {chainId, steps:[{to, data, value, description}], summary} with UNSIGNED transactions, already simulated on the chain; show the summary, then have the person sign the steps in order with their own wallet. Nothing is sent by this tool.","tags":["Prepare (unsigned transactions)"],"x-roles":["owner","renter"],"x-statuses":["Active","MoveOut"],"responses":{"200":{"description":"Unsigned, simulated transactions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Prepared"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown action, or not a KeyScrow rental","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Wrong role or rental status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The transaction would revert (simulated); `error` says why","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Chain node or price source unreachable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"lease":{"title":"Rental (escrow) address","description":"Address of the rental's RentalEscrow contract.","type":"string"},"from":{"title":"Signer address","description":"Wallet that will sign these transactions (the owner or the renter). Used to check permissions and to simulate; no key is needed.","type":"string"},"toRenter":{"x-unit":"USDT","title":"Deposit back to the renter","description":"How much of the deposit goes back to the renter, in mUSDT (e.g. \"400\"). The rest goes to the owner.","type":["string","number"]},"inspection":{"type":"object","properties":{"tenantRefund":{"type":"string","pattern":"^\\d+$","title":"Refund (base units)","description":"From the inspection result."},"reportHash":{"title":"Report hash","description":"From the inspection result.","type":"string"},"deposit":{"type":"string","pattern":"^\\d+$"}},"required":["tenantRefund","reportHash"],"additionalProperties":{},"title":"AI inspection result","description":"The full result of the inspect_move_out tool (or POST /api/settlement). Its tenantRefund and reportHash are used as is."},"reportHash":{"title":"Report hash","description":"Optional hash of your own report backing the split (default: hash of `note`).","type":"string"},"note":{"type":"string","minLength":1,"maxLength":1000,"title":"Reason","description":"Optional short reason, hashed into reportHash when no report is given."},"chainId":{"title":"Chain","description":"56 (31337 = local anvil, 97 = BSC testnet, 5611 = opBNB testnet, 56 = BSC mainnet). Defaults to the chain this server is configured for.","type":"number"}},"required":["lease","from"],"additionalProperties":false},"example":{"lease":"0x9f1ac54BEF0DD2f6f3462EA0fa94fC62300d3a8e","from":"0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC","toRenter":"800","note":"Small scratch on the left panel"}}}}}},"/api/v1/prepare_accept":{"post":{"operationId":"prepare_accept","summary":"Accept the proposal","description":"Prepare the transaction that accepts the current deposit proposal; the deposit pays out immediately. Only the side that did NOT make the proposal can accept. Pass `nonce` (from get_lease) to make sure you accept exactly the proposal you reviewed. Who: the owner (landlord on-chain) or the renter (tenant on-chain). Needs rental status: MoveOut. Returns {chainId, steps:[{to, data, value, description}], summary} with UNSIGNED transactions, already simulated on the chain; show the summary, then have the person sign the steps in order with their own wallet. Nothing is sent by this tool.","tags":["Prepare (unsigned transactions)"],"x-roles":["owner","renter"],"x-statuses":["MoveOut"],"responses":{"200":{"description":"Unsigned, simulated transactions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Prepared"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown action, or not a KeyScrow rental","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Wrong role or rental status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The transaction would revert (simulated); `error` says why","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Chain node or price source unreachable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"lease":{"title":"Rental (escrow) address","description":"Address of the rental's RentalEscrow contract.","type":"string"},"from":{"title":"Signer address","description":"Wallet that will sign these transactions (the side that did not make the proposal). Used to check permissions and to simulate; no key is needed.","type":"string"},"nonce":{"type":"integer","minimum":1,"maximum":4294967295,"title":"Proposal number","description":"Optional: the proposal # you reviewed. Default: the current one."},"chainId":{"title":"Chain","description":"56 (31337 = local anvil, 97 = BSC testnet, 5611 = opBNB testnet, 56 = BSC mainnet). Defaults to the chain this server is configured for.","type":"number"}},"required":["lease","from"],"additionalProperties":false},"example":{"lease":"0x9f1ac54BEF0DD2f6f3462EA0fa94fC62300d3a8e","from":"0x70997970C51812dc3A010C7d01b50e0d17dc79C8","nonce":1}}}}}},"/api/v1/prepare_dispute":{"post":{"operationId":"prepare_dispute","summary":"Open a dispute","description":"Prepare the transaction that sends the rental to the dispute desk. The deposit stays frozen until the desk rules; if it does not rule within its deadline, the full deposit can go back to the renter. Who: the owner (landlord on-chain) or the renter (tenant on-chain). Needs rental status: Active or MoveOut. Returns {chainId, steps:[{to, data, value, description}], summary} with UNSIGNED transactions, already simulated on the chain; show the summary, then have the person sign the steps in order with their own wallet. Nothing is sent by this tool.","tags":["Prepare (unsigned transactions)"],"x-roles":["owner","renter"],"x-statuses":["Active","MoveOut"],"responses":{"200":{"description":"Unsigned, simulated transactions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Prepared"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown action, or not a KeyScrow rental","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Wrong role or rental status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The transaction would revert (simulated); `error` says why","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Chain node or price source unreachable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"lease":{"title":"Rental (escrow) address","description":"Address of the rental's RentalEscrow contract.","type":"string"},"from":{"title":"Signer address","description":"Wallet that will sign these transactions (the owner or the renter). Used to check permissions and to simulate; no key is needed.","type":"string"},"chainId":{"title":"Chain","description":"56 (31337 = local anvil, 97 = BSC testnet, 5611 = opBNB testnet, 56 = BSC mainnet). Defaults to the chain this server is configured for.","type":"number"}},"required":["lease","from"],"additionalProperties":false},"example":{"lease":"0x9f1ac54BEF0DD2f6f3462EA0fa94fC62300d3a8e","from":"0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC"}}}}}},"/api/v1/prepare_resolve":{"post":{"operationId":"prepare_resolve","summary":"Rule on a dispute (dispute desk)","description":"Prepare the dispute desk's ruling on the deposit split. Only the rental's arbiter can sign it, and only before its deadline. Give the written `ruling` (hashed on-chain) or the `rulingHash` of an uploaded ruling document. Who: the dispute desk (arbiter). Needs rental status: Disputed. Returns {chainId, steps:[{to, data, value, description}], summary} with UNSIGNED transactions, already simulated on the chain; show the summary, then have the person sign the steps in order with their own wallet. Nothing is sent by this tool.","tags":["Prepare (unsigned transactions)"],"x-roles":["arbiter"],"x-statuses":["Disputed"],"responses":{"200":{"description":"Unsigned, simulated transactions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Prepared"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown action, or not a KeyScrow rental","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Wrong role or rental status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The transaction would revert (simulated); `error` says why","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Chain node or price source unreachable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"lease":{"title":"Rental (escrow) address","description":"Address of the rental's RentalEscrow contract.","type":"string"},"from":{"title":"Signer address","description":"Wallet that will sign these transactions (the dispute desk). Used to check permissions and to simulate; no key is needed.","type":"string"},"toRenter":{"x-unit":"USDT","title":"Deposit back to the renter","description":"How much of the deposit goes back to the renter, in mUSDT (e.g. \"400\"). The rest goes to the owner.","type":["string","number"]},"ruling":{"type":"string","minLength":1,"maxLength":4000,"title":"Ruling","description":"The written ruling; its sha256 goes on-chain."},"rulingHash":{"title":"Ruling hash","description":"Or: sha256 of an uploaded ruling document.","type":"string"},"chainId":{"title":"Chain","description":"56 (31337 = local anvil, 97 = BSC testnet, 5611 = opBNB testnet, 56 = BSC mainnet). Defaults to the chain this server is configured for.","type":"number"}},"required":["lease","from","toRenter"],"additionalProperties":false},"example":{"lease":"0x9f1ac54BEF0DD2f6f3462EA0fa94fC62300d3a8e","from":"0x90F79bf6EB2c4f870365E785982E1f101E93b906","toRenter":"782.36","ruling":"Repaint claim partly upheld: 100 mUSDT to the owner."}}}}}},"/api/v1/prepare_claim_timeout":{"post":{"operationId":"prepare_claim_timeout","summary":"Claim a missed deadline","description":"Prepare the transaction that closes a rental after a missed deadline, returning the FULL deposit to the renter: either the owner did not answer the renter's proposal within the reply window, or the dispute desk did not rule within its deadline. Anyone can send it once the deadline has passed (see explain_status). Who: anyone. Needs rental status: MoveOut or Disputed. Returns {chainId, steps:[{to, data, value, description}], summary} with UNSIGNED transactions, already simulated on the chain; show the summary, then have the person sign the steps in order with their own wallet. Nothing is sent by this tool.","tags":["Prepare (unsigned transactions)"],"x-roles":["anyone"],"x-statuses":["MoveOut","Disputed"],"responses":{"200":{"description":"Unsigned, simulated transactions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Prepared"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown action, or not a KeyScrow rental","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Wrong role or rental status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The transaction would revert (simulated); `error` says why","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Chain node or price source unreachable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"lease":{"title":"Rental (escrow) address","description":"Address of the rental's RentalEscrow contract.","type":"string"},"from":{"title":"Signer address","description":"Wallet that will sign these transactions (anyone). Used to check permissions and to simulate; no key is needed.","type":"string"},"chainId":{"title":"Chain","description":"56 (31337 = local anvil, 97 = BSC testnet, 5611 = opBNB testnet, 56 = BSC mainnet). Defaults to the chain this server is configured for.","type":"number"}},"required":["lease","from"],"additionalProperties":false},"example":{"lease":"0x9f1ac54BEF0DD2f6f3462EA0fa94fC62300d3a8e","from":"0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC"}}}}}},"/api/v1/prepare_cancel":{"post":{"operationId":"prepare_cancel","summary":"Withdraw an unfunded offer","description":"Prepare the owner's transaction that withdraws a rental offer the renter has not funded yet. No money moves. Who: the owner (landlord on-chain). Needs rental status: Created. Returns {chainId, steps:[{to, data, value, description}], summary} with UNSIGNED transactions, already simulated on the chain; show the summary, then have the person sign the steps in order with their own wallet. Nothing is sent by this tool.","tags":["Prepare (unsigned transactions)"],"x-roles":["owner"],"x-statuses":["Created"],"responses":{"200":{"description":"Unsigned, simulated transactions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Prepared"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown action, or not a KeyScrow rental","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Wrong role or rental status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The transaction would revert (simulated); `error` says why","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Chain node or price source unreachable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"lease":{"title":"Rental (escrow) address","description":"Address of the rental's RentalEscrow contract.","type":"string"},"from":{"title":"Signer address","description":"Wallet that will sign these transactions (the owner). Used to check permissions and to simulate; no key is needed.","type":"string"},"chainId":{"title":"Chain","description":"56 (31337 = local anvil, 97 = BSC testnet, 5611 = opBNB testnet, 56 = BSC mainnet). Defaults to the chain this server is configured for.","type":"number"}},"required":["lease","from"],"additionalProperties":false},"example":{"lease":"0x9f1ac54BEF0DD2f6f3462EA0fa94fC62300d3a8e","from":"0x70997970C51812dc3A010C7d01b50e0d17dc79C8"}}}}}},"/api/listings":{"get":{"operationId":"listings","summary":"The listing catalogue","description":"Every listing (demo scooters and the stage item) with prices in THB and its photos, each with its Wikimedia Commons credit. Cached for 5 minutes.","tags":["Reads"],"responses":{"200":{"description":"The catalogue","content":{"application/json":{"schema":{"type":"object","required":["thbPerUsdt","listings"],"properties":{"thbPerUsdt":{"type":"number"},"listings":{"type":"array","items":{"$ref":"#/components/schemas/Listing"}}}}}}}}}},"/api/listings/{slug}":{"get":{"operationId":"listing","summary":"One listing of the catalogue","tags":["Reads"],"parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string"},"description":"e.g. honda-click-125i"}],"responses":{"200":{"description":"The listing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Listing"}}}},"404":{"description":"No such listing","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}}}}}},"components":{"schemas":{"Error":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Plain-language reason, safe to show to a person."},"code":{"type":"string","enum":["invalid_input","unknown_action","unsupported_chain","not_found","precondition_failed","simulation_reverted","rpc_unavailable","method_not_allowed","internal_error"]},"details":{"description":"Validation issues, or the decoded revert (step, function, errorName, args)."}}},"Prepared":{"type":"object","required":["chainId","from","steps","summary","simulation","unsigned"],"properties":{"chainId":{"type":"integer","enum":[56]},"from":{"type":"string","description":"The address that must sign every step."},"steps":{"type":"array","description":"Unsigned transactions; sign and send them in order.","items":{"type":"object","required":["to","data","value","description"],"properties":{"to":{"type":"string"},"data":{"type":"string","description":"ABI-encoded calldata (0x…)."},"value":{"type":"string","description":"Native value in wei, decimal string (always \"0\")."},"description":{"type":"string"},"function":{"type":"string","description":"Solidity signature, e.g. fund()."}}}},"summary":{"type":"string","description":"What signing these steps will do, in plain language."},"simulation":{"type":"object","properties":{"method":{"type":"string","enum":["eth_simulateV1","eth_call"]},"ok":{"const":true},"note":{"type":"string"}}},"expected":{"type":"object","description":"Values the simulation returned, e.g. `lease` for prepare_create_lease."},"unsigned":{"const":true}}},"Listing":{"type":"object","required":["slug","name","description","location","city","area","rentThb","monthThb","depositThb","stage","demo","photos"],"properties":{"slug":{"type":"string","description":"The listing's id on the website (/app/listings/<slug>), the iOS app and /api/stage/<slug>."},"name":{"type":"string"},"description":{"type":"string"},"location":{"type":"string"},"city":{"type":"string"},"area":{"type":["string","null"]},"rentThb":{"type":"number","description":"Rent per day, THB."},"monthThb":{"type":["number","null"],"description":"Rent per month, THB, when the listing offers one."},"depositThb":{"type":"number","description":"Deposit, THB."},"stage":{"type":"boolean","description":"The live stage demo's item."},"demo":{"type":"boolean","description":"A made-up offer to try the rental with."},"photos":{"type":"array","items":{"type":"object","required":["url","width","height","alt","credit"],"properties":{"url":{"type":"string","description":"Absolute URL of the 1200 px JPEG."},"width":{"type":"integer"},"height":{"type":"integer"},"alt":{"type":"string"},"credit":{"type":"object","required":["title","author","license","licenseUrl","source","changes"],"properties":{"title":{"type":"string"},"author":{"type":"string"},"license":{"type":"string"},"licenseUrl":{"type":"string"},"source":{"type":"string"},"changes":{"type":"string"},"note":{"type":"string"}}}}}}}}}}}