Skip to main content
Most programs don’t need this page. POST /v1/orders already buys with cash held on the other venue, in one call. See Paying from the other venue. Use the flow below only if your program signs each payment with the account’s wallet itself.
A routed order buys on Polymarket or Hyperliquid with cash held on the other of the two. Kalshi and Polymarket US do not take routed orders. You name the venue whose cash pays (funding_venue), Lean buys on the other venue, and you sign the payment before anything moves. It takes two calls:
  1. POST /v1/routed-orders quotes the route, books the order as pending and returns the payment to sign.
  2. POST /v1/routed-orders/{id}/execute sends your signature. Lean then moves the cash and buys.
Routed orders are buys only. The key needs the trade and route scopes. See Authentication.
1

Create the routed order

The response is the order, pending, with route and payment:Only the response that created the order carries payment. A replay with the same client_order_id returns the order with payment: null.
2

Sign the payment

Sign payment.typed_data as EIP-712 typed data with the wallet at payment.signer_address. If payment.agent_approval is set, sign it as well. Sign and execute before the quote expires.
3

Execute it

Leave out agent_approval_signature when the payment had no agent_approval. The response is the order with payment: null. A test order is filled. A live order stays pending while Lean moves the cash, then fills on the other venue. Sending the same authorization again returns the order as it stands.
4

Reconcile

Read the order back with GET /v1/orders/{id} until it is final, as for any order. See Orders and idempotency.

Letting Lean sign

Send { "authorization": "delegated" } to the execute call instead of a signature, and Lean signs the payment with the account’s delegated signer, as POST /v1/orders does. A live key needs the account to have trading enabled in the Lean app; otherwise the call returns 403 FORBIDDEN with details.reason: "ACCOUNT_NOT_DELEGATED". A routed order is authorized once. Sending a signature after a delegated authorization, or the other way round, returns 409 CONFLICT with details.reason: "PAYMENT_ALREADY_AUTHORIZED".

Errors

See Errors for the envelope and the other codes.