Skip to main content
POST
/
borrow
/
operate
Build unsigned operate transaction
curl --request POST \
  --url https://api.jup.ag/lend/v1/borrow/operate \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "vaultId": 1,
  "positionId": 0,
  "signer": "4AwWnVxWKdZCZ8zVGdD7S3EwzRHkVRiXJxQKzwjbBayj",
  "colAmount": "10000",
  "debtAmount": "100"
}
'
import requests

url = "https://api.jup.ag/lend/v1/borrow/operate"

payload = {
"vaultId": 1,
"positionId": 0,
"signer": "4AwWnVxWKdZCZ8zVGdD7S3EwzRHkVRiXJxQKzwjbBayj",
"colAmount": "10000",
"debtAmount": "100"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
vaultId: 1,
positionId: 0,
signer: '4AwWnVxWKdZCZ8zVGdD7S3EwzRHkVRiXJxQKzwjbBayj',
colAmount: '10000',
debtAmount: '100'
})
};

fetch('https://api.jup.ag/lend/v1/borrow/operate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.jup.ag/lend/v1/borrow/operate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'vaultId' => 1,
'positionId' => 0,
'signer' => '4AwWnVxWKdZCZ8zVGdD7S3EwzRHkVRiXJxQKzwjbBayj',
'colAmount' => '10000',
'debtAmount' => '100'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.jup.ag/lend/v1/borrow/operate"

payload := strings.NewReader("{\n \"vaultId\": 1,\n \"positionId\": 0,\n \"signer\": \"4AwWnVxWKdZCZ8zVGdD7S3EwzRHkVRiXJxQKzwjbBayj\",\n \"colAmount\": \"10000\",\n \"debtAmount\": \"100\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.jup.ag/lend/v1/borrow/operate")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"vaultId\": 1,\n \"positionId\": 0,\n \"signer\": \"4AwWnVxWKdZCZ8zVGdD7S3EwzRHkVRiXJxQKzwjbBayj\",\n \"colAmount\": \"10000\",\n \"debtAmount\": \"100\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.jup.ag/lend/v1/borrow/operate")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"vaultId\": 1,\n \"positionId\": 0,\n \"signer\": \"4AwWnVxWKdZCZ8zVGdD7S3EwzRHkVRiXJxQKzwjbBayj\",\n \"colAmount\": \"10000\",\n \"debtAmount\": \"100\"\n}"

response = http.request(request)
puts response.read_body
{
  "nftId": 9062,
  "transaction": "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAgSLx7tPDvhw1CP7ZRClws8DN/LJyixatJZus2rQZ5pAG4cj71J70/rvu0J/yTO1674UGxqeljWsbxMzyBLGGTIhSXDKb3wVHYzXo0QFPryr6iEn/iNAYzX5PAlDQtaHW8lZfXf/XyEr3Wopfe9zqFiLis6v4f8U6hxuQhWGjqLG94CERPvP3H/BclenozhcxbxUXvL+eHEhCG764X4ME0EGHl8szytbAyAc7IdpMQ3ZAWF7Tn2sEZyyHpR1gWMtyb6oAuWSMFFuPlFmrZgneVXPFM1IT/BLHA9RbwtgiUIANaxKCIpkUG7pyNCcpG772SuCkkknsAKWSbiImP8gVvFqPeA4oganO3BaPj9y3TzLqfiwk9dDCxaIuRcmdJ+MiQSCv4el+RWy7kuZColtQumOW/ySBZLynRpY6hFkqzWzMMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEcn8RD5rZyCj3b2Rq49ZiVsmScRvvn3bU9qhBHACBPVR6mnvvwFsKRZEO8A58f97e1/yRiQ5ahJERwinC6lqslJomRsm5Gr9y9W+wdHAcnDKneVfnQTMTEQq+wdbs8IgIyXJY9OJInxuz0QKRSODYMLWhOZ2v8QhASOe9jb6fhZxvp6877brTo9ZfNqq8l0MbG75MLS9uDkfKYCA0UvXWEK/huRLkhelf0V6yk33/xLN6MW0KY4Ev8Cukm0xsGNHgbd9uHXZaGT2cvhRs7reawctIXtX1s3kTqM9YV+/wCpjWK6m/JZmhh7wDcE7nwe+sC7C7VoO3NCsHbuaiJo3IYBEBEABwIPCwEFBAgMBgMJDREOChDyI8aJUuHythAnAAAAAAAA"
}

Authorizations

x-api-key
string
header
required

Query Parameters

market
enum<string>
default:main

Lend market identifier. Defaults to main.

Available options:
main,
ethena

Body

application/json

Request body validated by operateValidator in app/validators/borrowing.ts.

vaultId
integer
required

Target vault id.

Example:

1

positionId
integer
required

Existing position id. Use 0 when opening a new position.

Example:

0

signer
string
required

Transaction fee payer and signer wallet address.

Example:

"4AwWnVxWKdZCZ8zVGdD7S3EwzRHkVRiXJxQKzwjbBayj"

colAmount
string
required

Collateral delta in supply-token base units. Positive deposits collateral, negative withdraws. Use -170141183460469231731687303715884105728 (MIN_I128) to withdraw all collateral.

Pattern: ^-?[0-9]+$
Example:

"10000"

debtAmount
string
required

Debt delta in borrow-token base units. Positive borrows, negative repays. Use -170141183460469231731687303715884105728 (MIN_I128) to repay all debt.

Pattern: ^-?[0-9]+$
Example:

"100"

positionOwner
string

Optional position owner when operating on behalf of another wallet.

Example:

"4AwWnVxWKdZCZ8zVGdD7S3EwzRHkVRiXJxQKzwjbBayj"

Response

200 - application/json

Unsigned operate transaction

nftId
integer
required

Position NFT id affected by the operation.

transaction
string
required

Base64-encoded unsigned versioned transaction.