Skip to main content
POST
/
positions
/
decrease-with-fee
cURL
curl --request POST \
  --url https://lite-api.jup.ag/perps/v1/positions/decrease-with-fee \
  --header 'Content-Type: application/json' \
  --data '{
  "collateralUsdDelta": "10000000",
  "entirePosition": false,
  "feeToken": "USDC",
  "feeTokenAmount": "1000000",
  "feeReceiver": "<string>",
  "maxSlippageBps": "100",
  "positionPubkey": "5HHB8sCKjWPU2zr3p4Lg49mQiaPQiHbCjHW7jgVzp583",
  "priorityFeeMicroLamports": "<string>",
  "receiveToken": "BTC",
  "sizeUsdDelta": "10000000"
}'
{
  "positionPubkey": "<string>",
  "quote": {
    "closeFeeUsd": "100000",
    "closeFeeUsdFormatted": "0.1000",
    "collateralUsdDelta": "10000000",
    "collateralUsdDeltaFormatted": "10.00",
    "integratorFeeTokenMint": "<string>",
    "integratorFeeTokenAmount": "<string>",
    "integratorFeeUsd": "<string>",
    "integratorFeeUsdFormatted": "<string>",
    "leverage": "2.99",
    "liquidationPriceUsd": "13240000",
    "liquidationPriceUsdFormatted": "13.24",
    "outstandingBorrowFeeUsd": "100000",
    "outstandingBorrowFeeUsdFormatted": "0.1000",
    "pnlAfterFeesUsd": "1045000",
    "pnlAfterFeesUsdFormatted": "1.045",
    "pnlAfterFeesPercent": "-20.24",
    "pnlBeforeFeesUsd": "1045000",
    "pnlBeforeFeesUsdFormatted": "1.045",
    "pnlBeforeFeesPercent": "20.24",
    "positionCollateralUsd": "100000000",
    "positionCollateralUsdFormatted": "100.00",
    "positionSizeUsd": "10000000",
    "positionSizeUsdFormatted": "10.00",
    "priceImpactFeeBps": "1.3301",
    "priceImpactFeeUsd": "13301",
    "priceImpactFeeUsdFormatted": "0.0133",
    "side": "long",
    "sizeUsdDelta": "10000000",
    "sizeUsdDeltaFormatted": "10.00",
    "totalFeeUsd": "100000",
    "totalFeeUsdFormatted": "0.1000",
    "transferAmountToken": "100000000",
    "transferAmountUsd": "10000000",
    "transferAmountUsdFormatted": "10.00",
    "transferTokenMint": "So11111111111111111111111111111111111111112"
  },
  "serializedTxBase64": "<string>",
  "txMetadata": {
    "blockhash": "<string>",
    "lastValidBlockHeight": "<string>",
    "transactionFeeLamports": "5000",
    "accountRentLamports": "2039280"
  }
}

Body

application/json
feeToken
enum<string>
required

The token symbol for the fee token. Currently only USDC is supported

Available options:
USDC
feeTokenAmount
string
required

The amount of fee tokens to send to feeReceiver. The value must match the token mint decimals specified in feeToken (e.g., for USDC with 6 decimals, 1000000 = 1 USDC)

Example:

"1000000"

feeReceiver
string
required

The token address (ATA) to receive the fee specified in feeTokenAmount. The ATA must match the token mint specified in feeToken

positionPubkey
string
required

The public key for the open position. Use the GET positions endpoint to fetch the public key for the trader's open positions.

Example:

"5HHB8sCKjWPU2zr3p4Lg49mQiaPQiHbCjHW7jgVzp583"

receiveToken
enum<string>
required

The token to receive.

Available options:
BTC,
ETH,
SOL,
USDC
collateralUsdDelta
string | null

The amount of collateral to withdraw in USD from the position. Must be an integer representing the USD amount multiplied by 10^6 (1 million) to align with the 6 decimal places used for USDC/USDT tokens on-chain. For example, to decrease by $10 USD, set 'collateralUsdDelta' to 10000000; for $20.50 USD, set 'collateralUsdDelta' to 20500000.

Example:

"10000000"

entirePosition
boolean
default:false

When set to true, this will close the position and transfer the remaining collateral and realised profits (if the position is profitable) to the trader.

Example:

false

maxSlippageBps
string
default:200

The maximum slippage in (BPS) for the token swap (if required) and the token price when executing the increase position trade

Example:

"100"

priorityFeeMicroLamports
string

Custom priority fee in microlamports for the transaction (1,000,000 microlamports = 1 lamport). If not set, the API will automatically set the optimal priority fee

sizeUsdDelta
string | null

The amount in USD to decrease the position size by. Must be an integer representing the USD amount multiplied by 10^6 (1 million) to align with the 6 decimal places used for USDC/USDT tokens on-chain. For example, to decrease by $10 USD, set 'sizeUsdDelta' to 10000000; for $20.50 USD, set 'sizeUsdDelta' to 20500000.

Example:

"10000000"

Response

200 OK

positionPubkey
string
required

The unique identifier (i.e. a program derived address) for the position account. Use this address to find the position account onchain.

quote
object
required
serializedTxBase64
string
required

The serialized transaction (base64 encoded) containing the instructions and given parameters for the decrease position request. The transaction can be deserialized, signed by the owner of walletAddress and submitted onchain to execute the decrease position request

txMetadata
object
required

Contains relevant metadata for the serialized transaction.