Skip to main content
POST
/
execute
Execute Transaction
curl --request POST \
  --url https://api.jup.ag/swap/v2/execute \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "signedTransaction": "<string>",
  "requestId": "<string>",
  "lastValidBlockHeight": "<string>"
}
'
import requests

url = "https://api.jup.ag/swap/v2/execute"

payload = {
"signedTransaction": "<string>",
"requestId": "<string>",
"lastValidBlockHeight": "<string>"
}
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({
signedTransaction: '<string>',
requestId: '<string>',
lastValidBlockHeight: '<string>'
})
};

fetch('https://api.jup.ag/swap/v2/execute', 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/swap/v2/execute",
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([
'signedTransaction' => '<string>',
'requestId' => '<string>',
'lastValidBlockHeight' => '<string>'
]),
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/swap/v2/execute"

payload := strings.NewReader("{\n \"signedTransaction\": \"<string>\",\n \"requestId\": \"<string>\",\n \"lastValidBlockHeight\": \"<string>\"\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/swap/v2/execute")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"signedTransaction\": \"<string>\",\n \"requestId\": \"<string>\",\n \"lastValidBlockHeight\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.jup.ag/swap/v2/execute")

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 \"signedTransaction\": \"<string>\",\n \"requestId\": \"<string>\",\n \"lastValidBlockHeight\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "signature": "<string>",
  "slot": "<string>",
  "error": "<string>",
  "code": 123,
  "totalInputAmount": "<string>",
  "totalOutputAmount": "<string>",
  "inputAmountResult": "<string>",
  "outputAmountResult": "<string>",
  "swapEvents": [
    {
      "inputMint": "<string>",
      "inputAmount": "<string>",
      "outputMint": "<string>",
      "outputAmount": "<string>"
    }
  ]
}
{
"error": "<string>",
"code": 123
}
{
"signature": "<string>",
"error": "<string>"
}

Authorizations

x-api-key
string
header
required

Body

application/json
signedTransaction
string
required

Base64-encoded signed transaction

requestId
string
required

The requestId from the /order response

lastValidBlockHeight
string

Optional block height for nonce validation

Response

Execution result

status
enum<string>
Available options:
Success,
Failed
signature
string

Transaction signature

slot
string

Confirmed slot

error
string

Error message (present if Failed)

code
number
  • Error code. 0 = success.
  • Ultra: -1 (missing cached order), -2 (invalid signed tx), -3 (invalid message bytes).
  • Aggregator: -1000 (failed to land), -1001 (unknown), -1002 (invalid tx), -1003 (not fully signed), -1004 (invalid block height).
  • RFQ: -2000 (failed to land), -2001 (unknown), -2002 (invalid payload), -2003 (quote expired), -2004 (swap rejected).
totalInputAmount
string

Total input token amount deducted from the user's wallet, including the fee if feeMint is the input mint

totalOutputAmount
string

Final output token amount reflected in the user's wallet, after any fee collected in the output mint

inputAmountResult
string

Input amount that went into the swap route, after any fee collected in the input mint

outputAmountResult
string

Output amount produced by the swap route, before any fee collected in the output mint

swapEvents
object[]