PayRamHost hosted onboarding is paused · Guides keep updatingGet notified when it reopens →

Docs / Payouts API

Starting payouts through the API: idempotency keys, limits and error handling

A payout is real money, so every detail of the endpoint is worth reading: amounts are in coin units, always send an idempotency key, do not retry 4xx errors, and approval can only be done in the dashboard.

Last updated · By the PayRamHost editors · Markdown version

PayRamHost hosted merchant onboarding has been paused since 29 November 2026. Where this guide mentions PayRamHost, it describes the situation before the pause; the PayRam usage it explains still applies.

The short version: call POST /api/v1/withdrawal/merchant with a project API key to start a payout from your own code: a refund, a payment to a supplier, a commission and so on. Remember four things: the amount is in coin units, not US dollars; always send an idempotency key; payouts over a limit are held for approval, and approval can only be done in the dashboard; and do not retry 4xx errors, but do retry 5xx errors with the same idempotency key.

1. Before you start

  • A hot wallet: the project must have a hot wallet assigned for the payout’s network, otherwise the request fails with 422 PAYOUT_HOT_WALLET_NOT_ASSIGNED (PayRam Core 3.9.0 and later). The hot wallet also needs enough of the coin and enough gas; see wallet roles.
  • A project API key: generate one under “Project → API Keys” in the dashboard and send it in the API-Key header. Member-level keys and dashboard logins are rejected with 401. Every request belongs to the project of the key it uses.
  • Version requirements: according to the official documentation, the payout endpoints need PayRam 3.1.1 or later, idempotency keys need 3.6.0 or later, and some behaviours are marked 3.9.0 or later. PayRamHost runs a version above these.
  • Bitcoin payouts are not supported: such a request is refused with 400 PAYOUT_CURRENCY_DISABLED.

The official documentation lists these payout networks and coins. PayRamHost currently offers Ethereum, Base and Polygon, with Tron planned.

NetworkblockchainCodeNative coinTokens
EthereumETHETHUSDC, USDT, PYUSD, CBBTC
BaseBASEETHUSDC, CBBTC
PolygonPOLYGONPOLUSDC, USDT
TronTRXTRXUSDT
Bitcoin——Payouts not supported

2. The request

The endpoint is POST {BASE_URL}/api/v1/withdrawal/merchant. BASE_URL is the address you open the dashboard with; the API and the dashboard share one address.

HeaderRequiredNotes
API-KeyYesYour project API key
Content-TypeYesapplication/json
Idempotency-KeyNo, but strongly recommendedUp to 255 characters, for example payout-00417; see below
Body fieldRequiredNotes
emailYesThe recipient’s email; must be a valid email address
blockchainCodeYesETH, BASE, POLYGON or TRX
currencyCodeYesThe token or native coin, for example USDC, USDT, ETH, POL, TRX
amountYesA string, in coin units, not USD, for example "100" USDC or "0.05" ETH
toAddressYesThe recipient wallet; must be valid for the chosen network
customerIDYesYour own identifier for the recipient; a payout cannot be created without it
mobileNumber, residentialAddressNoThe recipient’s mobile number and address
idempotencyKeyNoSame as the Idempotency-Key header; the header wins if both are sent
curl --location '${BASE_URL}/api/v1/withdrawal/merchant' \
--header 'API-Key: <API_KEY>' \
--header 'Idempotency-Key: payout-00417' \
--header 'Content-Type: application/json' \
--data-raw '{
  "email": "test@test.com",
  "blockchainCode": "ETH",
  "currencyCode": "USDC",
  "amount": "100",
  "toAddress": "0x291b68732f14F47Fd21bE81ec5Cf1bcfC0DB14Ea",
  "customerID": "414817384"
}'

A successful call returns 201 Created with the payout record. Store its id, because you need it to look the payout up later. The key fields are status (pending or pending-approval), txHash (empty until the payout is sent), createdBy (user for an API payout) and attributes. When a payout is held, attributes is a JSON-encoded string that you have to parse before you can read approvalReason.

3. The amount: converting dollars to coins

  • amount is in the token’s own units. To pay a US-dollar value, convert it yourself first.
  • PayRam truncates the amount to the token’s precision (walletPrecision): it never rounds up and never rejects extra decimals, and an amount that truncates to zero is rejected. So round it yourself first, so your records match what is actually sent.

