Skip to main content
POST
/
tpsl
cURL
curl --request POST \
  --url https://lite-api.jup.ag/perps/v1/tpsl \
  --header 'Content-Type: application/json' \
  --data '{
  "owner": "5HHB8sCKjWPU2zr3p4Lg49mQiaPQiHbCjHW7jgVzp583",
  "positionPubkey": "5HHB8sCKjWPU2zr3p4Lg49mQiaPQiHbCjHW7jgVzp583",
  "desiredMint": "So11111111111111111111111111111111111111112",
  "sizeUsdDelta": "10000000",
  "triggerPrice": "20000000",
  "requestType": "tp",
  "transactionType": "mixed",
  "tpsl": [
    {
      "desiredMint": "So11111111111111111111111111111111111111112",
      "entirePosition": false,
      "sizeUsdDelta": "10000000",
      "triggerPrice": "20000000",
      "requestType": "tp"
    }
  ]
}'
{
  "tpslPubkeys": [
    "<string>"
  ],
  "requireKeeperSignature": true,
  "serializedTxBase64": "<string>",
  "transactionType": "legacy",
  "txMetadata": {
    "blockhash": "<string>",
    "lastValidBlockHeight": "<string>",
    "transactionFeeLamports": "0.5",
    "accountRentLamports": "0.5"
  }
}

Body

application/json
owner
string
required

The public key for owner of the position.

Example:

"5HHB8sCKjWPU2zr3p4Lg49mQiaPQiHbCjHW7jgVzp583"

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"

desiredMint
enum<string> | null

The mint address for the token used when withdrawing collateral or closing position when the TPSL is executed.

Available options:
So11111111111111111111111111111111111111112,
7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs,
3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh,
EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v,
Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB
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 the USDC mint on-chain. For example, to decrease by $10 USD, set 'sizeUsdDelta' to 10000000; for $20.50 USD, set 'sizeUsdDelta' to 20500000.

Example:

"10000000"

triggerPrice
string | null

Trigger price at which the TP / SL request will be executed. The value must be an integer corresponding to 6 decimal places. For example, to set a trigger price of $20, pass in 20000000

Example:

"20000000"

requestType
enum<string> | null

Pass in tp to set a take profit request or sl to set a stop loss request

Available options:
tp,
sl
transactionType
enum<string>
default:mixed

Sets the type of serialized transaction to execute the action. If the transaction type is legacy, the transaction must be submitted by the client itself through the RPC. If the transaction type is instant, the transaction must be sent to the POST /transaction/execute endpoint. If the transaction type is mixed, the transactionType returned in the response will be either legacy or instant.

Available options:
legacy,
mixed,
instant
tpsl
object[] | null

TPSL requests to set

Response

200 OK

tpslPubkeys
string[]
required

The position request account pubkeys for the TP / SL

requireKeeperSignature
boolean
required

When requireKeeperSignature is true, the transaction must be signed, serialized, and sent to the the POST /transaction/execute endpoint to execute the transaction. When requireKeeperSignature is false, the transaction can be submitted through the sendTransaction RPC call as usual

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

transactionType
enum<string>
required

Returns the type of serialized transaction to execute the action. If the transaction type is legacy, the transaction must be submitted by the client itself through the RPC. If the transaction type is instant, the transaction must be sent to the POST /transaction/execute endpoint.

Available options:
legacy,
instant
txMetadata
object
required

Contains relevant metadata for the serialized transaction.