Unwind
curl --request POST \
--url https://api.example.com/v1/operations/unwindimport requests
url = "https://api.example.com/v1/operations/unwind"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/v1/operations/unwind', 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.example.com/v1/operations/unwind",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/operations/unwind"
req, _ := http.NewRequest("POST", url, nil)
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.example.com/v1/operations/unwind")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/operations/unwind")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyOperations
Unwind
POST /v1/operations/unwind — Plan an unwind operation
POST
/
v1
/
operations
/
unwind
Unwind
curl --request POST \
--url https://api.example.com/v1/operations/unwindimport requests
url = "https://api.example.com/v1/operations/unwind"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/v1/operations/unwind', 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.example.com/v1/operations/unwind",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/operations/unwind"
req, _ := http.NewRequest("POST", url, nil)
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.example.com/v1/operations/unwind")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/operations/unwind")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyEndpoint:
POST https://api.rebelfi.io/v1/operations/unwindRequest Body
Provide one wallet identifier:| Field | Type | Required | Description |
|---|---|---|---|
walletAddress | string | One of | Wallet address |
walletId | number | One of | Wallet ID from registration |
strategyId | number | Yes | Strategy ID to unwind from |
amount | string | One of | Amount to unwind in base units. Required unless fullWithdrawal is true. |
fullWithdrawal | boolean | One of | If true, withdraws the full position using the protocol’s native max-withdrawal mechanism. Cannot be combined with amount. |
Example Request
curl -X POST "https://api.rebelfi.io/v1/operations/unwind" \
-H "x-api-key: your_api_key" \
-H "Content-Type: application/json" \
-d '{
"walletId": 42,
"strategyId": 1,
"amount": "500000000"
}'
curl -X POST "https://api.rebelfi.io/v1/operations/unwind" \
-H "x-api-key: your_api_key" \
-H "Content-Type: application/json" \
-d '{
"walletId": 42,
"strategyId": 1,
"fullWithdrawal": true
}'
const operation = await client.operations.unwind({
walletId: 42,
strategyId: 1,
amount: '500000000'
});
const operation = await client.operations.unwind({
walletId: 42,
strategyId: 1,
fullWithdrawal: true
});
Example Response
{
"operationId": 124,
"type": "unwind",
"status": "awaiting_signature",
"transactions": [
{
"id": 457,
"blockchain": "solana",
"status": "unsigned",
"unsignedTransaction": "AQAAAA...base64...",
"description": "Unwind 500 USDC from Kamino"
}
],
"expiresAt": "2024-01-15T10:35:00Z"
}
Errors
| Code | Description |
|---|---|
INVALID_AMOUNT | Amount is zero, negative, or malformed |
ALLOCATION_NOT_FOUND | No position exists at this strategy |
INSUFFICIENT_BALANCE | Amount exceeds allocation |
STRATEGY_NOT_FOUND | Strategy ID doesn’t exist |
INSUFFICIENT_GAS | Not enough SOL for transaction fee |
OPERATION_IN_PROGRESS | Another operation is currently executing for this wallet |
WALLET_NOT_FOUND | Wallet ID doesn’t exist |