Use the public endpoint GET {BASE_URL}/api/v1/ticker (no API key needed). For each network and coin it returns a price (the USD price of one unit; stablecoins are "1.0") and the walletPrecision. The formula:

amount = usdAmount / price, rounded down to walletPrecision decimal places

The official example: 50 dollars in ETH at a price of 1659.57 gives about 0.030128…. Prices are live, so fetch the ticker again right before you create the payout. Use a decimal library to avoid floating-point error:

import Decimal from 'decimal.js';

const amount = new Decimal(usd)
  .div(price)
  .toDecimalPlaces(walletPrecision, Decimal.ROUND_DOWN)
  .toFixed(); // a string, never scientific notation

More on the price endpoint is in the ticker and currency API.

4. Limits and approval

When a payout is created PayRam checks it against the project’s limits and decides whether to send it, hold it for approval or reject it. Limits are measured in US dollars over rolling windows (the last 60 minutes and the last 24 hours) and count what the same account has paid out in the project; for API payouts that is the account the API key belongs to. Payouts held for approval count toward the totals, while failed, rejected and cancelled ones do not.

SituationResult
Within limits201, status: "pending", queued to send
Over the auto-approve amount, or over a limit201, status: "pending-approval", with approvalReason in attributes
Below the minimum400 PAYOUT_AMOUNT_BELOW_MINIMUM, no payout is created

approvalReason is one of above_auto_approve, auto_approve_disabled, manual_only, daily_limit_exceeded, hourly_limit_exceeded or limit_check_failed.

Limits are set in the dashboard under “Settings → Projects → your project → Payout Limits”. Do not hard-code them. A held payout can only be approved in the dashboard, not through the API; approval needs an emailed code. See refunds and payouts and team members and roles.

5. Idempotency keys: preventing duplicate payouts

The official documentation’s rule is: always send an idempotency key. Without one PayRam cannot tell a retry after a timeout from a deliberate second payout, and a payout is real money, so a duplicate is a duplicate transfer.

  • Generate one key per payout before the first attempt and store it with the payout. The ID of your own payout record or order works; a timestamp does not, because it changes on a retry.
  • Retrying with the same key returns the original payout with status 201 and the response header Idempotent-Replayed: true (PayRam Core 3.9.0 and later). Keys are per project and do not expire.
  • A reused key with a different body still returns the original payout, so never reuse a key for a different payout.
  • Without a key, an identical payout (same project, address, coin, network and amount) submitted again within 5 minutes is refused with 409 PAYOUT_DUPLICATE_REQUEST.

The consequence: if a payout fails and you want to try again, you must use a new key, otherwise you just get the failed payout back. Put the attempt number in the key, or create a fresh payout record for each new attempt.

6. Error codes and the retry rule

Most errors have this shape:

{"error": {"code": "PAYOUT_DUPLICATE_REQUEST", "message": "...", "details": "..."}}

Only an error worth retrying carries "retryable": true. A body that fails validation (a missing field, an invalid email) returns 400 in a different shape, with fields naming the problem field. Malformed JSON (including a non-numeric amount) returns 400 with "error": "Invalid JSON".

HTTPcodeWhen
400BAD_REQUESTThe amount is zero, negative, too large or below the token’s smallest unit; the address is invalid for the network; the network or token code is unknown; customerID is missing; Idempotency-Key is over 255 characters
400PAYOUT_CURRENCY_DISABLEDPayouts are turned off for this token, or it is Bitcoin
400PAYOUT_AMOUNT_BELOW_MINIMUMThe amount is below the project minimum
401UNAUTHORIZEDAPI-Key is missing or invalid, or is not a project key
403INSUFFICIENT_PERMISSIONSThe key lacks payout permission
404NOT_FOUNDThis network and token pair is not configured on the server
409PAYOUT_DUPLICATE_REQUESTAn identical payout within 5 minutes and no idempotency key
422PAYOUT_HOT_WALLET_NOT_ASSIGNEDNo hot wallet is assigned to the project for this network
503EXCHANGE_RATE_UNAVAILABLEThere is no live price for a non-stablecoin right now; retryable, with Retry-After: 30
500INTERNAL_SERVER_ERRORAnything else

