POST
/
dex
/
{chain}
/
swap
curl --request POST \
  --url https://api-dex.chainstream.io/dex/{chain}/swap \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "dex": "raydium",
  "userAddress": "HN7cABqLq46Es1jh92dQQisAq662SmxELLLsHHe4YWrH",
  "priorityFee": "0.000001",
  "poolAddress": "58oQChx4yWmvKdwLLZzBi4ChoCc2fqCUWBkwMihLYQo2",
  "amount": "1000000000",
  "swapMode": "ExactIn",
  "slippage": 10,
  "inputMint": "<string>",
  "outputMint": "<string>"
}'
{
  "serializedTx": "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEDRgYGpQEDAQIABQcICQoLDA0ODwAAAAAAAAAAAAAQERITFBUWFxgZGhscHR4fAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=",
  "elapsedTime": 245
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

chain
enum<string>
required

A chain name listed in supported networks

Available options:
sol,
base

Body

application/json
dex
enum<string>
required

DEX identifier for the trade

Available options:
raydium,
meteora,
pumpfun,
moonshot,
jupiter
Example:

"raydium"

userAddress
string
required

Public key of the wallet initiating the transaction

Required string length: 8 - 64
Example:

"HN7cABqLq46Es1jh92dQQisAq662SmxELLLsHHe4YWrH"

amount
string
required

Amount to swap. Use "auto" for full balance or percentage like "50%"

Example:

"1000000000"

swapMode
enum<string>
required

Swap direction mode

Available options:
ExactIn,
ExactOut
Example:

"ExactIn"

slippage
number
default:10
required

Slippage tolerance percentage

Required range: 0 <= x <= 100
Example:

10

priorityFee
string

Priority fee in SOL to increase transaction processing speed

Example:

"0.000001"

poolAddress
string

DEX pool address

Required string length: 8 - 64
Example:

"58oQChx4yWmvKdwLLZzBi4ChoCc2fqCUWBkwMihLYQo2"

inputMint
string

Input Mint, the base token address

outputMint
string

Ouput Mint, the quote token address

Response

200 - application/json
serializedTx
string
required

Base64 encoded transaction

Example:

"AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEDRgYGpQEDAQIABQcICQoLDA0ODwAAAAAAAAAAAAAQERITFBUWFxgZGhscHR4fAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="

elapsedTime
number
required

Time taken to process the request in milliseconds

Example:

245