Skip to main content
POST
/
positions
/
decrease
cURL
curl --request POST \
  --url https://lite-api.jup.ag/perps/v1/positions/decrease \
  --header 'Content-Type: application/json' \
  --data '{
  "collateralUsdDelta": "10000000",
  "entirePosition": false,
  "maxSlippageBps": "100",
  "positionPubkey": "5HHB8sCKjWPU2zr3p4Lg49mQiaPQiHbCjHW7jgVzp583",
  "priorityFeeMicroLamports": "<string>",
  "receiveToken": "BTC",
  "sizeUsdDelta": "10000000"
}'
{
  "positionPubkey": "<string>",
  "quote": {
    "closeFeeUsd": "100000",
    "collateralUsdDelta": "10000000",
    "leverage": "2.99",
    "liquidationPriceUsd": "13240000",
    "outstandingBorrowFeeUsd": "100000",
    "pnlAfterFeesUsd": "1045000",
    "pnlAfterFeesPercent": "-20.24",
    "pnlBeforeFeesUsd": "1045000",
    "pnlBeforeFeesPercent": "20.24",
    "positionCollateralUsd": "100000000",
    "positionSizeUsd": "10000000",
    "priceImpactFeeBps": "1.3301",
    "priceImpactFeeUsd": "13301",
    "side": "long",
    "sizeUsdDelta": "10000000",
    "totalFeeUsd": "100000",
    "transferAmountToken": "100000000",
    "transferAmountUsd": "10000000",
    "transferTokenMint": "So11111111111111111111111111111111111111112"
  },
  "serializedTxBase64": "<string>",
  "txMetadata": {
    "blockhash": "<string>",
    "lastValidBlockHeight": "<string>",
    "transactionFeeLamports": "5000",
    "accountRentLamports": "2039280"
  }
}

Body

application/json
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 asset's price when executing the 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.