Skip to main content
In short: the gateway is the public interface for programs and other agents. It signs in with a wallet, quotes an operation or a plan on your own account, runs the quote you accept, and reports the result. It is a REST interface with an OpenAPI document. It is separate from the console, with its own credentials. Paid calls are paid per call with x402 or from credits. Its address, its OpenAPI document and every route are listed in the agent guide. The OpenAPI document is the contract. This page explains the shape.

Signing in

  1. Ask for a challenge with your address and network. You get a message that expires in five minutes and works once.
  2. Sign it with your wallet. Ordinary wallets and contract wallets both work.
  3. Send the signed message back. You get a token that lasts an hour.
  4. Send the token as Authorization: Bearer <token> on every other call.
Your wallet is your identity on the gateway. The token is not a console credential, and console credentials are not accepted here.

Reads that need no sign-in

The catalogue, a search over it, the plan schema and the template shelf answer anybody. Search ranks operations by measured quality: success rate first, then realised slippage, then gas.

Quote, then run

A quote is a private preview of the exact calls the agent will make, decoded, with the result of a simulation and every floor the price guard will enforce. It runs on your own account.
  1. Quote an operation, a plan or a template with your values. You get a quote id and a hash of the preview.
  2. Run the quote by naming the hash you accepted. A run needs an Idempotency-Key. The same key and request give the same run and never start or pay twice.
  3. Watch the run: its state, its payment and a timeline you can read from a cursor. You can stop a run at any time.
A single call can do both for one operation. You state the most you will pay for gas and fee, and the least a priced step may deliver. The call runs only if the quote fits both.

What the gateway will start

The gateway starts only a short list of operations, and nothing else. Today the list is pulling your own tokens into your account, swapping, and lending (supply, borrow, repay and withdraw), plus the five template agents. Anything outside the list is refused, and the refusal names each item. The way out is never blocked. Stopping a run, cancelling an order, repaying a loan, collecting fees, claiming and sending to your own wallet always go through, whatever the list says. A plan on the gateway can arm one thing only: a resting order. It cannot arm a schedule, a chain or a trigger.

Paying

A paid route answers 402 Payment Required. The answer carries the price and what it accepts, in USDC on Base. You pay, then send the request again with the payment and a payment identifier. The identifier is an idempotency key, so the work is never done twice. A refused request is not charged. A paid route with no price set yet answers as if the route does not exist. It is never served free. You can also buy credits with an x402 payment, at 100 credits to the USDC. Credits are not refundable. They can pay a route’s fee, and a run’s cost is held while the run is open and settled when it ends.

Webhooks

Register one https address and the gateway posts to it when a run ends. Each delivery is signed with HMAC-SHA256 over the timestamp and the body, using a secret shown once. Delivery is at least once and retried for a few hours, so keep the event id and ignore a repeat. The address must resolve only to public addresses, and redirects are not followed.

Session keys

A session certificate lets a separate key act for your wallet for one purpose, on one network, for at most 24 hours. Your wallet signs it. Revoking a certificate is permanent.

Under the hood

The route table is the only place a route is declared, and the OpenAPI document is generated from the same rows, so the document and the routes cannot disagree. A route without a price is closed, so a missing price cannot make a paid route free. The list of what the gateway may start is checked at start: a name outside the vocabulary refuses the boot. → Connect your own agent over MCP · The agent card