easyway
Sign inCreate free account

Crypto payouts API: send your balance to your own wallet

Payments collected through easyway stay on your balance until you withdraw them. You can do that by hand in the dashboard, or let your server do it with one API call. This post covers that call from the gateway's own code: what it costs, which addresses it can pay, how to follow it to the chain, what can go wrong, and a short Node.js script that settles once a day without ever paying twice.

One call: POST /v1/payouts

A withdrawal needs a key with the payouts:write scope and four fields: asset (a coin and network id such as USDT_TRC20), address, amount as a decimal string, and an optional note for your own records. Unknown fields are refused, so a typo fails loudly instead of being ignored. The answer is 201 with the payout: its id (po_…), status, amount, network_fee and, once it is on the chain, tx_hash.

In live mode the address must already be on your withdrawal whitelist, which you edit in the dashboard with a two-factor code. An API key cannot add to that list, so a leaked key can only move money to wallets you approved. For coins that use a memo or destination tag (TON, XRP), the memo also comes from the whitelist entry, never from the request.

The fee is added on top

Each coin has a flat withdrawal fee that pays for the network transaction, and a smallest amount. The fee is not taken out of the amount: the recipient gets exactly amount, and your balance goes down by amount plus fee. To empty a balance, send the available amount minus the fee. Some common ones, from the gateway's asset table:

Asset idNetworkWithdrawal feeSmallest withdrawal
USDT_TRC20TRON · TRC-201 USDT0.5 USDT
USDT_BEP20BNB Smart Chain · BEP-200.1 USDT0.5 USDT
USDT_POLYGONPolygon · PoS0.1 USDT0.5 USDT
USDT_TONTON · Jetton0.1 USDT0.5 USDT
USDT_SOLSolana · SPL0.3 USDT0.5 USDT
USDT_ERC20Ethereum · ERC-201.5 USDT0.5 USDT
USDC_ERC20Ethereum · ERC-201.5 USDC0.5 USDC
TRXTRON0.5 TRX1.5 TRX
ETHEthereum0.0001 ETH0.0002 ETH
BTCBitcoin0.00001 BTC0.00001 BTC

GET /v1/assets returns payout_fee, min_payout and decimals for every coin, so code never has to hard-code them; the pricing page lists them all.

From request to transaction

The moment the request succeeds, amount plus fee move from available to locked on your balance, so two requests can never spend the same money. Then the payout goes through these statuses:

StatusMeaning
pendingWaiting for the signing service. You can still cancel it in the dashboard.
processingBeing signed and broadcast.
sentOn the chain; tx_hash is set. A payout.sent webhook is sent.
failedNot sent; failure_reason says why. Amount and fee go back to available. A payout.failed webhook is sent.
cancelledCancelled while pending. Amount and fee go back to available.

Follow a payout with the webhooks or with GET /v1/payouts/:id; GET /v1/payouts lists them with status, asset and date filters for reconciliation. A very large withdrawal can stay pending until a person checks it, because the signing service has per-coin limits. In test mode (sk_test_… keys) any valid address is accepted and the payout is marked sent at once with a fake test_… hash, which is handy for building the flow (see the sandbox guide).

When it says no

StatusCodeWhat to do
400invalid_addressThe address is not valid for that coin's network. Fix it.
400below_minimum_payoutRaise the amount to at least min_payout.
400too_many_decimalsThe amount has more decimals than the coin. Round it down.
403address_not_whitelistedAdd the address in the dashboard (2FA), then retry.
403payouts_temporarily_lockedWithdrawals are frozen for a while, for example after 2FA was switched off. Wait or contact support.
422insufficient_fundsAvailable balance is below amount + fee.
422idempotency_key_reusedThis Idempotency-Key was already used with a different body.

The specific code is in the message field of the error body. None of these move money, so a request can be fixed and sent again. The general rules for retrying are in crypto payment API errors.

A daily settlement script

The safest pattern for automatic withdrawals is a key with only balances:read and payouts:write, one whitelisted wallet, and an Idempotency-Key built from the date. A retry after a timeout replays the first answer instead of paying again, and if the job runs twice on the same day after new payments came in, the different amount makes the gateway refuse the reused key, which the script reads as "already settled":

// settle.mjs: send today's USDT (TRC-20) balance to your own whitelisted wallet.
// Node 18+, no packages. Run once a day: EASYWAY_KEY=sk_live_... TO=T... node settle.mjs
const BASE = process.env.EASYWAY_BASE ?? "https://api.easyway.cash";
const KEY = process.env.EASYWAY_KEY; // scopes: balances:read, payouts:write
const TO = process.env.TO; // live mode: must already be on your dashboard whitelist
const ASSET = "USDT_TRC20";

async function api(method, path, body, idempotencyKey) {
  const res = await fetch(BASE + path, {
    method,
    headers: {
      Authorization: `Bearer ${KEY}`,
      ...(body && { "Content-Type": "application/json" }),
      ...(idempotencyKey && { "Idempotency-Key": idempotencyKey }),
    },
    body: body && JSON.stringify(body),
    signal: AbortSignal.timeout(15_000),
  });
  const data = await res.json().catch(() => ({}));
  if (!res.ok) throw Object.assign(new Error(`${res.status} ${data.message}`), { code: data.message });
  return data;
}

// Decimal strings <-> integer units, so 0.1 + 0.2 never happens.
const toUnits = (s, d) => { const [i, f = ""] = s.split("."); return BigInt(i + f.padEnd(d, "0").slice(0, d)); };
const fromUnits = (u, d) => { const s = u.toString().padStart(d + 1, "0"); return `${s.slice(0, -d)}.${s.slice(-d)}`; };

const asset = (await api("GET", "/v1/assets")).data.find((a) => a.id === ASSET);
const d = asset.decimals;
const bal = (await api("GET", "/v1/balances")).data.find((b) => b.asset === ASSET);
const available = toUnits(bal?.available ?? "0", d);
const amount = available - toUnits(asset.payout_fee, d); // the network fee is taken on top of the amount

if (amount < toUnits(asset.min_payout, d)) {
  console.log(`nothing to settle: ${bal?.available ?? 0} available`);
} else {
  const day = new Date().toISOString().slice(0, 10);
  try {
    const p = await api("POST", "/v1/payouts", { asset: ASSET, address: TO, amount: fromUnits(amount, d), note: `settlement ${day}` }, `settle-${ASSET}-${day}`);
    console.log(`payout ${p.id}: ${p.amount} + ${p.network_fee} fee, status ${p.status}`);
  } catch (err) {
    if (err.code === "idempotency_key_reused") console.log(`already settled ${day}`);
    else throw err; // address_not_whitelisted, insufficient_funds, payouts_temporarily_locked …
  }
}

We ran it on Node 22 against a local stand-in for these three routes: the first run created the payout, a second run the same day after a new deposit printed already settled, and a wallet that was not whitelisted stopped it with 403 address_not_whitelisted. Against the live API with a made-up key it stopped with 401 invalid_api_key. Run it from cron in test mode first, then switch the key.

Which jobs belong to the API and which stay in the dashboard is covered in API vs dashboard, and how withdrawals are protected on the security page and in who can move your balance.

Create free accountRead the API docsAlready have an account? Sign in
Crypto payouts API: withdraw to your own wallet | easyway