The retry rule: treat every 4xx as permanent, fix the request and do not retry it. Retry 5xx errors (including EXCHANGE_RATE_UNAVAILABLE), and always with the same idempotency key.

7. A Node.js example

const BASE_URL = process.env.PAYRAM_BASE_URL; // the address of your merchant dashboard
const API_KEY = process.env.PAYRAM_API_KEY;   // project API key, server side only

async function createPayout(payout) {
  const res = await fetch(`${BASE_URL}/api/v1/withdrawal/merchant`, {
    method: 'POST',
    headers: {
      'API-Key': API_KEY,
      'Content-Type': 'application/json',
      // the ID of your own payout record; keep it the same on retries
      'Idempotency-Key': `payout-${payout.id}`,
    },
    body: JSON.stringify({
      email: payout.recipientEmail,
      blockchainCode: 'BASE',
      currencyCode: 'USDC',
      amount: payout.amount,           // a string, in coin units
      toAddress: payout.toAddress,     // an address the recipient confirmed in writing
      customerID: String(payout.customerId),
    }),
  });

  const body = await res.json();
  if (res.ok) return body; // 201: pending or pending-approval, store body.id

  const err = new Error(body?.error?.message || `HTTP ${res.status}`);
  err.retryable = res.status >= 500; // retry 5xx with the same key; fix 4xx first
  throw err;
}

8. Querying and tracking

Method and pathPurpose
GET /api/v1/withdrawal/{id}/merchantGet one payout; works for both API and dashboard payouts
GET /api/v1/withdrawal/merchantList payouts; API payouts only
GET /api/v1/tickerLive USD prices; public, no key needed

The official recommendation is to track payouts with webhooks instead of polling; see payout webhooks explained. What each status means, from pending-approval to sent, is covered in refunds and payouts. sent means confirmed on-chain: the money has left, so treat it as success.

9. Safety recommendations

These are our recommendations, not official requirements:

  • Keep the key on the server. The payout endpoint moves money. Never put the API key in front-end code, in screenshots or in prompts sent to an AI assistant.
  • Know where addresses come from. A destination address should come from information the customer confirmed in writing. Do not build addresses in code or accept ones of unclear origin automatically.
  • Start with tight limits. For the first few weeks, turn auto-approve off or set the auto-approve amount low so that larger payouts go through a person, then loosen it once the flow has proven itself.
  • Separate creating from approving. The program or person that creates payouts should not be the one that approves them.
  • Watch the hot wallet. Payouts are sent from it, and a low balance makes them fail. Turn on balance alerts in the dashboard.

10. FAQ

Can I approve a held payout through the API?

No. A pending-approval payout can only be approved or rejected in the dashboard.

Who pays the gas on a payout?

The hot wallet pays it, which means the merchant bears it.

What is the difference between an API payout and a dashboard payout?

The official documentation separates payouts into two kinds: API payouts (createdBy is user) and dashboard payouts (createdBy is system). Both send webhooks and both can be read with the single-payout endpoint; the list endpoint contains API payouts only. An API payout that is held for approval is approved on the dashboard’s payouts page (Withdraw → Payouts).

Can I use this for refunds?

Yes, a refund is a payout. What to check before a refund (address, network, the risk of sending back the way it came) is in refunds and payouts.

  • Payout webhooks: How to receive PayRam payout webhooks: seven event types, notification fields, signature verification, the payout.ping sent before each delivery, only three attempts and no redelivery, and reconciling missed notifications with the query endpoint.
  • Refunds and payouts: On-chain payments have no chargeback, so refunds are manual. How PayRam payouts work: address book, approvals and one-time codes, limits, status meanings, and what to check before you refund.
  • Ticker and currency API: PayRam's two helper endpoints: the public /api/v1/ticker returns supported coins with live US-dollar prices, and /api/v1/blockchain-currency returns the payment options available for one payment. Field meanings, the formula for estimating the amount due and usage advice.
  • Team and roles: How to invite team members to the PayRam dashboard and limit them by role: what Admin, Project Lead, Project Manager, Project Ops and Platform Referral Admin can each do, who can approve payouts, and how to manage API keys.

Sources

This guide is based on the PayRam official documentation below, checked on 2026-11-09. PayRamHost is an independently operated service and is not affiliated with PayRam. If anything differs, the official documentation prevails.