Developer Docsv1

OpenFlow DEX API

Swap any token at best price across EVM chains. Non-custodial, no account needed.

2.5 bps feeNo auth for quotesNon-custodialSolana + EVM

Base URL

https://api.openflow.network/gw

All endpoints are prefixed with this URL. You can proxy through /gw if self-hosting.

1. Get a quote

GET/dex/quote

Best route and expected output for a swap. Public — no API key needed. Quotes are valid for 30 seconds.

Query parameters

ParamTypeDescription
inputMint*stringToken mint (Solana) or ERC-20 address (EVM). Also accepts symbols: SOL, USDC.
outputMint*stringOutput token mint or symbol.
amount*stringInput amount in native units (lamports for SOL, wei for ETH, etc.).
chainstringOptional. Pin to: solana, polygon, base, bnb, arbitrum.
slippageBpsnumberMax slippage in bps. Default: 50 (0.5%).
maxSplitsnumberMax pools to split across. Default: 3, max: 10.

Example

curl "https://api.openflow.network/gw/dex/quote?inputMint=SOL&outputMint=USDC&amount=1000000000"

Response

{
  "quoteId":        "b3e2f1a0-...",
  "inputAmount":    "1000000000",
  "outputAmount":   "148210432",
  "priceImpact":    0.0021,
  "executionChain": "solana",
  "routes": [{ "pool": "HJPjoWUr...", "protocol": "orca_whirlpool" }],
  "fee": { "bps": 2.5, "amount": "37052" },
  "validUntil": "2026-07-07T21:30:00Z"
}

2. Build the transaction

POST/dex/swap/build

Turns a quote into an unsigned transaction. Your user's wallet signs and submits — OpenFlow never touches funds.

Request body

ParamTypeDescription
quoteId*stringThe quoteId from /dex/quote. Valid for 30 seconds.
userWallet*stringUser wallet address (Solana base58 or EVM 0x). Tx built for this signer.
feeRecipientstringOptional. Your wallet to receive 60% of the 2.5 bps fee.

Example

curl -X POST https://api.openflow.network/gw/dex/swap/build \
  -H "Content-Type: application/json" \
  -d '{ "quoteId": "b3e2f1a0-...", "userWallet": "YourWalletAddress" }'

Response

{
  "chain":            "solana",
  "txBase64":         "AQAAA...",
  "approvalTxBase64": null,
  "minOutputAmount":  "147469",
  "expectedOutput":   "148210432",
  "validUntil":       "2026-07-07T21:30:00Z"
}

3. Sign and submit

txBase64 is a serialised unsigned transaction. Have your user sign and submit — OpenFlow is never involved.

EVM (wagmi)

import { useSendTransaction } from "wagmi";
const { sendTransaction } = useSendTransaction();

if (built.approvalTxBase64) {
  await sendTransaction({ to: routerAddress, data: built.approvalTxBase64 });
  await new Promise(r => setTimeout(r, 2000));
}
await sendTransaction({ to: routerAddress, data: built.txBase64 });

4. Confirm the swap

POST/dex/swap/confirm

Call after the tx is confirmed on-chain. Records the swap and attributes integrator fees.

Request body

ParamTypeDescription
quoteId*stringquoteId from step 1.
txSignature*stringOn-chain transaction hash / signature.
actualOutputstringActual output amount in native units (from chain receipt).

Other endpoints

GET/dex/pools

All indexed pools — prices, liquidity, fee tiers. Filter: ?chain=solana or ?pair=SOL/USDC.

GET/dex/tokens

All tradeable tokens aggregated from indexed pools, with liquidity per pair.

Fees & integrator revenue

Every swap charges 2.5 basis points (0.025%) of output. Pass a feeRecipient and 60% goes to your wallet automatically.

ParamTypeDescription
Total fee2.5 bps of output amount
Integrator share60% — sent to your feeRecipient
Protocol share40% — kept by OpenFlow

Rate limits

GET /dex/quote — 10 req/s per IP, no auth.
POST /dex/swap/build — same limit, no auth.
POST /dex/swap — requires API key (server-side execution).