Node.js
import { createHmac } from "node:crypto";
// Node.js 18+. Set credentials and resource values on your server.
function required(name) {
const value = process.env[name];
if (!value) throw new Error(`Set ${name} before running this example.`);
return value;
}
const baseUrl = process.env.LEDIG_API_BASE_URL ?? "https://api-sandbox.ledig.io";
const method = "POST";
const path = `/v1/recipients`;
const pathWithQuery = path;
// Choose the network returned by GET /v1/recipient-requirements/crypto-networks in this environment.
const body = {
"type": "crypto_address",
"fields": [
{
"name": "network",
"value": required("LEDIG_RECIPIENT_NETWORK")
},
{
"name": "address",
"value": required("LEDIG_RECIPIENT_ADDRESS")
},
{
"name": "accountName",
"value": required("LEDIG_RECIPIENT_ACCOUNT_NAME")
}
]
};
const rawBody = JSON.stringify(body);
const headers = { "Accept": "application/json" };
headers["Content-Type"] = "application/json";
const timestamp = Math.floor(Date.now() / 1000).toString();
const payload = `${timestamp}.${method}.${pathWithQuery}.${rawBody}`;
headers["x-ledig-key"] = required("LEDIG_API_KEY");
headers["x-ledig-timestamp"] = timestamp;
headers["x-ledig-signature"] = "v1=" + createHmac("sha256", required("LEDIG_API_SECRET"))
.update(payload).digest("base64");
const response = await fetch(`${baseUrl}${pathWithQuery}`, {
method,
headers,
body: rawBody,
});
const result = await response.json();
// Use result in your application; do not log credentials or upload links.
console.log(response.status);{
"status": "success",
"data": {
"id": "recipient_example_001",
"profileId": "profile_example_001",
"recipientRequirementId": "crypto_address",
"fields": {
"network": "ETHEREUM_SEPOLIA",
"address": "0x1111111111111111111111111111111111111111",
"accountName": "Example Treasury"
},
"destinationScope": {
"network": "ETHEREUM_SEPOLIA",
"assets": [
"USDC"
]
},
"is3rdParty": true,
"oneTime": false,
"deletedAt": null,
"active": true,
"object": "recipients",
"fieldsDetail": [
{
"name": "address",
"displayName": "Wallet address",
"value": "0x1111111111111111111111111111111111111111",
"required": true,
"visible": true,
"copyable": true
},
{
"name": "accountName",
"displayName": "Account Name",
"value": "Example Treasury",
"required": true,
"visible": true,
"copyable": true
}
],
"createdAt": "2026-01-15T10:00:00.000Z",
"updatedAt": "2026-01-15T10:00:00.000Z",
"reviewStatus": "pending",
"usableForPayout": true,
"payoutReadiness": "review_pending"
}
}{
"status": "error",
"code": "BAD_REQUEST",
"message": "Check the request fields and try again."
}{
"status": "error",
"code": "UNAUTHORIZED",
"message": "Authentication is required."
}{
"status": "error",
"code": "FORBIDDEN",
"message": "You do not have permission to perform this action."
}{
"status": "error",
"code": "RATE_LIMITED",
"message": "Too many requests. Wait before trying again."
}{
"status": "error",
"code": "PROVIDER_UNAVAILABLE",
"message": "This service is temporarily unavailable. Please try again later."
}Recipients
Add a payment recipient
Save a bank account, mobile money account or wallet for future payments.
POST
/
v1
/
recipients
Node.js
import { createHmac } from "node:crypto";
// Node.js 18+. Set credentials and resource values on your server.
function required(name) {
const value = process.env[name];
if (!value) throw new Error(`Set ${name} before running this example.`);
return value;
}
const baseUrl = process.env.LEDIG_API_BASE_URL ?? "https://api-sandbox.ledig.io";
const method = "POST";
const path = `/v1/recipients`;
const pathWithQuery = path;
// Choose the network returned by GET /v1/recipient-requirements/crypto-networks in this environment.
const body = {
"type": "crypto_address",
"fields": [
{
"name": "network",
"value": required("LEDIG_RECIPIENT_NETWORK")
},
{
"name": "address",
"value": required("LEDIG_RECIPIENT_ADDRESS")
},
{
"name": "accountName",
"value": required("LEDIG_RECIPIENT_ACCOUNT_NAME")
}
]
};
const rawBody = JSON.stringify(body);
const headers = { "Accept": "application/json" };
headers["Content-Type"] = "application/json";
const timestamp = Math.floor(Date.now() / 1000).toString();
const payload = `${timestamp}.${method}.${pathWithQuery}.${rawBody}`;
headers["x-ledig-key"] = required("LEDIG_API_KEY");
headers["x-ledig-timestamp"] = timestamp;
headers["x-ledig-signature"] = "v1=" + createHmac("sha256", required("LEDIG_API_SECRET"))
.update(payload).digest("base64");
const response = await fetch(`${baseUrl}${pathWithQuery}`, {
method,
headers,
body: rawBody,
});
const result = await response.json();
// Use result in your application; do not log credentials or upload links.
console.log(response.status);{
"status": "success",
"data": {
"id": "recipient_example_001",
"profileId": "profile_example_001",
"recipientRequirementId": "crypto_address",
"fields": {
"network": "ETHEREUM_SEPOLIA",
"address": "0x1111111111111111111111111111111111111111",
"accountName": "Example Treasury"
},
"destinationScope": {
"network": "ETHEREUM_SEPOLIA",
"assets": [
"USDC"
]
},
"is3rdParty": true,
"oneTime": false,
"deletedAt": null,
"active": true,
"object": "recipients",
"fieldsDetail": [
{
"name": "address",
"displayName": "Wallet address",
"value": "0x1111111111111111111111111111111111111111",
"required": true,
"visible": true,
"copyable": true
},
{
"name": "accountName",
"displayName": "Account Name",
"value": "Example Treasury",
"required": true,
"visible": true,
"copyable": true
}
],
"createdAt": "2026-01-15T10:00:00.000Z",
"updatedAt": "2026-01-15T10:00:00.000Z",
"reviewStatus": "pending",
"usableForPayout": true,
"payoutReadiness": "review_pending"
}
}{
"status": "error",
"code": "BAD_REQUEST",
"message": "Check the request fields and try again."
}{
"status": "error",
"code": "UNAUTHORIZED",
"message": "Authentication is required."
}{
"status": "error",
"code": "FORBIDDEN",
"message": "You do not have permission to perform this action."
}{
"status": "error",
"code": "RATE_LIMITED",
"message": "Too many requests. Wait before trying again."
}{
"status": "error",
"code": "PROVIDER_UNAVAILABLE",
"message": "This service is temporarily unavailable. Please try again later."
}Required scope:
recipient_manage
type identifies the destination’s requirements, and fields contains its details. A new recipient is pending until approved; some recipients may be approved automatically after all checks pass. Saving a recipient does not by itself approve it. For crypto_address or crypto, currency and country may be omitted; put network, address and accountName in fields. If supplied, currency must be supported on that network. Bank and mobile money recipients require currency and country. Discover crypto options through GET /v1/recipient-requirements/crypto-networks.Authorizations
Body
application/json