Skip to main content
GET
/
build
Build Transaction
curl --request GET \
  --url https://api.jup.ag/swap/v2/build \
  --header 'x-api-key: <api-key>'
{
  "inputMint": "<string>",
  "outputMint": "<string>",
  "inAmount": "<string>",
  "outAmount": "<string>",
  "otherAmountThreshold": "<string>",
  "swapMode": "<string>",
  "slippageBps": 123,
  "routePlan": [
    {
      "swapInfo": {
        "ammKey": "<string>",
        "label": "<string>",
        "inputMint": "<string>",
        "outputMint": "<string>",
        "inAmount": "<string>",
        "outAmount": "<string>"
      },
      "percent": 123,
      "bps": 123,
      "usdValue": 123
    }
  ],
  "computeBudgetInstructions": [
    {
      "programId": "<string>",
      "accounts": [
        {
          "pubkey": "<string>",
          "isWritable": true,
          "isSigner": true
        }
      ],
      "data": "<string>"
    }
  ],
  "setupInstructions": [
    {
      "programId": "<string>",
      "accounts": [
        {
          "pubkey": "<string>",
          "isWritable": true,
          "isSigner": true
        }
      ],
      "data": "<string>"
    }
  ],
  "swapInstruction": {
    "programId": "<string>",
    "accounts": [
      {
        "pubkey": "<string>",
        "isWritable": true,
        "isSigner": true
      }
    ],
    "data": "<string>"
  },
  "cleanupInstruction": {
    "programId": "<string>",
    "accounts": [
      {
        "pubkey": "<string>",
        "isWritable": true,
        "isSigner": true
      }
    ],
    "data": "<string>"
  },
  "otherInstructions": [
    {
      "programId": "<string>",
      "accounts": [
        {
          "pubkey": "<string>",
          "isWritable": true,
          "isSigner": true
        }
      ],
      "data": "<string>"
    }
  ],
  "addressesByLookupTableAddress": {},
  "blockhashWithMetadata": {
    "blockhash": [
      123
    ],
    "lastValidBlockHeight": 123
  }
}

Authorizations

x-api-key
string
header
required

Get API key via https://portal.jup.ag

Query Parameters

inputMint
string
required

The mint address of the input token

outputMint
string
required

The mint address of the output token

amount
string
required

The amount to swap in the smallest unit of the input token

taker
string
required

Public key of the user initiating the swap.

slippageBps
integer

Slippage tolerance in basis points. Defaults to 50.

Required range: 0 <= x <= 10000
mode
enum<string>

Quoting mode. "fast" trades quote optimality for reduced latency.

Available options:
fast
dexes
string
  • Comma-separated list of DEXes to restrict routing to.
  • Mutually exclusive with excludeDexes.
excludeDexes
string
  • Comma-separated list of DEXes to exclude.
  • Mutually exclusive with dexes.
platformFeeBps
integer

Platform fee in basis points. If positive, feeAccount is required.

Required range: 0 <= x <= 10000
feeAccount
string

Token account to collect platform fees. Required if platformFeeBps is positive.

maxAccounts
integer

Maximum number of accounts for the swap route. Defaults to 64.

Required range: 1 <= x <= 64
payer
string

Account that pays transaction fees and rent. Defaults to taker when not passed in.

wrapAndUnwrapSol
boolean

Whether to wrap/unwrap SOL. Defaults to true.

destinationTokenAccount
string
  • SPL token account to receive output tokens.
  • Mutually exclusive with nativeDestinationAccount.
nativeDestinationAccount
string
  • Native SOL account to receive output.
  • Mutually exclusive with destinationTokenAccount.
blockhashSlotsToExpiry
integer

Number of slots until the blockhash expires. Defaults to 150.

Required range: 1 <= x <= 300

Response

Quote with raw swap instructions

inputMint
string
outputMint
string
inAmount
string
outAmount
string
otherAmountThreshold
string

Minimum output amount after slippage

swapMode
string
slippageBps
number
routePlan
object[]
computeBudgetInstructions
object[]

Compute unit price instruction (does not include compute unit limit)

setupInstructions
object[]

Pre-swap setup instructions (e.g. create ATAs)

swapInstruction
object
cleanupInstruction
object

Post-swap cleanup instruction

otherInstructions
object[]
addressesByLookupTableAddress
object

Address lookup table mappings for v0 transactions

blockhashWithMetadata
object