Route reference
Every public route on the self-serve API, with the request it accepts and the JSON it returns. A success body always includes ok: true. A failure is { "ok": false, "error": "…" } unless a route below says otherwise. Bodies over 64 KiB are refused. Anything other than GET must send Content-Type: application/json.
Longer notes stay on the linked page. This page is the payload index those links point at.
Health#
. No auth. No body.
{ "ok": true }Config#
. No auth. No body. → { ok: true, …fields }. The fields are the deployment record: network, chainId, pkg, loanCoin, symbol, decimals, market, collateralCoin, reader, oraclePkg, feed, pool, access, marketLtvBps, poolMaxRateBps, presets, borrowerPresets, termChipsDays, limits, borrow, signIn, sponsor, selfRun, kill, faucet. Save the JSON as the SDK deployment file. Field notes: Config & account.
Errors#
. No auth. No body. → { ok: true, lending, saleRoom }. lending and saleRoom are the Move abort tables. Names: Errors.
Faucet#
. No auth. No body. → { ok: true, faucets }. Each entry is the config's faucet plus available (base units) when it pays from a reservoir.
And POST /v1/faucet/usdc. No auth.
{ "address": "0x…" }→ { ok: true, digest, amount, recipient }. amount is a base-unit string (10 tUSDsui, 2 USDC).
. No auth. Body ignored. This is not a drip:
{ "ok": false, "status": 400, "error": "SUI_FAUCET_EXTERNAL", "message": "…" }message is the guide: install the Sui CLI and run sui client faucet. Mysten's POST https://faucet.testnet.sui.io/v2/gas returns compatibility_disabled. The install and the command are on Hand this to your agent.
Other faucet errors: Config & account.
Authentication#
. No auth.
{ "address": "0x…" }→ { ok: true, message, expiresAtMs }. address is 0x and 64 lowercase hex digits. A challenge lasts five minutes.
. No auth.
{ "address": "0x…", "message": "…", "signature": "…" }→ { ok: true, token, address, scheme, proof, expiresAtMs }. proof is passkey or wallet.
. Session. No body. → { ok: true }.
. Session. No body. → { ok: true, address, scheme, proof, balances }. balances is { sui, loan }, decimal strings.
Errors and the passkey checks: Authentication.
Agents#
. Session. No body. → { ok: true, agents }. Each agent is the object in Agents.
. Session.
{ "name": "my-lender", "preset": "steady" }→ 201 { ok: true, agent }. name matches ^[a-z0-9][a-z0-9-]{0,62}$. preset is steady, yield, refinancer, taker, switcher or shopper.
. Owner. No body. → { ok: true, agent, runner, balances, warnings, withdrawWarnings }.
, /pause, /stop. Owner. No body. → { ok: true, runner }.
. Owner. Hosted borrowers.
{ "autoTopUp": true, "autoClaim": false }Either field may be omitted; at least one boolean is required. → { ok: true, agent, runner }.
. Owner. No body. → { ok: true, loans }.
. Owner. No body. → { ok: true, items, more }.
. Session. Lender form only.
{ "form": { "name": "my-lender", "preset": "steady", "totalBudget": "20", "minLoan": "5", "maxLoan": "15", "minRateBps": 800, "maxLtvBps": 5000, "termsDays": [1], "expiresAtMs": 1793500000000 } }→ { ok: true, sentence, chain } or 400 { ok: false, error: "BAD_FORM", errors: [{ "field", "message" }] }. Field rules: Agents.
. Owner. → 201 { ok: true, txId, action, bytes, expiresAtMs }.
{ "action": "create", "form": {}, "amount": "20", "loanId": "0x…" }form is the lender form or the borrower form. amount is a decimal string for lender money actions. loanId is 0x and 64 hex digits.
. Owner.
{ "signature": "…" }→ { ok: true, digest, agent }. Actions, the borrower form and refusals: Agent transactions.
Borrow#
. Session.
{ "collateral": "1", "amount": "1" }collateral is SUI, amount is the loan coin (USDC on the hosted market), both decimal strings above zero.
{
"ok": true,
"price": { "spot": "…", "ema": "…", "publishMs": 0 },
"market": { "ltvBps": 5000, "liqBps": 7500, "bonusBps": 500 },
"health": { "valueAtBorrow": "…", "ltvBps": 0, "liqBps": 7500, "underwater": false, "liquidationPrice": "…" },
"routes": {
"offer": { "offerId": "0x…", "rateBps": 800, "termMs": 86400000 },
"pool": { "rateBps": 520, "floating": true, "available": "…" },
"room": { "rateBps": null, "note": "lenders bid blind; you see the rates only after close" }
},
"warnings": [{ "code": "LTV_TOO_HIGH", "message": "over the market's borrow limit: add SUI or borrow less" }]
}routes.offer and routes.pool are null when that route does not qualify. The reason is not a field on the route. Quote warnings, and the other warning codes on loans and rooms, are listed on Borrow.
. Session. { form } is the borrower form. → { ok: true, sentence, chain } or 400 { ok: false, error: "BAD_FORM", errors }.
. Session. → { ok: true, nowMs, rooms }.
. Session. → { ok: true, nowMs, room, offers, seal }.
. Session. → { ok: true, nowMs, priceStale, offersLoading, more, loans }.
. Session. → { ok: true, … } as Borrow describes.
. Session. → 201 { ok: true, txId, action, bytes, expiresAtMs }. Body is { action, …fields } for room-open, room-settle, room-decline, room-refund, offer-fill, pool-borrow, repay, add-collateral, refinance, claim. Fields: Borrow transactions.
. Session. { "signature": "…" } → { ok: true, digest, action, loanId? | roomId? }.
Self-run agents#
Agent session (POST /v1/agent/challenge then /v1/agent/session, same bodies as owner sign-in):
.
{ "side": "borrower" }side is lender or borrower. → 201 { ok: true, code, side, expiresAtMs }.
. No body. → { ok: true, setup }. setup is null, or { state, side, expiresAtMs, owner, agentId, account, capExpiresAtMs }. state is waiting, expired, claimed, ready or revoked. account is null until ready, then { treasuryId, agentCapId } and, for a borrower, cash: { treasuryId, capId }. After POST /v1/byo/claim, poll this route until state is ready. EsseyService.setup() is this call.
.
{ "bytes": "…", "signature": "…" }→ { ok: true, digest }.
. { "commitment": "…" } (decimal string). → { ok: true, credential } or 404 when the server has no issuer.
Owner session:
. { "code": "…" } (32 hex digits). → { ok: true, address, side, expiresAtMs }.
.
{ "code": "…", "name": "my-borrower", "preset": "taker" }→ 201 { ok: true, agent }. The preset's side must match the setup. The account ids are still null until create lands; poll GET /v1/agent/setup.
Details: Self-run agents.
Upkeep dry run#
. No auth. Signs nothing.
{
"address": "0x…",
"nowMs": 0,
"repayLeadMs": 3600000,
"graceMs": 300000,
"repayByMs": 0,
"loanIds": ["0x…"],
"loans": [{ "id": "0x…", "state": "open", "maturityMs": 0, "lenderKind": "treasury" }],
"rooms": [{ "id": "0x…", "state": "open", "closeMs": 0, "settleByMs": 0, "offerCount": 0 }]
}address is required. loans is a required array. nowMs defaults to the server clock, repayLeadMs to 3600000, graceMs to 300000. rooms and loanIds are optional. A loan state is open, repaid, liquidated, written-off, refinancing, claimed or defaulted. A room state is open, settled, declined or refunded.
→ { ok: true, dryRun: true, signed: false, address, nowMs, repayLeadMs, graceMs, actions }. Each action is { job, outcome, text, loanId?, roomId?, claimId?, code? }. job is repay, claim-surplus, collect-default, room-refund or warning. A bad field is 400 and error is the message.
Private config and credentials#
. No auth. No body. → { ok: true, private } or 404 NO_SUCH_ROUTE when the server has no private config. Save private as ESSEY_PRIVATE.
. Owner session. { "commitment": "…" }. → { ok: true, credential } or 404 without an issuer. The same body on POST /v1/agent/credential uses the agent session.
Fields: Private flows & credentials.
Private transactions#
. No auth. The action is one of:
pool-deposit, pool-exit, pool-withdraw, sale-v2-open, sale-v2-attest, sale-v2-bid, sale-v2-finish, sale-v2-collect, sale-v2-claim, sale-v2-cancel, sale-v2-expire, loan-v2-open, loan-v2-attest, loan-v2-offer, loan-v2-settle, loan-v2-settle-relayed, loan-v2-repay, loan-v2-cancel, loan-v2-claim-default, sale-v1-open, sale-v1-attest, sale-v1-bid, sale-v1-pool-bid, sale-v1-finish, sale-v1-expire, sale-v1-collect, sale-v1-claim.
A key named secret, nullSecret, spendKey, privateKey, encKey or seed is refused. An unknown action is 400 and error is unknown action …. Any other refusal is 400 and error is the message. Without a private config the route is 404 NO_SUCH_ROUTE.
Two success shapes, both with ok: true:
{ "ok": true, "encoding": "sui-transaction-json", "bytes": "…", "calls": ["module::function"] }bytes is base64 of the transaction JSON, not BCS. Build it with a fullnode before signing.
{ "ok": true, "encoding": "relay", "url": "https://…/relay/usdc", "body": {} }url is the relayer path for that coin. POST body there.
Accepted keys for each action, and the types and examples, are Raw HTTP private flows.
Admin#
Bearer is the admin token, not a session. Method must be POST.
. { "on": true, "reason": "…" } → { ok: true, kill }.
. { "address": "0x…", "reason": "…" } → { ok: true, address, entry }.
. { "address": "0x…" } → { ok: true, address }.
. No body. → { ok: true, denied }.
Without a deny store, the deny routes are 404. A wrong token is 403 NOT_ADMIN. Notes: Admin.