Jupiter — Swap API V2 — Prepare unsigned build Transaction

Retrieve a swap quote with raw instructions for building custom transactions with the Jupiter API. Supply an input mint and an output mint. Sample fields include labels. Use it in a transaction-routing workflow. The GET request schema also lists inputMint, outputMint, amount. Use the response in a DeFi workflow for the selected protocol, and compare the request and response with the provider example.

Selected price
$0 / callPublished pricing
Sellers / implementations
1 / 1
Requests · 30d
—Loading...
Success rate · 30d
—Loading...

Run sends a real API request. Charges follow the published API contract.

Request parameters
The mint address of the input token
The mint address of the output token
The amount to swap in the smallest unit of the input token
Public key of the user initiating the swap.
Optional parameters (17)
Slippage tolerance in basis points. Defaults to 50. Import profile accepts the string branch only; other union branches are not exposed.
Quoting mode. "fast" trades quote optimality for reduced latency.
- Comma-separated list of DEXes to restrict routing to. - Labels are case sensitive (`SolFi`, not `solfi`). An unrecognised label is not a validation error: it returns `400 {"error": "No routes found"}`, indistinguishable from a pair with no liquidity. - Mutually exclusive with excludeDexes. Passing both returns `400 {"error": "dexes and excludeDexes are mutually exclusive"}`. - Full list of DEXes here using the `/program-id-to-label` endpoint.
- Comma-separated list of DEXes to exclude. - Labels are case sensitive (`SolFi`, not `solfi`). - Mutually exclusive with dexes. - Full list of DEXes here using the `/program-id-to-label` endpoint.
Platform fee in basis points. If positive, feeAccount is required.
Token account to collect platform fees. Required if platformFeeBps is positive.
Maximum number of accounts for the swap route. Defaults to 64.
Account that pays transaction fees and rent. Defaults to taker when not passed in.
Whether to wrap/unwrap SOL. Defaults to true.
- SPL token account to receive output tokens. - Mutually exclusive with nativeDestinationAccount.
- Native SOL account to receive output. - Mutually exclusive with destinationTokenAccount.
Number of slots until the blockhash expires. Defaults to 150.
SOL tip amount in lamports. Adds a tip instruction for use with /submit. The tip payer is the taker (or payer if specified).
Percentile of compute unit price to use. Named levels: "medium" (25th), "high" (50th), "veryHigh" (75th), or a number 0-10000 in basis points. Import profile accepts the string branch only; other union branches are not exposed.
Set to `true` if the transaction will be submitted as part of a Jito bundle. This excludes DEXes that are incompatible with Jito bundles.
The Solana transaction version to build for, `"0"` or `"1"`. Defaults to `"0"`. `"1"` returns v1 instructions: `computeBudgetInstructions` is empty and `addressesByLookupTableAddress` is `{}` (v1 inlines accounts, no lookup tables). Set the compute budget, including the returned `computeUnitPrice`, on the message config. Build with a v1-capable SDK (`@solana/kit` v8 or later).
Target maximum transaction size in bytes, leaving room for your own instructions. - Sizing is deterministic, not an estimate: Metis builds and serializes the route to measure it. The swap it returns always fits your budget. - Counts the bare swap only. Anything you add on top is not counted, so your final transaction can still exceed it: request parameters (`payer`, `feeAccount`, `tipAmount`, destination accounts, close authority, cashback), your own instructions, extra signers, and your own lookup tables. - Set the budget below 1232 to leave room, then serialize your final transaction and lower `maxBytes` further if it still exceeds 1232. As a rough guide, each added account costs 1 byte if in your lookup table else 32, and each extra signer about 96 bytes. - v0 only (400 with `transactionVersion=1`).

Sample response

