Skip to main content
POST
/
tpsl
cURL
curl --request POST \
  --url https://api.jup.ag/perps/v1/tpsl \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "walletAddress": "5HHB8sCKjWPU2zr3p4Lg49mQiaPQiHbCjHW7jgVzp583",
  "positionPubkey": "5HHB8sCKjWPU2zr3p4Lg49mQiaPQiHbCjHW7jgVzp583",
  "tpsl": [
    {
      "receiveToken": "BTC",
      "triggerPrice": "20000000",
      "requestType": "tp",
      "entirePosition": false,
      "sizeUsdDelta": "10000000"
    }
  ],
  "transactionType": "instant"
}
'
{
  "tpslPubkeys": [
    "<string>"
  ],
  "requireKeeperSignature": true,
  "serializedTxBase64": "<string>",
  "tpslRequests": [
    {
      "estimatedPnlUsd": "<string>",
      "estimatedPnlPercent": "<string>",
      "hasProfit": true,
      "requestType": "tp",
      "positionRequestPubkey": "<string>"
    }
  ],
  "transactionType": "legacy",
  "txMetadata": {
    "blockhash": "<string>",
    "lastValidBlockHeight": "<string>",
    "transactionFeeLamports": "0.5",
    "accountRentLamports": "0.5"
  }
}

Authorizations

x-api-key
string
header
required

Get API key via https://portal.jup.ag

Body

application/json
walletAddress
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"

tpsl
object[]
required

TPSL requests to set.

Maximum array length: 20
transactionType
enum<string>
default:instant

Sets the type of serialized transaction to execute the action.

Available options:
instant,
mixed

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

tpslRequests
object[]
required

TPSL requests created with the increase position. Only returned when TPSL is requested.

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.