terminalTrade API

Route swaps through Raydium pools using quotes, serialized transactions, and optional priority fee helpers.

The Trade API lets you get quotes and execute swaps through Raydium's routing engine. For a complete end-to-end implementation, see the SDK demoarrow-up-right.

Flow overview

Use the Trade API in two steps:

  1. Get a quote from the routing engine.

  2. Build a transaction from that quote, then sign and send it.

Get quote

GET https://transaction-v1.raydium.io/compute/swap-base-in

Returns a quote for swapping tokens with an exact input amount.

Query parameters

Name
Type
Required
Description

inputMint

string

Yes

Token mint address to swap from

outputMint

string

Yes

Token mint address to swap to

amount

string

Yes

Amount in base units, such as token decimals or lamports for SOL

slippageBps

number

Yes

Slippage tolerance in basis points, for example 50 = 0.5%

txVersion

string

Yes

Transaction version: v0 or legacy

Example response

Quote endpoints

Path
Description

/compute/swap-base-in

Specify the exact input amount

/compute/swap-base-out

Specify the exact output amount

Build the transaction

POST https://transaction-v1.raydium.io/transaction/swap-base-in

Builds one or more serialized transactions from a quote response.

Request body

Name
Type
Required
Description

swapResponse

object

Yes

Response returned by the quote endpoint

wallet

string

Yes

User wallet public key

txVersion

string

Yes

Transaction version: V0 or LEGACY

wrapSol

boolean

No

Wrap SOL to wSOL for the input leg

unwrapSol

boolean

No

Unwrap wSOL to SOL for the output leg

inputAccount

string

No

Input token account, omit if the input is SOL

outputAccount

string

No

Output token account, omit if the output is SOL

computeUnitPriceMicroLamports

string

No

Priority fee in micro-lamports

Example response

Optional priority fee helper

GET https://api-v3.raydium.io/main/auto-fee

Use this helper if you want a suggested compute unit price instead of setting the priority fee manually.

Full example

Install

Setup

Do not use your main wallet private key for testing.

Get quote

Serialize

Deserialize and send

Need help?

Ask in #dev-chatarrow-up-right on Discord.

Last updated

Was this helpful?