curl --request POST \
--url https://api.services.payward.com/v1/accounts/{account_id}/earn/bonded/strategies/{strategy_id}/deallocate \
--header 'API-Key: <api-key>' \
--header 'API-Nonce: <api-key>' \
--header 'API-Sign: <api-key>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"amount": "2.0"
}
'import requests
url = "https://api.services.payward.com/v1/accounts/{account_id}/earn/bonded/strategies/{strategy_id}/deallocate"
payload = { "amount": "2.0" }
headers = {
"Idempotency-Key": "<idempotency-key>",
"API-Key": "<api-key>",
"API-Sign": "<api-key>",
"API-Nonce": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
'API-Key': '<api-key>',
'API-Sign': '<api-key>',
'API-Nonce': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({amount: '2.0'})
};
fetch('https://api.services.payward.com/v1/accounts/{account_id}/earn/bonded/strategies/{strategy_id}/deallocate', 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.services.payward.com/v1/accounts/{account_id}/earn/bonded/strategies/{strategy_id}/deallocate",
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([
'amount' => '2.0'
]),
CURLOPT_HTTPHEADER => [
"API-Key: <api-key>",
"API-Nonce: <api-key>",
"API-Sign: <api-key>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-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.services.payward.com/v1/accounts/{account_id}/earn/bonded/strategies/{strategy_id}/deallocate"
payload := strings.NewReader("{\n \"amount\": \"2.0\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("API-Key", "<api-key>")
req.Header.Add("API-Sign", "<api-key>")
req.Header.Add("API-Nonce", "<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.services.payward.com/v1/accounts/{account_id}/earn/bonded/strategies/{strategy_id}/deallocate")
.header("Idempotency-Key", "<idempotency-key>")
.header("API-Key", "<api-key>")
.header("API-Sign", "<api-key>")
.header("API-Nonce", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"2.0\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.services.payward.com/v1/accounts/{account_id}/earn/bonded/strategies/{strategy_id}/deallocate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["API-Key"] = '<api-key>'
request["API-Sign"] = '<api-key>'
request["API-Nonce"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"2.0\"\n}"
response = http.request(request)
puts response.read_bodyDeallocate from a bonded earn strategy
Submits a request to deallocate funds of the specified account from the bonded earn strategy identified in the path.
Partial deallocation is allowed. To exit a strategy completely, send the full earning amount. The funds then pass through the exit queue (if any) and the unbonding period. For an instant strategy they return right away.
The request is processed asynchronously. A successful response only confirms that the request was accepted and returns its request_id; poll the request status endpoint with that identifier to learn whether the deallocation succeeded or failed.
Reuse the same Idempotency-Key only when retrying the same request. Keys are scoped to the account. Retrying with the same key, strategy, and amount returns the original request_id without deallocating again. Reusing the key with a different strategy or amount, or for an allocation instead of a deallocation, returns a conflict error.
Rejected requests return a machine-readable error.code; branch on it rather than on the message text. Known codes are strategy_not_found, insufficient_balance, amount_too_high, idempotency_key_reused, and allocation_in_progress. Only funds that are earning can be deallocated. insufficient_balance means the amount is more than those funds. Funds that are still bonding, unbonding, or in the exit queue do not count. An account that is not eligible for the strategy returns forbidden. A 403 with the code gateway is an authorization failure from the API gateway instead, so branch on error.code to tell the two apart.
A request that is accepted can still fail later. The request status endpoint then reports it in error.reason, for example insufficient_balance or not_eligible. A request that failed after it was accepted keeps its Idempotency-Key, so retry with a new key. New codes may be added, so treat an unknown code as a generic bad_request, not_found, or request_conflict error.
curl --request POST \
--url https://api.services.payward.com/v1/accounts/{account_id}/earn/bonded/strategies/{strategy_id}/deallocate \
--header 'API-Key: <api-key>' \
--header 'API-Nonce: <api-key>' \
--header 'API-Sign: <api-key>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"amount": "2.0"
}
'import requests
url = "https://api.services.payward.com/v1/accounts/{account_id}/earn/bonded/strategies/{strategy_id}/deallocate"
payload = { "amount": "2.0" }
headers = {
"Idempotency-Key": "<idempotency-key>",
"API-Key": "<api-key>",
"API-Sign": "<api-key>",
"API-Nonce": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
'API-Key': '<api-key>',
'API-Sign': '<api-key>',
'API-Nonce': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({amount: '2.0'})
};
fetch('https://api.services.payward.com/v1/accounts/{account_id}/earn/bonded/strategies/{strategy_id}/deallocate', 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.services.payward.com/v1/accounts/{account_id}/earn/bonded/strategies/{strategy_id}/deallocate",
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([
'amount' => '2.0'
]),
CURLOPT_HTTPHEADER => [
"API-Key: <api-key>",
"API-Nonce: <api-key>",
"API-Sign: <api-key>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-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.services.payward.com/v1/accounts/{account_id}/earn/bonded/strategies/{strategy_id}/deallocate"
payload := strings.NewReader("{\n \"amount\": \"2.0\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("API-Key", "<api-key>")
req.Header.Add("API-Sign", "<api-key>")
req.Header.Add("API-Nonce", "<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.services.payward.com/v1/accounts/{account_id}/earn/bonded/strategies/{strategy_id}/deallocate")
.header("Idempotency-Key", "<idempotency-key>")
.header("API-Key", "<api-key>")
.header("API-Sign", "<api-key>")
.header("API-Nonce", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"2.0\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.services.payward.com/v1/accounts/{account_id}/earn/bonded/strategies/{strategy_id}/deallocate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["API-Key"] = '<api-key>'
request["API-Sign"] = '<api-key>'
request["API-Nonce"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"2.0\"\n}"
response = http.request(request)
puts response.read_bodyAuthorizations
Your public API key. Identifies the partner making the request.
HMAC signature over the request, computed with your private key.
Monotonically increasing nonce included in the request signature.
Headers
Client-generated canonical UUIDv4 that uniquely identifies a request for safe retries.
^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$Path Parameters
Globally unique public identifier for an account.
14 - 42Identifier of the bonded earn strategy to allocate to or deallocate from.
20^ES[A-Z2-7]{5}-[A-Z2-7]{5}-[A-Z2-7]{6}$Body
Request to deallocate funds from a bonded earn strategy.
Amount in the strategy's asset, as a decimal string.
1 - 64"2.0"
Response
The deallocation request was accepted and is pending.
Confirmation that an allocate or deallocate request was accepted.
Show child attributes
Show child attributes