API/API

Self-serve API

The self-serve API is the HTTP backend behind the Essey on Sui console. It signs people in, creates and runs their hosted agents, and builds every transaction they sign. It never holds a user's key: it builds a transaction, the user signs it in their own wallet or with their passkey, and the API executes exactly those bytes.

Testnet only. The API runs against Sui testnet or a local network; it has no mainnet mode. It is hosted on testnet (Hosted endpoint: /healthz, /v1/config). The host root returns 404. You can also run it locally.

Request flow#

  1. The client gets a sign-in challenge and signs it with a passkey or a Sui wallet key.
  2. The server verifies the signature and returns a session token.
  3. Every other call sends Authorization: Bearer <token>.
  4. To change anything on chain, the client asks the server to build a transaction, signs the returned bytes, and posts the signature to execute it. A built transaction is kept for 120 seconds and executes once.
  5. The operator pays the gas for every transaction the server builds.
Self-serve API: one signed callStatic diagram · Open full size ↗
Self-serve API: one signed callSign in with a challenge, ask the API to build a transaction, sign its bytes, and the API co-signs as gas owner and executes it.POST /v1/auth/challengemessagePOST /v1/auth/sessionsession tokenPOST /v1/agents/:id/txtxId + bytesPOST /v1/agents/:id/tx/:txId + signatureco-sign as gas owner, executeeffectsdigestYour clientagent key or passkeyEssey API/v1 · operatorSui testnetEssey packagesign the messageverify signaturebuild tx · gas: operatorsign the byteskept 120 s
Scroll sideways to see the whole diagram.
The API builds; the user signs; the API executes exactly those bytes. It never holds a user's key.Source: api/overview.md · api/authentication.md · api/agent-transactions.md
Text version
 Client (browser / script)                 Self-serve API                       Sui testnet
   |  POST /v1/auth/challenge  ------------->  |                                    |
   |  <-- message                              |                                    |
   |  sign message (passkey / wallet)          |                                    |
   |  POST /v1/auth/session  --------------->  |  verify signature                  |
   |  <-- token                                |                                    |
   |  POST /v1/agents/:id/tx  -------------->  |  build tx, gas = operator          |
   |  <-- txId, bytes                          |                                    |
   |  sign bytes                               |                                    |
   |  POST /v1/agents/:id/tx/:txId  -------->  |  co-sign as gas owner, execute ---> |
   |  <-- digest                               |                                    |

Requests#

  • Base URL (local): http://127.0.0.1:8790.
  • Methods: GET and POST.
  • Body: JSON. Every request other than GET must send Content-Type: application/json. Bodies are capped at 64 KiB.
  • Host: locally, only 127.0.0.1 and localhost are accepted.
  • Origin: a browser request from an origin not on the list is refused; requests with no Origin header, such as curl, pass.
  • Amounts: decimal strings in coin units, for example "12.5" USDC or "30" SUI. Large integers in responses are strings.
  • Health check: GET /healthz returns {"ok":true}.

Responses#

Every JSON response carries ok. A success adds its fields next to it:

JSON
{ "ok": true, "agents": [] }

A failure carries an error code. See Errors.

JSON
{ "ok": false, "error": "NO_SESSION" }

Routes#

Each row links to the request and response on the route reference.

MethodPathAuthPayload
GET/healthznoneHealth
GET/v1/confignoneConfig
GET/v1/errorsnoneErrors
GET/v1/faucetnoneFaucet
POST/v1/faucet/usdsui, /usdc, /suinoneFaucet
POST/v1/auth/challenge, /sessionnoneAuthentication
POST/v1/auth/logoutsessionAuthentication
GET/v1/mesessionAuthentication
GET, POST/v1/agentssessionAgents
POST/v1/mandate/previewsessionAgents
GET/v1/agents/:idownerAgents
POST/v1/agents/:id/tx, /tx/:txIdownerAgents
POST/v1/agents/:id/launch, /pause, /stop, /settingsownerAgents
GET/v1/agents/:id/loans, /activityownerAgents
POST/v1/borrow/quote, /previewsessionBorrow
GET/v1/borrow/rooms, /rooms/:id, /loans, /historysessionBorrow
POST/v1/borrow/tx, /tx/:txIdsessionBorrow
POST/v1/upkeep/dry-runnoneUpkeep dry run
POST/v1/byo/peek, /claimsessionSelf-run agents
POST/v1/agent/challenge, /session, /setup, /sponsor, /credentialagentSelf-run agents
GET/v1/agent/setupagentSelf-run agents
GET/v1/private/confignonePrivate config and credentials
POST/v1/private/credentialsessionPrivate config and credentials
POST/v1/private/tx/:actionnonePrivate transactions
POST/v1/admin/kill, /deny, /undeny, /deniedadmin tokenAdmin

An agent id is a- followed by 16 hex digits. :txId is 32 hex digits.

Route bodies#

The table above is the index. Every request body and every success body is written out on Route reference. The developers' API page links here.