Swap Build REST API

Documentation
API Reference

Everything you need to integrate Dritan's low-latency Solana market data into your trading infrastructure.

DocsAPI ReferenceSwap Build
API Reference

Swap Build

Build unsigned swap transactions

Builds an unsigned swap transaction (base64). You sign it client-side and then broadcast it.

Platform fees can apply depending on your plan. You can also attach your own fee for your users via feeWallet and feePercent.

Endpoint#

POST /swap/build

Request Body#

FieldTypeRequiredDescription
userPublicKeystringYesYour wallet public key
inputMintstringYesToken to swap from
outputMintstringYesToken to swap to
amountnumberYesAmount in base units
slippageBpsnumberYesSlippage tolerance (e.g., 500 = 5%)
swapTypestringYes"buy" or "sell"
feeWalletstringNoOptional fee recipient
feePercentnumberNoOptional fee percentage

Request (curl)#

curl -X POST \
  -H "x-api-key: YOUR_KEY" \
  -H "content-type: application/json" \
  -d '{"userPublicKey":"...","inputMint":"So111...","outputMint":"Es9v...","amount":100000000,"slippageBps":500,"swapType":"buy"}' \
  https://us-east.dritan.dev/swap/build

Request (TypeScript, SDK)#

import { DritanClient } from "dritan-sdk";

const client = new DritanClient({ apiKey: "YOUR_KEY" });
const build = await client.buildSwap({
  userPublicKey: "YOUR_WALLET_PUBKEY",
  inputMint: "So11111111111111111111111111111111111111112",
  outputMint: "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
  amount: 100000000,
  slippageBps: 500,
  swapType: "buy"
});

Sign the Transaction#

import { VersionedTransaction } from "@solana/web3.js";

const tx = VersionedTransaction.deserialize(
  Buffer.from(build.transactionBase64, "base64")
);
const signed = await wallet.signTransaction(tx);
const signedBase64 = Buffer.from(signed.serialize()).toString("base64");
Last updated: 2/25/2026Edit on GitHub