Jupiter Swap V2 Build Instructions API
Get Jupiter Swap V2 Build Instructions data via REST or OpenAny MCP—with pay-per-use pricing and no subscription. Powered by Jupiter, pass parameters such as amount, inputMint, outputMint, and retrieve structured data including swap instruction program address, swap instruction account requirements, setup instruction collection, compute-budget instruction collection, and cleanup instruction component for wallet assembly, and route inspection.
- Selected price
- $0 / callPublished pricing
- Sellers / APIs
- 1 / 1
- Requests · 30d
- 0Selected implementation · last 30 days
- Success rate · 30d
- —No requests in this period
Jupiter Swap V2 Build Instructions API
Prepare your request, then continue with your agent.
Selected price
$0 / call
- Provider
- API
- Pricing
On this page
Overview
Jupiter Swap V2 Build Instructions API
GET requires inputMint, outputMint, amount and taker query values. The response separates setup, swap, cleanup and compute-budget instruction components with lookup-table and blockhash context. In this selected input profile, slippageBps accepts only the string rtse, and computeUnitPricePercentile accepts medium, high or veryHigh. Read returned transactionVersion separately from requested options.
Quick Facts
| Fact | Value |
|---|---|
| Access | OpenAny REST |
| Authentication | OpenAny API key in the Authorization header |
| Core inputs | query: inputMint, outputMint, amount, taker, slippageBps, mode, dexes, excludeDexes, platformFeeBps, feeAccount, maxAccounts, payer, wrapAndUnwrapSol, destinationTokenAccount, nativeDestinationAccount, blockhashSlotsToExpiry, tipAmount, computeUnitPricePercentile, forJitoBundle, transactionVersion, maxBytes |
| Selected implementation | jupiter · Jupiter — Swap API V2 — Prepare unsigned build Transaction |
| Billing | Per call; check the selected implementation pricing and charge conditions |
What You Can Build
- Wallet assembly: Combine the returned instruction components deliberately.
- Route inspection: Keep routing, account requirements and validity metadata together.
Documented Response Fields
| Field | Meaning |
|---|---|
swapInstruction.programId |
Swap instruction program address |
swapInstruction.accounts |
Swap instruction account requirements |
setupInstructions |
Setup instruction collection |
computeBudgetInstructions |
Compute-budget instruction collection |
cleanupInstruction |
Cleanup instruction component |
addressesByLookupTableAddress |
Lookup-table address mapping |
blockhashWithMetadata.lastValidBlockHeight |
Last valid block height |
transactionVersion |
Returned transaction version |
Quick Start
- Set OPENANY_API_KEY to your OpenAny API key.
- Review the supported inputs and set any required query value shown in the template.
- Check the HTTP response and business result before reading optional fields.
curl --request GET --get \
"https://api.openany.si/v1/agent-apis/jupiter/swap/v2/build" \
-H "Authorization: Bearer ${OPENANY_API_KEY}" \
-H 'Content-Type: application/json' \
--data-urlencode amount=10000000 \
--data-urlencode inputMint=So11111111111111111111111111111111111111112 \
--data-urlencode outputMint=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v \
--data-urlencode taker=GkwFnmMDvn3HGMpJpWBg8tgJxr3NxNvg3AXxvXVPbRGJ
Request and Response Examples
The saved response is a published documentation example with abbreviated source content. Its values may be historical; the request is an independent calling template. Use current returned identifiers and optional fields for your chosen resource.
Published Jupiter Swap V2 Build Instructions API implementation contract.
Pricing and Billing
The pricing area reflects the selected API implementation. Review its billing unit and any request-dependent rules before calling; a source service's public availability does not determine OpenAny billing.
Frequently Asked Questions
Related APIs
Playground
Run sends a real API request. Charges follow the published API contract.
Sellers
| Seller | Pricing | Requests · 30d | Performance | Access |
|---|---|---|---|---|
jupiterCurrent Jupiter — Swap API V2 — Prepare unsigned build Transaction · GET · View API reference | $0 / call | 0 | —successP50— |
- Unit price
- $0
Statistics use persisted gateway logs from the last 30 days up to now, including today.
Success rate = successful requests / all requests;
P50 = median latency of successful requests.
Prices reflect the published API contract. Contract revision: 5. Price update time: not supplied.
Total $0
API
- Method
- GET
- Endpoint
https://api.openany.si/v1/agent-apis/jupiter/swap/v2/build- Content type
- application/json
- Authentication
Authorization: Bearer $OPENANY_API_KEY
Input parameters
Fields in this listing; additional options and input encoding can vary by provider.
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
inputMint | URL query parametersquery | string | Yes | The mint address of the input token |
outputMint | URL query parametersquery | string | Yes | The mint address of the output token |
amount | URL query parametersquery | string | Yes | The amount to swap in the smallest unit of the input token |
taker | URL query parametersquery | string | Yes | Public key of the user initiating the swap. |
slippageBps | URL query parametersquery | string | No | Slippage tolerance in basis points. Defaults to 50. Import profile accepts the string branch only; other union branches are not exposed. enum: "rtse" |
mode | URL query parametersquery | string | No | Quoting mode. "fast" trades quote optimality for reduced latency. enum: "fast" |
dexes | URL query parametersquery | string | No | - 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. |
excludeDexes | URL query parametersquery | string | No | - 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. |
platformFeeBps | URL query parametersquery | integer | No | Platform fee in basis points. If positive, feeAccount is required. minimum: 0 · maximum: 10000 |
feeAccount | URL query parametersquery | string | No | Token account to collect platform fees. Required if platformFeeBps is positive. |
maxAccounts | URL query parametersquery | integer | No | Maximum number of accounts for the swap route. Defaults to 64. minimum: 1 · maximum: 64 |
payer | URL query parametersquery | string | No | Account that pays transaction fees and rent. Defaults to taker when not passed in. |
wrapAndUnwrapSol | URL query parametersquery | boolean | No | Whether to wrap/unwrap SOL. Defaults to true. |
destinationTokenAccount | URL query parametersquery | string | No | - SPL token account to receive output tokens. - Mutually exclusive with nativeDestinationAccount. |
nativeDestinationAccount | URL query parametersquery | string | No | - Native SOL account to receive output. - Mutually exclusive with destinationTokenAccount. |
blockhashSlotsToExpiry | URL query parametersquery | integer | No | Number of slots until the blockhash expires. Defaults to 150. minimum: 1 · maximum: 300 |
tipAmount | URL query parametersquery | string | No | SOL tip amount in lamports. Adds a tip instruction for use with /submit. The tip payer is the taker (or payer if specified). |
computeUnitPricePercentile | URL query parametersquery | string | No | 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. enum: "medium", "high", "veryHigh" |
forJitoBundle | URL query parametersquery | boolean | No | Set to `true` if the transaction will be submitted as part of a Jito bundle. This excludes DEXes that are incompatible with Jito bundles. |
transactionVersion | URL query parametersquery | string | No | 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). enum: "0", "1" |
maxBytes | URL query parametersquery | integer | No | 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`). minimum: 1 · maximum: 1232 |
Required markers inside a nested object or variant apply when that object or variant is used.
Response structure
addressesByLookupTableAddressobject13t3zQRgBuWNVHaxzD2Uf3ELzFaFr8civojnjH4MiRsstring[]5a1fzA5giAgNUq4s8gRaEFuJew4Q2ePU9h159xeUS37xstring[]Bu5FqnUDrKcpeC4ikT3og9qFx3VqYcqVVi9NEGQfBtpHstring[]C4wHbJ2nx5ys544Li6R4QLCbiMY8FrBK3Xjsact93kTwstring[]
blockhashWithMetadataobjectblockhashinteger[]fetchedAtobjectnanos_since_epochintegersecs_since_epochinteger
lastValidBlockHeightinteger
cleanupInstructionobjectaccountsobject[]isSignerbooleanisWritablebooleanpubkeystring
datastringprogramIdstring
computeBudgetInstructionsobject[]accountsunknown[]datastringprogramIdstring
inAmountstringinputMintstringotherAmountThresholdstringotherInstructionsunknown[]outAmountstringoutputMintstringpriceImpactPctstringroutePlanobject[]bpsintegerpercentnumberswapInfoobjectammKeystringinAmountstringinputMintstringlabelstringoutAmountstringoutputMintstring
setupInstructionsobject[]accountsobject[]isSignerbooleanisWritablebooleanpubkeystring
datastringprogramIdstring
slippageBpsintegerswapInstructionobjectaccountsobject[]isSignerbooleanisWritablebooleanpubkeystring
datastringprogramIdstring
swapModestringtipInstructionnulltransactionVersioninteger
Agent integration
Copy the resource contract without sharing an API key.
Error handling
| Status | Next step |
|---|---|
400 | Check the offering and request fields. |
401 / 403 | Verify your credentials and access permissions. |
402 | Inspect the selected access mode and returned payment requirements. |
429 | Respect the returned rate limit and retry guidance. |
5xx | Inspect the error and usage record before retrying a paid operation. |
Examples
Documentation example (source abbreviated)
Published documentation example. Verify the actual response after an approved call.
Prepare your environment
Use a terminal with cURL installed.
Use an OpenAny API key with shared-balance access. Confirm availability and price before running; a call may charge your balance.
Set the key in your terminal using the hidden prompt below. Keep its value out of source files and logs.
Terminal · macOS / Linuxprintf 'OpenAny API key: ' read -r -s OPENANY_API_KEY export OPENANY_API_KEY printf '\n'Run the request
Paste the complete command below into your terminal.
Values to replace before running 21
Review these request fields before running. Keep the published provider and request method unchanged.
inputMint- The mint address of the input token
outputMint- The mint address of the output token
amount- The amount to swap in the smallest unit of the input token
taker- Public key of the user initiating the swap.
slippageBps- Slippage tolerance in basis points. Defaults to 50. Import profile accepts the string branch only; other union branches are not exposed.
mode- Quoting mode. "fast" trades quote optimality for reduced latency.
dexes- - 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.
excludeDexes- - 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.
platformFeeBps- Platform fee in basis points. If positive, feeAccount is required.
feeAccount- Token account to collect platform fees. Required if platformFeeBps is positive.
maxAccounts- Maximum number of accounts for the swap route. Defaults to 64.
payer- Account that pays transaction fees and rent. Defaults to taker when not passed in.
wrapAndUnwrapSol- Whether to wrap/unwrap SOL. Defaults to true.
destinationTokenAccount- - SPL token account to receive output tokens. - Mutually exclusive with nativeDestinationAccount.
nativeDestinationAccount- - Native SOL account to receive output. - Mutually exclusive with destinationTokenAccount.
blockhashSlotsToExpiry- Number of slots until the blockhash expires. Defaults to 150.
tipAmount- SOL tip amount in lamports. Adds a tip instruction for use with /submit. The tip payer is the taker (or payer if specified).
computeUnitPricePercentile- 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.
forJitoBundle- Set to `true` if the transaction will be submitted as part of a Jito bundle. This excludes DEXes that are incompatible with Jito bundles.
transactionVersion- 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).
maxBytes- 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`).
Terminal · cURLcurl \ 'https://api.openany.si/v1/agent-apis/jupiter/swap/v2/build?amount=10000000&inputMint=So11111111111111111111111111111111111111112&outputMint=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&taker=GkwFnmMDvn3HGMpJpWBg8tgJxr3NxNvg3AXxvXVPbRGJ' \ -X GET \ -H "Authorization: Bearer $OPENANY_API_KEY" \ -H 'Content-Type: application/json'Check the response
Sample response · Documented HTTP 200
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 }