curl --request POST \
--url https://api.sandbox.services.payward.com/v1/accounts/{account_id}/earn/bonded/strategies/{strategy_id}/allocate \
--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.sandbox.services.payward.com/v1/accounts/{account_id}/earn/bonded/strategies/{strategy_id}/allocate"
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.sandbox.services.payward.com/v1/accounts/{account_id}/earn/bonded/strategies/{strategy_id}/allocate', 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.sandbox.services.payward.com/v1/accounts/{account_id}/earn/bonded/strategies/{strategy_id}/allocate",
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.sandbox.services.payward.com/v1/accounts/{account_id}/earn/bonded/strategies/{strategy_id}/allocate"
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.sandbox.services.payward.com/v1/accounts/{account_id}/earn/bonded/strategies/{strategy_id}/allocate")
.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.sandbox.services.payward.com/v1/accounts/{account_id}/earn/bonded/strategies/{strategy_id}/allocate")
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_body{
"data": {
"request_id": "EBARERNY-PXH3CV-XQJL2O"
}
}Allocate to a Bonded Earn strategy
Submits a request to allocate funds from the specified account into the bonded earn strategy identified in the path.
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 allocation 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 allocating again. Reusing the key with a different strategy or amount, or for a deallocation instead of an allocation, 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, amount_too_high, idempotency_key_reused, and allocation_in_progress. An amount below the strategy’s minimum allocation (user_min_allocation in the strategy list) returns a generic bad_request. 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.
The account balance and the strategy cap are checked after the request is accepted. If the request fails then, the request status endpoint reports it in error.reason, as insufficient_balance, above_user_cap, 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.sandbox.services.payward.com/v1/accounts/{account_id}/earn/bonded/strategies/{strategy_id}/allocate \
--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.sandbox.services.payward.com/v1/accounts/{account_id}/earn/bonded/strategies/{strategy_id}/allocate"
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.sandbox.services.payward.com/v1/accounts/{account_id}/earn/bonded/strategies/{strategy_id}/allocate', 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.sandbox.services.payward.com/v1/accounts/{account_id}/earn/bonded/strategies/{strategy_id}/allocate",
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.sandbox.services.payward.com/v1/accounts/{account_id}/earn/bonded/strategies/{strategy_id}/allocate"
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.sandbox.services.payward.com/v1/accounts/{account_id}/earn/bonded/strategies/{strategy_id}/allocate")
.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.sandbox.services.payward.com/v1/accounts/{account_id}/earn/bonded/strategies/{strategy_id}/allocate")
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_body{
"data": {
"request_id": "EBARERNY-PXH3CV-XQJL2O"
}
}Authorizations
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}$"550e8400-e29b-41d4-a716-446655440000"
Path Parameters
Globally unique public identifier for an account.
14 - 42Identifier of the bonded earn strategy to allocate to or deallocate from. Identifier of the bonded earn strategy.
20^ES[A-Z2-7]{5}-[A-Z2-7]{5}-[A-Z2-7]{6}$"ESQEFMZ-JPPIY-3KXFJ2"
Body
Request to allocate funds into a bonded earn strategy.
Amount in the strategy's asset, as a decimal string.
1 - 64"2.0"
Response
The allocation request was accepted and is pending.
Confirmation that an allocate or deallocate request was accepted.
Show child attributes
Show child attributes