{
  "addressesByLookupTableAddress": {
    "13t3zQRgBuWNVHaxzD2Uf3ELzFaFr8civojnjH4MiRs": [
      "q7BVd2EPK5bmqbfWp4CrcMnJcuTdxYogQGH6XbNUaNR",
      "JCRGumoE9Qi5BBgULTgdgTLjSgkCMSbF62ZZfGs84JeU",
      "7hTckgnGnLQR6sdH7YkqFTAA7VwTfYFaZ6EhEsU3saCX"
    ],
    "5a1fzA5giAgNUq4s8gRaEFuJew4Q2ePU9h159xeUS37x": [
      "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
      "7VtfL8fvgNfhz17qKRMjzQEXgbdpnHHHQRh54R9jP2RJ",
      "BqaZiuYoDGSQKMVbn6ALSQzuNNNChKEeUR7HDpwqQNvu"
    ],
    "Bu5FqnUDrKcpeC4ikT3og9qFx3VqYcqVVi9NEGQfBtpH": [
      "HqBJt4NJz7XjbtqJe2fj6pmNDjptLSivseWfwGvmBBkE",
      "FLUXubRmkEi2q6K3Y9kBPg9248ggaZVsoSFhtJHSrm1X",
      "FPgdFKJ85XWhXg8qQHfZiHr7Z8KS72V6rUMFyYkirGvS"
    ],
    "C4wHbJ2nx5ys544Li6R4QLCbiMY8FrBK3Xjsact93kTw": [
      "BqaZiuYoDGSQKMVbn6ALSQzuNNNChKEeUR7HDpwqQNvu",
      "7iX6vUDC73yzCUZwoGzMyxq1eDNq3pYUDXimtgMKWHGk",
      "9hGCZPjdNxL4pjUsnz31gfvvJkV2qQf5pPH3RghGVU3u"
    ]
  },
  "blockhashWithMetadata": {
    "blockhash": [
      238,
      244,
      46
    ],
    "fetchedAt": {
      "nanos_since_epoch": 437865217,
      "secs_since_epoch": 1793341000
    },
    "lastValidBlockHeight": 441203302
  },
  "cleanupInstruction": {
    "accounts": [
      {
        "isSigner": false,
        "isWritable": true,
        "pubkey": "GSFbPvFTbfcRNGs4EEZVF8tBjV6ChcTaBrTYGGsDAq8o"
      },
      {
        "isSigner": false,
        "isWritable": true,
        "pubkey": "GkwFnmMDvn3HGMpJpWBg8tgJxr3NxNvg3AXxvXVPbRGJ"
      },
      {
        "isSigner": true,
        "isWritable": false,
        "pubkey": "GkwFnmMDvn3HGMpJpWBg8tgJxr3NxNvg3AXxvXVPbRGJ"
      }
    ],
    "data": "CQ==",
    "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
  },
  "computeBudgetInstructions": [
    {
      "accounts": [],
      "data": "A4IGAAAAAAAA",
      "programId": "ComputeBudget111111111111111111111111111111"
    }
  ],
  "inAmount": "10000000",
  "inputMint": "So11111111111111111111111111111111111111112",
  "otherAmountThreshold": "974726",
  "otherInstructions": [],
  "outAmount": "979624",
  "outputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
  "priceImpactPct": "0",
  "routePlan": [
    {
      "bps": 2966,
      "percent": 29.66,
      "swapInfo": {
        "ammKey": "5hCDEXRCn5YsyP1ydgbnaXT3QN6AAkfshfRkXRQypzr6",
        "inAmount": "2965558",
        "inputMint": "So11111111111111111111111111111111111111112",
        "label": "Whirlpool",
        "outAmount": "290522",
        "outputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
      }
    },
    {
      "bps": 7034,
      "percent": 70.34,
      "swapInfo": {
        "ammKey": "DyzGYEhdgSn5EEUt4XXviavZ7v7SV2YGrYV8HX3Aw5XT",
        "inAmount": "7034442",
        "inputMint": "So11111111111111111111111111111111111111112",
        "label": "Byreal",
        "outAmount": "690257",
        "outputMint": "USD1ttGY1N17NEEHLmELoaybftRBUSErhqYiQzvEmuB"
      }
    },
    {
      "bps": 10000,
      "percent": 100,
      "swapInfo": {
        "ammKey": "3a2ceHEsNjQCSXGfDzju8Xe8Aj86D8DGAHK4tuNRYRHT",
        "inAmount": "690257",
        "inputMint": "USD1ttGY1N17NEEHLmELoaybftRBUSErhqYiQzvEmuB",
        "label": "Manifest",
        "outAmount": "690083",
        "outputMint": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"
      }
    }
  ],
  "setupInstructions": [
    {
      "accounts": [
        {
          "isSigner": true,
          "isWritable": true,
          "pubkey": "GkwFnmMDvn3HGMpJpWBg8tgJxr3NxNvg3AXxvXVPbRGJ"
        },
        {
          "isSigner": false,
          "isWritable": true,
          "pubkey": "GSFbPvFTbfcRNGs4EEZVF8tBjV6ChcTaBrTYGGsDAq8o"
        },
        {
          "isSigner": false,
          "isWritable": false,
          "pubkey": "GkwFnmMDvn3HGMpJpWBg8tgJxr3NxNvg3AXxvXVPbRGJ"
        }
      ],
      "data": "AQ==",
      "programId": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
    },
    {
      "accounts": [
        {
          "isSigner": true,
          "isWritable": true,
          "pubkey": "GkwFnmMDvn3HGMpJpWBg8tgJxr3NxNvg3AXxvXVPbRGJ"
        },
        {
          "isSigner": false,
          "isWritable": true,
          "pubkey": "GSFbPvFTbfcRNGs4EEZVF8tBjV6ChcTaBrTYGGsDAq8o"
        }
      ],
      "data": "AgAAAICWmAAAAAAA",
      "programId": "11111111111111111111111111111111"
    },
    {
      "accounts": [
        {
          "isSigner": false,
          "isWritable": true,
          "pubkey": "GSFbPvFTbfcRNGs4EEZVF8tBjV6ChcTaBrTYGGsDAq8o"
        }
      ],
      "data": "EQ==",
      "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
    }
  ],
  "slippageBps": 50,
  "swapInstruction": {
    "accounts": [
      {
        "isSigner": true,
        "isWritable": false,
        "pubkey": "GkwFnmMDvn3HGMpJpWBg8tgJxr3NxNvg3AXxvXVPbRGJ"
      },
      {
        "isSigner": false,
        "isWritable": true,
        "pubkey": "GSFbPvFTbfcRNGs4EEZVF8tBjV6ChcTaBrTYGGsDAq8o"
      },
      {
        "isSigner": false,
        "isWritable": true,
        "pubkey": "GWWjoZ2bZikAhhMAH5V3Mp6goHqnWAT6KqCZSHmqtoZ"
      }
    ],
    "data": "u2T6zDHErxSAlpgAAAAAAKjyDgAAAAAAMgAAAAAABAAAAC8BAJYLAAScehsAAnQBECcCA5wQJwME",
    "programId": "JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4"
  },
  "swapMode": "ExactIn",
  "tipInstruction": null,
  "transactionVersion": 0
}

