Skip to main content
Preview. Trade plans aren’t available in production yet (it answers 503), and they’re still being validated on staging. Fields and behavior may change before release. Ask Kairos before you build on them.
A trade plan is one buy order that the wallet authorizes in a single batch of signatures. Kairos then runs it in a fixed order:
  1. Fund it, if needed. When the venue account is short, Kairos bridges in exactly the shortfall from the same wallet’s USDC on Polygon or Arbitrum, using gasless permits. Nothing is sent from the wallet.
  2. Trade. Only once the funds have arrived and their block is final does Kairos submit the order the wallet signed.
Every plan pins a cost ceiling (tradeBudget.maxDebitRaw) and the fee terms, and the wallet signs them. The wallet must be set up on the venue first. Plans are buy-only, and there’s no way to cancel a plan once it’s executed.

With the SDK

run prepares the plan, checks it against what you asked for, asks the wallet for each signature (switching chains as needed), executes it, and waits until it ends.

Over HTTP

1. Prepare

All field names are camelCase. Unknown fields are refused.

2. Check the plan

The response is the plan, with status: "needs_signatures". Check it before the wallet signs anything:
  • order is the order Kairos will place. It can differ from your request in two ways only: outcome comes back in the venue’s canonical spelling (on Hyperliquid, its #<digits> coin), and on Predict.fun a GTC order becomes a GTD (or a GTD’s expiresAt moves earlier) so it ends with the wallet’s Predict.fun session. Refuse anything else.
  • tradeBudget.maxDebitRaw is the most the trade can take from the venue account. Show it, and the fees, to the user.
  • funding.amountInRaw is what the source chain will be debited. It is at most your maxAmountRaw.
  • executeBefore is the deadline to sign and execute: at most 2 minutes out when funded (the bridge quote’s life), otherwise tradeSubmitBefore.

3. Sign each request

requests lists every signature the plan needs, each with its own chainId: Every request is eth_signTypedData_v4. Switch the wallet to chainId, pass request to the wallet, and keep each signature. Signatures must be 65 bytes from the wallet’s own key, with v of 0, 1, 27 or 28 and a low s (standard wallets do this). An unfunded plan needs 2 signatures; a funded one needs 4.

4. Execute

Send every signature in one call. (Or send some first with POST /v3/trade-plans/{id}/answers, which takes the same body.)
Execute checks the balances, reserves the plan’s amounts so another plan can’t spend them, and commits. From then on Kairos runs the plan even if your client goes away. Calling execute again returns the plan as it is.

5. Follow it

GET /v3/trade-plans/{id} every couple of seconds, with the same headers, until status is final.

States

execution adds detail: phase (collecting, funding, trade, finished), fundingStatus, tradeStatus, confirmedArrivalRaw, orderId, venueOrderId, venueOrderStatus.
Funding and trade settle separately. If the funds arrive and the trade then fails or expires, the funds stay in the venue trading account (tradingWallet). Nothing is bridged back. The user can trade with them, or withdraw them from the venue.

error.code on a plan

Funding routes

Kairos asks for exactly the shortfall: maxDebitRaw minus what the venue account already holds. If no route is available, prepare answers 503 no verified gasless funding route is available. A short account with no funding answers 409 collateral is short; supply an explicit funding source. With submission.funding: "client", Kairos keeps no funding signatures. Execute with the plan and trade signatures only. Each funding request carries externalSubmission (Relay’s endpoint, kind, api and requestId): after execute, you post the signed permits to Relay yourself, funding-1 first. Then tell Kairos with POST /v3/trade-plans/{id}/reports, using each request’s requestHash and externalSubmission.requestId:
A report is only a hint to check sooner. Kairos confirms funding from the destination chain itself. Hyperliquid funding goes to mainnet only. If the bridge never delivers, the plan stays reconciling: there is no failed-funding state. Relay refunds a failed bridge to funding.refundRecipient, the wallet. Contact Kairos if a plan stays there.

Errors

Errors are { "error": "message" }. The one exception is unpaid fees, which also carries code: "FEE_SETTLEMENT_REQUIRED" (fees).