Swap

quote

Request for a quote to be used in POST /swap

get/quote

Query parameters

inputMintstring required
outputMintstring required
amountinteger required
  • Raw amount to swap (before decimals)
  • Input Amount if SwapMode=ExactIn
  • Output Amount if SwapMode=ExactOut
slippageBpsinteger
  • Default: 50
  • This is threshold denoted in basis points.
  • If exact in and output amount exceeds the threshold, then the swap transaction will fail.
swapMode'ExactIn' | 'ExactOut'
  • ExactOut is for supporting use cases where you need an exact output amount
  • In the case of ExactIn, the slippage is on the output token
  • In the case of ExactOut, the slippage is on the input token
  • Not all AMMs support ExactOut: Currently only Orca Whirlpool, Raydium CLMM, Raydium CPMM
  • We do not recommend using ExactOut for most use cases
dexesstring[]
excludeDexesstring[]
restrictIntermediateTokensboolean
  • Restrict intermediate tokens within a route to a set of more stable tokens
  • This will help to reduce exposure to potential high slippage routes
onlyDirectRoutesboolean
  • Direct route limits Jupiter routing to single hop routes only
  • This may result in worse routes
asLegacyTransactionboolean
  • Instead of using versioned transaction, this will use the legacy transaction
platformFeeBpsinteger
  • Take fees in basis points
  • If platformFeeBps is passed in, the feeAccount in /swap must be passed as well
maxAccountsinteger
  • Rough estimate of the max accounts to be used for the quote
  • Useful if composing your own transaction or to be more precise in resource accounting for better routes
instructionVersion'V1' | 'V2'
  • The version of instruction to use in the swap program
dynamicSlippageboolean
  • No longer applicable, only required to pass in via /swap endpoint

Response

Successful response to be used in /swap

inputMintstring required
inAmountstring required
outputMintstring required
outAmountstring required
  • Calculated output amount from routing engine
  • The value includes platform fees and DEX fees, excluding slippage
otherAmountThresholdstring required
  • Calculated minimum output amount after accounting for slippageBps on the outAmount value
  • Not used by /swap endpoint to build transaction
instructionVersion'V1' | 'V2' nullable
  • The version of instruction to use in the swap program
swapMode'ExactIn' | 'ExactOut' required
slippageBpsinteger required
priceImpactPctstring required
contextSlotinteger
timeTakennumber

Changes

Changed in 28 of the 50 revisions of this API.381939

    • added the optional property instructionVersion to the response with the 200 status

      response-optional-property-added

    • the response property routePlan/items/percent became nullable for the status 200

      response-property-became-nullable

    • removed the required property routePlan/items/swapInfo/feeAmount from the response with the 200 status

      response-required-property-removed

    • removed the required property routePlan/items/swapInfo/feeMint from the response with the 200 status

      response-required-property-removed

  • 18138545f5de92See the full diff
    • for the query request parameter slippageBps, default value 50 was added

      request-parameter-default-value-added

    • for the query request parameter amount, the type/format was changed from integer/ to integer/uint64

      request-parameter-type-changed

    • for the query request parameter maxAccounts, the type/format was changed from integer/ to integer/uint64

      request-parameter-type-changed

    • for the query request parameter platformFeeBps, the type/format was changed from integer/ to integer/uint16

      request-parameter-type-changed

    • for the query request parameter slippageBps, the type/format was changed from integer/ to integer/uint16

      request-parameter-type-changed

    • the response property routePlan/items/percent became optional for the status 200

      response-property-became-optional

    • the platformFee/feeBps response's property type/format changed from integer/int32 to integer/uint16 for status 200

      response-property-type-changed

    • the routePlan/items/percent response's property type/format changed from integer/int32 to integer/uint8 for status 200

      response-property-type-changed

    • the slippageBps response's property type/format changed from integer/int32 to integer/uint16 for status 200

      response-property-type-changed

    • added the new optional query request parameter instructionVersion

      new-optional-request-parameter

    • added the optional property routePlan/items/bps to the response with the 200 status

      response-optional-property-added

    • endpoint added

      endpoint-added

    • api path removed without deprecation

      api-path-removed-without-deprecation

    • for the query request parameter asLegacyTransaction, default value false was added

      request-parameter-default-value-added

    • for the query request parameter maxAccounts, default value 64 was added

      request-parameter-default-value-added

    • for the query request parameter onlyDirectRoutes, default value false was added

      request-parameter-default-value-added

    • for the query request parameter restrictIntermediateTokens, default value true was added

      request-parameter-default-value-added

    • for the query request parameter swapMode, default value ExactIn was added

      request-parameter-default-value-added

    • for the query request parameter amount, the type/format was changed from number/ to integer/

      request-parameter-type-changed

    • for the query request parameter maxAccounts, the type/format was changed from number/ to integer/

      request-parameter-type-changed

    • for the query request parameter platformFeeBps, the type/format was changed from number/ to integer/

      request-parameter-type-changed

    • for the query request parameter slippageBps, the type/format was changed from number/ to integer/

      request-parameter-type-changed

    • added the new optional query request parameter dynamicSlippage

      new-optional-request-parameter

    • endpoint added

      endpoint-added

    • api path removed without deprecation

      api-path-removed-without-deprecation

    This revision also has 1 change that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog

  • 5904b9a202ab3125See the full diff
    • the response property platformFee/amount became optional for the status 200

      response-property-became-optional

    • the response property platformFee/feeBps became optional for the status 200

      response-property-became-optional

    • the response property routePlan/items/swapInfo/label became optional for the status 200

      response-property-became-optional

    • deleted the query request parameter autoSlippage

      request-parameter-removed

    • deleted the query request parameter autoSlippageCollisionUsdValue

      request-parameter-removed

    • deleted the query request parameter computeAutoSlippage

      request-parameter-removed

    • deleted the query request parameter dynamicSlippage

      request-parameter-removed

    • deleted the query request parameter maxAutoSlippageBps

      request-parameter-removed

    • deleted the query request parameter minimizeSlippage

      request-parameter-removed

    • deleted the query request parameter preferLiquidDexes

      request-parameter-removed

    • deleted the query request parameter preferSimpleRouting

      request-parameter-removed

    • deleted the query request parameter tokenCategoryBasedIntermediateTokens

      request-parameter-removed

    • removed the optional property computedAutoSlippage from the response with the 200 status

      response-optional-property-removed

    • removed the optional property simplerRouteUsed from the response with the 200 status

      response-optional-property-removed

    • removed the optional property swapUsdValue from the response with the 200 status

      response-optional-property-removed

    • api tag Swap added

      api-tag-added

    • for the query request parameter amount, the type/format was generalized from integer/ to number/

      request-parameter-type-generalized

    • for the query request parameter maxAccounts, the type/format was generalized from integer/ to number/

      request-parameter-type-generalized

    • for the query request parameter platformFeeBps, the type/format was generalized from integer/ to number/

      request-parameter-type-generalized

    • for the query request parameter slippageBps, the type/format was generalized from integer/ to number/

      request-parameter-type-generalized

    This revision also has 1 change that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog

    • added the new optional query request parameter preferSimpleRouting

      new-optional-request-parameter

    • added the optional property simplerRouteUsed to the response with the 200 status

      response-optional-property-added