Response result

Response structure

Inferred from examples
  • addressesByLookupTableAddressobject
    • 13t3zQRgBuWNVHaxzD2Uf3ELzFaFr8civojnjH4MiRsstring[]
    • 5a1fzA5giAgNUq4s8gRaEFuJew4Q2ePU9h159xeUS37xstring[]
    • Bu5FqnUDrKcpeC4ikT3og9qFx3VqYcqVVi9NEGQfBtpHstring[]
    • C4wHbJ2nx5ys544Li6R4QLCbiMY8FrBK3Xjsact93kTwstring[]
  • blockhashWithMetadataobject
    • blockhashinteger[]
    • fetchedAtobject
      • nanos_since_epochinteger
      • secs_since_epochinteger
    • lastValidBlockHeightinteger
  • cleanupInstructionobject
    • accountsobject[]
      • isSignerboolean
      • isWritableboolean
      • pubkeystring
    • datastring
    • programIdstring
  • computeBudgetInstructionsobject[]
    • accountsunknown[]
    • datastring
    • programIdstring
  • inAmountstring
  • inputMintstring
  • otherAmountThresholdstring
  • otherInstructionsunknown[]
  • outAmountstring
  • outputMintstring
  • priceImpactPctstring
  • routePlanobject[]
    • bpsinteger
    • percentnumber
    • swapInfoobject
      • ammKeystring
      • inAmountstring
      • inputMintstring
      • labelstring
      • outAmountstring
      • outputMintstring
  • setupInstructionsobject[]
    • accountsobject[]
      • isSignerboolean
      • isWritableboolean
      • pubkeystring
    • datastring
    • programIdstring
  • slippageBpsinteger
  • swapInstructionobject
    • accountsobject[]
      • isSignerboolean
      • isWritableboolean
      • pubkeystring
    • datastring
    • programIdstring
  • swapModestring
  • tipInstructionnull
  • transactionVersioninteger

Common questions

Do I need a separate key for every provider?

Use your OpenAny API key for standard API access. Read it from OPENANY_API_KEY in your environment and keep it out of prompts, source code and logs.

Are these providers interchangeable?

No. Each offering has its own inputs, pricing and response contract. Selecting a catalog offering does not establish automatic routing or fallback. Confirm the service contract before calling.

How is this API billed?

API-key calls use your shared balance at the selected implementation's published rate. Check the billing unit and request-specific pricing rules before making a paid call. Recorded usage determines the final charge under that contract.

Where do the price and contract come from?

The selected implementation publishes its provider, request contract, revision and billing rules through OpenAny's public API catalog. A revision number identifies a contract version, not a price update date. A price update timestamp is not supplied; do not treat a page date as one.

How do OpenAny Balance and x402 differ?

OpenAny Balance uses an API key and one shared balance. Card, USDC and x402 top-ups, card auto top-up and USDC subscriptions fund that balance; available routes appear on the Credits page. Direct x402 is a separate pay-per-request flow, available only on listings that show it and requiring an authorized payment client.

Does Playground send a paid request?

Yes. After you sign in, Run sends a real API request using an active OpenAny API key. Charges follow the published API contract and use your shared balance. Selecting an implementation, editing inputs and viewing sample responses do not send requests.

Use Jupiter — Swap API V2 — Prepare unsigned build Transaction with your agent

Inspect endpoint contracts and confirm availability and pricing before a paid call.