OpenAPI 3.1: /api/v1/openapi.json. MCP: the same actions are tools on the KeyScrow Inspector agent (POST /mcp, see docs/AGENT.md for the Claude config). Amounts: USDT has 18 decimals; inputs take human amounts like "441.18", outputs give units (base units) and display.
Listings: the one catalogue of the website and the iOS app, with prices in THB and the credit of every photo. Public, no key, cached for 5 minutes: GET /api/listings, GET /api/listings/<slug>
BASE=http://127.0.0.1:3000 # this app
get_leaseGET /api/v1/get_lease · Get a rental
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.
| Field | Type | Meaning |
|---|
| lease | string | Rental (escrow) address. Address of the rental's RentalEscrow contract. |
| chainId? | number | Chain. 56 (31337 = local anvil, 97 = BSC testnet, 5611 = opBNB testnet, 56 = BSC mainnet). Defaults to the chain this server is configured for. |
curl -s "$BASE/api/v1/get_lease?lease=0x9f1ac54BEF0DD2f6f3462EA0fa94fC62300d3a8e"
list_leasesGET /api/v1/list_leases · List rentals of a wallet
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.
| Field | Type | Meaning |
|---|
| party | string | Wallet. The wallet whose rentals to list. |
| role? | owner | renter | arbiter | Role. Only rentals where the wallet has this role (owner = landlord, renter = tenant, arbiter = dispute desk). Default: all three. |
| limit? | integer | Limit. Most rentals to return per role (newest first). Default 20. |
| chainId? | number | Chain. 56 (31337 = local anvil, 97 = BSC testnet, 5611 = opBNB testnet, 56 = BSC mainnet). Defaults to the chain this server is configured for. |
curl -s "$BASE/api/v1/list_leases?party=0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC&role=renter"
explain_statusGET /api/v1/explain_status · Explain where the deposit is
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.
| Field | Type | Meaning |
|---|
| lease | string | Rental (escrow) address. Address of the rental's RentalEscrow contract. |
| viewer? | string | Viewer wallet. Optional: the person asking, so the answer says what *they* can do. |
| chainId? | number | Chain. 56 (31337 = local anvil, 97 = BSC testnet, 5611 = opBNB testnet, 56 = BSC mainnet). Defaults to the chain this server is configured for. |
curl -s "$BASE/api/v1/explain_status?lease=0x9f1ac54BEF0DD2f6f3462EA0fa94fC62300d3a8e&viewer=0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC"
quoteGET /api/v1/quote · Convert baht / dollars / mUSDT
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.
| Field | Type | Meaning |
|---|
| amount | string | number | Amount. Amount to convert, e.g. "18000". |
| currency? | THB | USD | USDT | Currency. Currency of `amount`: THB, USD or USDT (= mUSDT). Default "THB". |
curl -s "$BASE/api/v1/quote?amount=18000¤cy=THB"
wallet_historyGET /api/v1/wallet_history · Wallet history for the dispute desk
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.
| Field | Type | Meaning |
|---|
| wallet | string | Wallet. The renter's or owner's wallet. |
| chainId? | number | Chain. 56 (31337 = local anvil, 97 = BSC testnet, 5611 = opBNB testnet, 56 = BSC mainnet). Defaults to the chain this server is configured for. |
curl -s "$BASE/api/v1/wallet_history?wallet=0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC"
prepare_create_leasePOST /api/v1/prepare_create_lease · Create a rental
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.
| Field | Type | Meaning |
|---|
| from | string | Signer address. 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. |
| renter | string | Renter wallet. Wallet of the renter (tenant on-chain); it pays the deposit and rent. |
| rent | string | number (currency) | Monthly rent. Rent per 30-day month, in `currency`, e.g. "3000". Charged per rent period (see `rentPeriodDays`). |
| rentPeriodDays? | number (days) | Rent period. How often rent is paid: every 7, 14 or 30 days (default 30). Default 30. |
| currency? | THB | USD | USDT | Currency. Currency of `rent` and `deposit`: THB (default), USD or USDT (= mUSDT, stored as is). Default "THB". |
| deposit? | string | number | Deposit. Security deposit, in `currency`. Give this or `depositMonths`. |
| depositMonths? | integer (months) | Deposit (months of rent). Security deposit as a number of months of rent, e.g. 2. Give this or `deposit`. |
| termPeriods | integer (periods) | Term. Length of the rental in rent periods (1 to 60), e.g. 4 with weekly rent = 4 weeks. |
| responseWindowDays? | integer (days) | Owner's reply window. Days the owner has to answer the renter's return proposal; if silent, the full deposit goes back to the renter. Default 7. |
| arbiterWindowDays? | integer (days) | Dispute desk deadline. Days the dispute desk has to rule on a dispute; after that the full deposit can go back to the renter. Default 14. |
| arbiter? | string | Dispute desk. Optional: your own neutral reviewer. Omit to use the KeyScrow dispute desk. |
| leaseHash? | string | Rental agreement hash. Optional sha256 of the signed agreement (from POST /api/evidence). |
| payee? | string | Payout address. 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. |
| chainId? | number | Chain. 56 (31337 = local anvil, 97 = BSC testnet, 5611 = opBNB testnet, 56 = BSC mainnet). Defaults to the chain this server is configured for. |
curl -s -X POST "$BASE/api/v1/prepare_create_lease" \
-H 'content-type: application/json' \
-d '{"from":"0x70997970C51812dc3A010C7d01b50e0d17dc79C8","renter":"0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC","rent":"18000","currency":"THB","depositMonths":2,"termPeriods":12}'prepare_fundPOST /api/v1/prepare_fund · Fund the rental (renter)
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.
| Field | Type | Meaning |
|---|
| lease | string | Rental (escrow) address. Address of the rental's RentalEscrow contract. |
| from | string | Signer address. Wallet that will sign these transactions (the renter). Used to check permissions and to simulate; no key is needed. |
| chainId? | number | Chain. 56 (31337 = local anvil, 97 = BSC testnet, 5611 = opBNB testnet, 56 = BSC mainnet). Defaults to the chain this server is configured for. |
curl -s -X POST "$BASE/api/v1/prepare_fund" \
-H 'content-type: application/json' \
-d '{"lease":"0x9f1ac54BEF0DD2f6f3462EA0fa94fC62300d3a8e","from":"0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC"}'prepare_release_rentPOST /api/v1/prepare_release_rent · Pay out due rent
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.
| Field | Type | Meaning |
|---|
| lease | string | Rental (escrow) address. Address of the rental's RentalEscrow contract. |
| from | string | Signer address. Wallet that will sign these transactions (anyone; the renter may also release early). Used to check permissions and to simulate; no key is needed. |
| chainId? | number | Chain. 56 (31337 = local anvil, 97 = BSC testnet, 5611 = opBNB testnet, 56 = BSC mainnet). Defaults to the chain this server is configured for. |
curl -s -X POST "$BASE/api/v1/prepare_release_rent" \
-H 'content-type: application/json' \
-d '{"lease":"0x9f1ac54BEF0DD2f6f3462EA0fa94fC62300d3a8e","from":"0x70997970C51812dc3A010C7d01b50e0d17dc79C8"}'prepare_add_evidencePOST /api/v1/prepare_add_evidence · Anchor photos or a document
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.
| Field | Type | Meaning |
|---|
| lease | string | Rental (escrow) address. Address of the rental's RentalEscrow contract. |
| from | string | Signer address. Wallet that will sign these transactions (the owner or the renter). Used to check permissions and to simulate; no key is needed. |
| kind | check_in | check_out | other | Kind. check_in = pickup photos, check_out = return photos, other = anything else. |
| contentHash | string | Content hash. sha256 of the file (or photo manifest) from POST /api/evidence. |
| chainId? | number | Chain. 56 (31337 = local anvil, 97 = BSC testnet, 5611 = opBNB testnet, 56 = BSC mainnet). Defaults to the chain this server is configured for. |
curl -s -X POST "$BASE/api/v1/prepare_add_evidence" \
-H 'content-type: application/json' \
-d '{"lease":"0x9f1ac54BEF0DD2f6f3462EA0fa94fC62300d3a8e","from":"0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC","kind":"check_out","contentHash":"0x9d9e1f7ac51b4a8f8a3c1f0b3d8f0f6e3e2b1c0d9a8b7c6d5e4f3a2b1c0d9e8f"}'prepare_propose_settlementPOST /api/v1/prepare_propose_settlement · Propose the deposit split
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.
| Field | Type | Meaning |
|---|
| lease | string | Rental (escrow) address. Address of the rental's RentalEscrow contract. |
| from | string | Signer address. Wallet that will sign these transactions (the owner or the renter). Used to check permissions and to simulate; no key is needed. |
| toRenter? | string | number (USDT) | Deposit back to the renter. How much of the deposit goes back to the renter, in mUSDT (e.g. "400"). The rest goes to the owner. |
| inspection? | object | AI inspection result. The full result of the inspect_move_out tool (or POST /api/settlement). Its tenantRefund and reportHash are used as is. |
| reportHash? | string | Report hash. Optional hash of your own report backing the split (default: hash of `note`). |
| note? | string | Reason. Optional short reason, hashed into reportHash when no report is given. |
| chainId? | number | Chain. 56 (31337 = local anvil, 97 = BSC testnet, 5611 = opBNB testnet, 56 = BSC mainnet). Defaults to the chain this server is configured for. |
curl -s -X POST "$BASE/api/v1/prepare_propose_settlement" \
-H 'content-type: application/json' \
-d '{"lease":"0x9f1ac54BEF0DD2f6f3462EA0fa94fC62300d3a8e","from":"0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC","toRenter":"800","note":"Small scratch on the left panel"}'prepare_acceptPOST /api/v1/prepare_accept · Accept the proposal
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.
| Field | Type | Meaning |
|---|
| lease | string | Rental (escrow) address. Address of the rental's RentalEscrow contract. |
| from | string | Signer address. 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. |
| nonce? | integer | Proposal number. Optional: the proposal # you reviewed. Default: the current one. |
| chainId? | number | Chain. 56 (31337 = local anvil, 97 = BSC testnet, 5611 = opBNB testnet, 56 = BSC mainnet). Defaults to the chain this server is configured for. |
curl -s -X POST "$BASE/api/v1/prepare_accept" \
-H 'content-type: application/json' \
-d '{"lease":"0x9f1ac54BEF0DD2f6f3462EA0fa94fC62300d3a8e","from":"0x70997970C51812dc3A010C7d01b50e0d17dc79C8","nonce":1}'prepare_disputePOST /api/v1/prepare_dispute · Open a dispute
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.
| Field | Type | Meaning |
|---|
| lease | string | Rental (escrow) address. Address of the rental's RentalEscrow contract. |
| from | string | Signer address. Wallet that will sign these transactions (the owner or the renter). Used to check permissions and to simulate; no key is needed. |
| chainId? | number | Chain. 56 (31337 = local anvil, 97 = BSC testnet, 5611 = opBNB testnet, 56 = BSC mainnet). Defaults to the chain this server is configured for. |
curl -s -X POST "$BASE/api/v1/prepare_dispute" \
-H 'content-type: application/json' \
-d '{"lease":"0x9f1ac54BEF0DD2f6f3462EA0fa94fC62300d3a8e","from":"0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC"}'prepare_resolvePOST /api/v1/prepare_resolve · Rule on a dispute (dispute desk)
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.
| Field | Type | Meaning |
|---|
| lease | string | Rental (escrow) address. Address of the rental's RentalEscrow contract. |
| from | string | Signer address. Wallet that will sign these transactions (the dispute desk). Used to check permissions and to simulate; no key is needed. |
| toRenter | string | number (USDT) | Deposit back to the renter. How much of the deposit goes back to the renter, in mUSDT (e.g. "400"). The rest goes to the owner. |
| ruling? | string | Ruling. The written ruling; its sha256 goes on-chain. |
| rulingHash? | string | Ruling hash. Or: sha256 of an uploaded ruling document. |
| chainId? | number | Chain. 56 (31337 = local anvil, 97 = BSC testnet, 5611 = opBNB testnet, 56 = BSC mainnet). Defaults to the chain this server is configured for. |
curl -s -X POST "$BASE/api/v1/prepare_resolve" \
-H 'content-type: application/json' \
-d '{"lease":"0x9f1ac54BEF0DD2f6f3462EA0fa94fC62300d3a8e","from":"0x90F79bf6EB2c4f870365E785982E1f101E93b906","toRenter":"782.36","ruling":"Repaint claim partly upheld: 100 mUSDT to the owner."}'prepare_claim_timeoutPOST /api/v1/prepare_claim_timeout · Claim a missed deadline
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.
| Field | Type | Meaning |
|---|
| lease | string | Rental (escrow) address. Address of the rental's RentalEscrow contract. |
| from | string | Signer address. Wallet that will sign these transactions (anyone). Used to check permissions and to simulate; no key is needed. |
| chainId? | number | Chain. 56 (31337 = local anvil, 97 = BSC testnet, 5611 = opBNB testnet, 56 = BSC mainnet). Defaults to the chain this server is configured for. |
curl -s -X POST "$BASE/api/v1/prepare_claim_timeout" \
-H 'content-type: application/json' \
-d '{"lease":"0x9f1ac54BEF0DD2f6f3462EA0fa94fC62300d3a8e","from":"0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC"}'prepare_cancelPOST /api/v1/prepare_cancel · Withdraw an unfunded offer
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.
| Field | Type | Meaning |
|---|
| lease | string | Rental (escrow) address. Address of the rental's RentalEscrow contract. |
| from | string | Signer address. Wallet that will sign these transactions (the owner). Used to check permissions and to simulate; no key is needed. |
| chainId? | number | Chain. 56 (31337 = local anvil, 97 = BSC testnet, 5611 = opBNB testnet, 56 = BSC mainnet). Defaults to the chain this server is configured for. |
curl -s -X POST "$BASE/api/v1/prepare_cancel" \
-H 'content-type: application/json' \
-d '{"lease":"0x9f1ac54BEF0DD2f6f3462EA0fa94fC62300d3a8e","from":"0x70997970C51812dc3A010C7d01b50e0d17dc79C8"}'