{"openapi":"3.1.0","info":{"title":"Mnemzo API","version":"0.1.0","description":"Quarters: encrypted memory an owner lends to Visitors (AI agents) with revocable on-chain Passes. Contract 0xB57e1891786C28013Ad181C77854140E093F3F7A on Robinhood Chain (4663). Writes are relayed (owners need no ETH) and checked by the contract's EIP-712 signatures. The server only ever holds ciphertext, except for the labeled Arrivals demo Visitor."},"servers":[{"url":"https://mnemzo.center"}],"paths":{"/api/quarters/{owner}":{"get":{"summary":"Quarters metadata","description":"On-chain version, root, keyEpoch, nonce, revokeNonce (fresh contract reads), room/Trace counts, Passes. With full=1 also the stored ciphertext (traces, rooms) and the Passes live on chain.","parameters":[{"name":"owner","in":"path","required":true,"schema":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"}},{"name":"full","in":"query","schema":{"type":"string","enum":["1"]}}],"responses":{"200":{"description":"JSON"}}},"put":{"summary":"Record a Footprint","description":"Upload the full encrypted set for version = on-chain + 1 with the owner's EIP-712 Imprint signature. The server recomputes the root, relays imprintBySig and stores the set only after the tx succeeded.","parameters":[{"name":"owner","in":"path","required":true,"schema":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["version","root","traces","rooms","deadline","sig"],"properties":{"version":{"type":"integer","minimum":0},"root":{"type":"string","pattern":"^0x[0-9a-fA-F]{64}$"},"deadline":{"type":"integer","minimum":0},"sig":{"type":"string","pattern":"^0x[0-9a-fA-F]*$"},"traces":{"type":"array","maxItems":200,"items":{"type":"object","required":["traceId","scopeId","ct"],"properties":{"traceId":{"type":"string","pattern":"^0x[0-9a-fA-F]{32}$"},"scopeId":{"type":"string","pattern":"^0x[0-9a-fA-F]{64}$"},"ct":{"type":"string","pattern":"^0x[0-9a-fA-F]*$","description":"nonce‖ciphertext‖tag, ≤ 4096 bytes"}}}},"rooms":{"type":"array","items":{"type":"object","required":["scopeId","wrappedOwner"],"properties":{"scopeId":{"type":"string","pattern":"^0x[0-9a-fA-F]{64}$"},"wrappedOwner":{"type":"string","pattern":"^0x[0-9a-fA-F]*$"}}}}}}}}},"responses":{"200":{"description":"{ txHash, version, root, block }"},"400":{"description":"invalid input or contract revert (error name in `revert`)"},"429":{"description":"rate limit or quota"}}}},"/api/passes":{"post":{"summary":"Issue a Pass","description":"Relays grantKeyBySig; stores the room-key envelopes for the Visitor after success. The Visitor must be registered.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["owner","visitor","scopeId","expiry","epoch","deadline","sig","envelopes"],"properties":{"owner":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"},"visitor":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"},"scopeId":{"type":"string","pattern":"^0x[0-9a-fA-F]{64}$"},"expiry":{"type":"integer","minimum":0},"epoch":{"type":"integer","minimum":0},"deadline":{"type":"integer","minimum":0},"sig":{"type":"string","pattern":"^0x[0-9a-fA-F]*$"},"envelopes":{"type":"array","items":{"type":"object","required":["scopeId","eph","ct"],"properties":{"scopeId":{"type":"string","pattern":"^0x[0-9a-fA-F]{64}$"},"eph":{"type":"string","pattern":"^0x[0-9a-fA-F]{64}$"},"ct":{"type":"string","pattern":"^0x[0-9a-fA-F]*$"}}}}}}}}},"responses":{"200":{"description":"{ txHash }"},"400":{"description":"invalid input or contract revert (error name in `revert`)"},"429":{"description":"rate limit or quota"}}}},"/api/passes/revoke":{"post":{"summary":"Revoke the pass","description":"Relays revokeKeyBySig (never quota-blocked) and deletes the envelopes.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["owner","visitor","deadline","sig"],"properties":{"owner":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"},"visitor":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"},"deadline":{"type":"integer","minimum":0},"sig":{"type":"string","pattern":"^0x[0-9a-fA-F]*$"}}}}}},"responses":{"200":{"description":"{ txHash }"},"400":{"description":"invalid input or contract revert (error name in `revert`)"},"429":{"description":"rate limit or quota"}}}},"/api/passes/revoke-all":{"post":{"summary":"Revoke every Pass","description":"Relays revokeAllKeysBySig (never quota-blocked).","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["owner","deadline","sig"],"properties":{"owner":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"},"deadline":{"type":"integer","minimum":0},"sig":{"type":"string","pattern":"^0x[0-9a-fA-F]*$"}}}}}},"responses":{"200":{"description":"{ txHash }"},"400":{"description":"invalid input or contract revert (error name in `revert`)"},"429":{"description":"rate limit or quota"}}}},"/api/visitors":{"get":{"summary":"Visitors","description":"Registered Visitors with X25519 public keys; the Arrivals demo Visitor is flagged demo: true.","responses":{"200":{"description":"JSON"}}},"post":{"summary":"Register a Visitor","description":"sig = personal_sign(\"Mnemzo Visitor v2\\nName: <name>\\nX25519: <x25519Pub lowercased>\\nTime: <unix ts>\") by the visitor address.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["visitor","x25519Pub","name","sig"],"properties":{"visitor":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"},"x25519Pub":{"type":"string","pattern":"^0x[0-9a-fA-F]{64}$"},"name":{"type":"string","maxLength":64},"sig":{"type":"string","pattern":"^0x[0-9a-fA-F]*$"}}}}}},"responses":{"200":{"description":"{ visitor, x25519Pub, name }"},"400":{"description":"invalid input or contract revert (error name in `revert`)"},"429":{"description":"rate limit or quota"}}}},"/api/visitors/{address}":{"get":{"summary":"One Visitor","description":"X25519 public key of a registered Visitor.","responses":{"200":{"description":"JSON"}},"parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"}}]}},"/api/visit":{"post":{"summary":"Visit","description":"sig = personal_sign(\"Mnemzo Visit v1\\nOwner: <owner lowercased>\\nScope: <scope|all>\\nTime: <ts>\"), |now − ts| ≤ 120 s, (visitor, ts) once. Fresh hasKey on chain; every Visit is written to the Gate log. 403 { denied, reason, txOfRevoke } when there is no live Pass.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["owner","visitor","scope","ts","sig"],"properties":{"owner":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"},"visitor":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"},"scope":{"type":"string"},"ts":{"type":"integer","minimum":0},"sig":{"type":"string","pattern":"^0x[0-9a-fA-F]*$"}}}}}},"responses":{"200":{"description":"{ version, root, traces, envelopes, gateLogId }"},"403":{"description":"denied"},"409":{"description":"replayed (visitor, ts)"}}}},"/api/arrivals/ask":{"post":{"summary":"Arrivals demo","description":"The demo Visitor (0xB92ea81843733E015D7b60417D4ac686288CD3c5) makes a real Visit for scope all and, if served, answers with the decrypted Traces (decrypted on this server; demo only). 20/owner/day. 503 if the model key is not configured.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["owner","question"],"properties":{"owner":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"},"question":{"type":"string","maxLength":500}}}}}},"responses":{"200":{"description":"{ answer } or { denied, txOfRevoke }"},"503":{"description":"demo offline"}}}},"/api/stats":{"get":{"summary":"Tides","description":"Live counts, each with its source (events + last tx, contract reads, or the Gate log). Arrivals demo Visits are counted apart from real Visitors.","responses":{"200":{"description":"JSON"}}}},"/api/series":{"get":{"summary":"Daily series","description":"Per UTC day: Footprints, Passes, revokes, anchors, Visits (served/denied) split real vs demo.","responses":{"200":{"description":"JSON"}},"parameters":[{"name":"days","in":"query","schema":{"type":"integer","minimum":1,"maximum":90}}]}},"/api/latest":{"get":{"summary":"Latest","description":"Last 20 Footprints / Passes / revokes with tx (addresses shortened).","responses":{"200":{"description":"JSON"}}}},"/api/visits":{"get":{"summary":"Gate log","description":"Last 20 Visits (served or denied).","responses":{"200":{"description":"JSON"}}}},"/api/anchors":{"get":{"summary":"Gate log anchors","description":"Roots anchored on chain every 3600 s window that had Visits (empty windows are skipped).","responses":{"200":{"description":"JSON"}}}},"/api/gate-log/{seq}":{"get":{"summary":"Gate log leaves","description":"All leaves of one anchor so anyone can recompute its root with gateLeaf + merkleRoot from @mnemzo/shared.","responses":{"200":{"description":"JSON"}},"parameters":[{"name":"seq","in":"path","required":true,"schema":{"type":"integer","minimum":0}}]}},"/api/network":{"get":{"summary":"Network","description":"Chain, block, base fee, relayer (online, balance, queue, last tx), daily quota used, indexer cursor.","responses":{"200":{"description":"JSON"}}}},"/api/token":{"get":{"summary":"$EMZO","description":"Token contract address (null until launch).","responses":{"200":{"description":"JSON"}}}},"/api/residency/{address}":{"get":{"summary":"Residency","description":"Holder perks. Reads balanceOf(address) on the $EMZO contract at the latest block; resident when the balance is at least 1,000,000 $EMZO. Perks: relayed tx per day 30 → 150, Arrivals questions per day 20 → 60, Traces per Quarters 200 → 500. Before launch token is null.","responses":{"200":{"description":"JSON"}},"parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"}}]}},"/api/quarters/{owner}/gate.xml":{"get":{"summary":"Signal","description":"Atom feed of every Visit to this Quarters (served or refused), newest first, same rows as the anchored Gate log. Subscribe in any feed reader.","responses":{"200":{"description":"JSON"}},"parameters":[{"name":"owner","in":"path","required":true,"schema":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"}}]}},"/api/terms":{"get":{"summary":"Terms","description":"Short terms and limits of the service.","responses":{"200":{"description":"JSON"}}}},"/mcp":{"post":{"summary":"MCP (Streamable HTTP, JSON-RPC 2.0)","description":"Tools: visit, pass_status, remember_draft.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"200":{"description":"JSON-RPC response"},"202":{"description":"notification accepted"}}}}}}