curl --request POST \
--url https://api.lpagent.io/open-api/v1/position/zap-out-estimates \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"bps": 10000,
"position_id": "Ep22EwKegXis3bTC6P8JLgsHaT5J2beM2TncKe2Hmv24",
"id": "<string>",
"outputs": [
"allBaseToken",
"both"
]
}
'import requests
url = "https://api.lpagent.io/open-api/v1/position/zap-out-estimates"
payload = {
"bps": 10000,
"position_id": "Ep22EwKegXis3bTC6P8JLgsHaT5J2beM2TncKe2Hmv24",
"id": "<string>",
"outputs": ["allBaseToken", "both"]
}
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({
bps: 10000,
position_id: 'Ep22EwKegXis3bTC6P8JLgsHaT5J2beM2TncKe2Hmv24',
id: '<string>',
outputs: ['allBaseToken', 'both']
})
};
fetch('https://api.lpagent.io/open-api/v1/position/zap-out-estimates', 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.lpagent.io/open-api/v1/position/zap-out-estimates",
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([
'bps' => 10000,
'position_id' => 'Ep22EwKegXis3bTC6P8JLgsHaT5J2beM2TncKe2Hmv24',
'id' => '<string>',
'outputs' => [
'allBaseToken',
'both'
]
]),
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.lpagent.io/open-api/v1/position/zap-out-estimates"
payload := strings.NewReader("{\n \"bps\": 10000,\n \"position_id\": \"Ep22EwKegXis3bTC6P8JLgsHaT5J2beM2TncKe2Hmv24\",\n \"id\": \"<string>\",\n \"outputs\": [\n \"allBaseToken\",\n \"both\"\n ]\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.lpagent.io/open-api/v1/position/zap-out-estimates")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"bps\": 10000,\n \"position_id\": \"Ep22EwKegXis3bTC6P8JLgsHaT5J2beM2TncKe2Hmv24\",\n \"id\": \"<string>\",\n \"outputs\": [\n \"allBaseToken\",\n \"both\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lpagent.io/open-api/v1/position/zap-out-estimates")
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 \"bps\": 10000,\n \"position_id\": \"Ep22EwKegXis3bTC6P8JLgsHaT5J2beM2TncKe2Hmv24\",\n \"id\": \"<string>\",\n \"outputs\": [\n \"allBaseToken\",\n \"both\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"data": {
"lane": "wallet",
"bps": 123,
"isClose": true,
"nativePriceUsd": 123,
"target": {
"address": "<string>",
"symbol": "<string>",
"decimals": 123
},
"estimates": [
{
"output": "allToken0",
"ok": true,
"error": "<string>",
"receive": [
{
"address": "<string>",
"decimals": 123,
"amount": "<string>",
"uiAmount": 123
}
],
"valueNative": 123,
"valueUsd": 123,
"marketValueNative": 123,
"marketValueUsd": 123,
"priceImpactPct": 123
}
]
}
}Zap-Out - Estimate what a withdrawal pays out
For each output option of decrease-tx, returns what the wallet ends up with after the swap and fees, priced on the route the transaction is built on: net amounts, their value in SOL and USD, and the same withdrawal’s value at the pool price before any swap. Call it before decrease-tx to show the user the real payout.
Meteora DLMM positions only. Solana only - this endpoint has no Robinhood Chain (EVM) equivalent.
Replaces POST /position/decrease-quotes, which has been removed.
curl --request POST \
--url https://api.lpagent.io/open-api/v1/position/zap-out-estimates \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"bps": 10000,
"position_id": "Ep22EwKegXis3bTC6P8JLgsHaT5J2beM2TncKe2Hmv24",
"id": "<string>",
"outputs": [
"allBaseToken",
"both"
]
}
'import requests
url = "https://api.lpagent.io/open-api/v1/position/zap-out-estimates"
payload = {
"bps": 10000,
"position_id": "Ep22EwKegXis3bTC6P8JLgsHaT5J2beM2TncKe2Hmv24",
"id": "<string>",
"outputs": ["allBaseToken", "both"]
}
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({
bps: 10000,
position_id: 'Ep22EwKegXis3bTC6P8JLgsHaT5J2beM2TncKe2Hmv24',
id: '<string>',
outputs: ['allBaseToken', 'both']
})
};
fetch('https://api.lpagent.io/open-api/v1/position/zap-out-estimates', 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.lpagent.io/open-api/v1/position/zap-out-estimates",
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([
'bps' => 10000,
'position_id' => 'Ep22EwKegXis3bTC6P8JLgsHaT5J2beM2TncKe2Hmv24',
'id' => '<string>',
'outputs' => [
'allBaseToken',
'both'
]
]),
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.lpagent.io/open-api/v1/position/zap-out-estimates"
payload := strings.NewReader("{\n \"bps\": 10000,\n \"position_id\": \"Ep22EwKegXis3bTC6P8JLgsHaT5J2beM2TncKe2Hmv24\",\n \"id\": \"<string>\",\n \"outputs\": [\n \"allBaseToken\",\n \"both\"\n ]\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.lpagent.io/open-api/v1/position/zap-out-estimates")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"bps\": 10000,\n \"position_id\": \"Ep22EwKegXis3bTC6P8JLgsHaT5J2beM2TncKe2Hmv24\",\n \"id\": \"<string>\",\n \"outputs\": [\n \"allBaseToken\",\n \"both\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lpagent.io/open-api/v1/position/zap-out-estimates")
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 \"bps\": 10000,\n \"position_id\": \"Ep22EwKegXis3bTC6P8JLgsHaT5J2beM2TncKe2Hmv24\",\n \"id\": \"<string>\",\n \"outputs\": [\n \"allBaseToken\",\n \"both\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"data": {
"lane": "wallet",
"bps": 123,
"isClose": true,
"nativePriceUsd": 123,
"target": {
"address": "<string>",
"symbol": "<string>",
"decimals": 123
},
"estimates": [
{
"output": "allToken0",
"ok": true,
"error": "<string>",
"receive": [
{
"address": "<string>",
"decimals": 123,
"amount": "<string>",
"uiAmount": 123
}
],
"valueNative": 123,
"valueUsd": 123,
"marketValueNative": 123,
"marketValueUsd": 123,
"priceImpactPct": 123
}
]
}
}Authorizations
API key for authentication
Body
Basis points of the position to withdraw (1-10000). 10000 closes it and claims its fees.
1 <= x <= 1000010000
The position address, as passed to decrease-tx. This is the id (same value as tokenId) that /lp-positions/opening returns. Either this or id is required.
"Ep22EwKegXis3bTC6P8JLgsHaT5J2beM2TncKe2Hmv24"
An encrypted position ID, still accepted in place of position_id. The id that /lp-positions/opening returns on this API is already the plain position address: send that one as position_id.
Price only these output options (default all four)
allToken0, allToken1, both, allBaseToken ["allBaseToken", "both"]
Was this page helpful?