Step-by-step guides
Bulk payouts
Pay up to 500 recipients in one request: submit and validate, follow the batch, handle rejected rows and pending items, and know when it is finished.
What a bulk payout is
A bulk payout is a batch of up to 500 ordinary payouts submitted in one request. Each item goes through the same payout path as Initiate Transfer, so fees, limits, provider routing and webhooks are the same. The difference is that Moolre validates the whole batch, sends the items in the background, tracks each item, and tells you when the batch is finished.
Use it for payroll, commissions, supplier and marketplace payouts, and any run where you would otherwise loop over Initiate Transfer.
| Stage | What happens | What you do |
|---|---|---|
| Submit | Every row is validated at once; bad rows are listed in data.rejected, good rows are queued | Fix and resubmit the rejected rows in a new batch |
| Process | A worker runs every minute and sends each queued item as an ordinary payout | Wait; poll Bulk payout status if you like |
| Per item | queued, submitted, then succeeded, failed or pending. With webhooks on, each payout sends payout.succeeded or payout.failed | Update your own records per item |
| Complete | When every item is final the batch is completed and bulk_payout.completed is sent | Reconcile and report |
Before you start
- The private key, and your server IP on the disbursement whitelist.
- A wallet balance that covers the total plus fees (a low balance does not block the submit, but each payout is checked when it is sent).
- A unique externalref per item, unique on the wallet across all payouts and batches (case-insensitive).
- A unique batchref per batch (1 to 128 characters).
- A callback URL for bulk_payout.completed, or webhooks switched on (webhook 1 and webhook_url on the wallet) if you also want a result per payout.
Step by step: submit a batch
- Build the list of items. Each item needs externalref, receiver, channel (MTN, TELECEL, AT or BANK) and amount (a string with at most two decimals). BANK items also need sublistid. sendername and reference are optional.
- Choose the batchref, for example PAYROLL-2026-11. It identifies the batch for ever: store it with your payroll run.
- Decide on atomic. With atomic true, one bad row refuses the whole batch (BLK07) and nothing is queued, which is the safe choice for payroll. Without it, good rows are queued and bad rows are reported.
- Send Create bulk payout with an Idempotency-Key equal to the batchref.
- Read the reply. BLK01 means queued: data.accepted counts the queued rows, data.rejected lists each bad row with its index, a BLKR code, a message and the externalref, and data.total_amount is the sum of the accepted rows. balance_warning and balance appear when the wallet balance is below total_amount.
- Store data.batchid next to your batchref. Fix the rejected rows and send them in a new batch with a new batchref and new externalref values for the rows that need it.
curl https://api.moolre.com/open/transact/bulk \ -H "Content-Type: application/json" \ -H "X-API-USER: $MOOLRE_USER" \ -H "X-API-KEY: $MOOLRE_KEY" \ -H "Idempotency-Key: PAYROLL-2026-11" \ -d '{ "type": 1, "accountnumber": "1000000000001", "currency": "GHS", "batchref": "PAYROLL-2026-11", "atomic": true, "items": [ { "externalref": "PAY-1", "receiver": "0240000001", "channel": "MTN", "amount": "100.00" }, { "externalref": "PAY-2", "receiver": "0240000002", "channel": "TELECEL", "amount": "50.00", "sendername": "Acme" }, { "externalref": "PAY-3", "receiver": "0000012345", "channel": "BANK", "amount": "300.00", "sublistid": "030100" } ] }'Step by step: follow the batch
- Wait for bulk_payout.completed. The callback carries the batch summary: counts, succeeded_amount, failed_amount and unresolved. The webhook carries the same summary in data.batch and lists every payout.
- Meanwhile (or if you prefer polling) call Bulk payout status with the batchid or batchref. status is queued, processing or completed.
- Read data.hooks: each entry is the status check of one payout (txstatus 1 paid, 2 failed, 0 not final yet). Ask for the next page with page until you reach data.pages, set how many you want with limit, and filter with status to see only failed or pending payouts.
- For each paid payout store transactionid, thirdpartyref and receivername. For each failed one read itemcode and itemmessage.
- When the batch status is completed, check unresolved. If it is true, some items were still pending after 72 hours: look each one up by externalref with Transfer Status. Do not assume they failed.
curl https://api.moolre.com/open/transact/bulk_status \ -H "Content-Type: application/json" \ -H "X-API-USER: $MOOLRE_USER" \ -H "X-API-KEY: $MOOLRE_KEY" \ -d '{ "accountnumber": "1000000000001", "batchref": "PAYROLL-2026-11", "status": "failed", "page": 1, "limit": 100 }'Payout states and what to do
The state of each payout is in hook.data.state.
| state | Meaning | What to do |
|---|---|---|
| queued | Waiting to be sent. May return here for an automatic retry when the network was unavailable and nothing was charged | Wait |
| submitted | Being sent | Wait |
| pending | The provider has not confirmed yet (itemcode BLK30) | Do not resend. Check by externalref or wait for the webhook |
| succeeded | Paid; transactionid, thirdpartyref and receivername filled | Record it |
| failed | Not paid; itemcode and itemmessage explain why | A failed externalref cannot be reused. Send the item again in a new batch with a new externalref |
Rejected rows (BLKR codes)
Each rejected row has an index (its position in the items you sent, starting at 0), a code, a message and the externalref.
| Code | Meaning | Fix |
|---|---|---|
| BLKR01 | externalref missing | Give every item an externalref |
| BLKR02 | externalref longer than 128 characters or has control characters | Shorten it |
| BLKR03 | externalref repeated inside the batch (case-insensitive) | Make each item unique |
| BLKR04 | externalref already used on this wallet (a payout or another batch) | Use a new externalref, or check the earlier payout |
| BLKR05 | receiver missing or malformed for the channel | MTN, TELECEL, AT: 9 to 15 digits. BANK: 6 to 24 digits |
| BLKR06 | Unknown channel | Use MTN, TELECEL, AT or BANK |
| BLKR07 | amount missing, not a decimal, more than 2 decimals or below 0.01 | Send a string such as 25.00 |
| BLKR08 | amount above the per-payout maximum (GHS 200000.00) | Split the amount |
| BLKR09 | sublistid missing for BANK | Send the bank code from Get banks |
| BLKR10 | sendername invalid | 1 to 40 characters: letters, digits, space, full stop, apostrophe, hyphen |
| BLKR11 | reference invalid | At most 64 printable characters |
| BLKR12 | Item is not an object | Send each item as a JSON object |
| BLKR13 | Channel not available for NGN | NGN wallets use BANK only |
| BLKR14 | The GHQR channel is no longer supported. | GhQR (channel GHQR or 13) was removed on 4 Dec 2026. Use MTN, TELECEL, AT or BANK |
Retrying a submit safely
- If the submit times out, send it again unchanged, with the same batchref, the same items and the same Idempotency-Key.
- Moolre returns the original batch with code BLK02 and data.replayed true (meta.replayed is true too when the Idempotency-Key matched). Nothing is queued twice.
- If you send the same batchref with different items, you get BLK09. Use a new batchref for a new batch.
- If you get BLK15 (20 batches are still active on the wallet), wait for some to complete.
The externalref is the real guard
Every item is a payout with its own externalref, and the wallet-wide unique rule stays in force. Even a mistake in your own code cannot pay the same externalref twice.
The completion callback and webhook
The callback is sent once, to the batch callback if you gave one (an HTTPS URL of up to 512 characters) or else to the wallet callback URL. Verify the signature and dedupe on event_id. The summary is at the top level of the body.
On a wallet with webhooks on, the bulk_payout.completed webhook (code BLK40) goes to webhook_url: data.batch is the summary and data.hooks lists every payout, up to 100 to a page. Each payout also has its own payout.succeeded or payout.failed.
{ "batchid": "bat_3f9c2a1d7e5b4c60", "batchref": "PAYROLL-2026-11", "accountnumber": "1000000000001", "currency": "GHS", "status": "completed", "unresolved": false, "total_amount": "450.00", "counts": { "total": 3, "queued": 0, "submitted": 0, "pending": 0, "succeeded": 2, "failed": 1 }, "succeeded_amount": "150.00", "failed_amount": "300.00", "completed": "2026-11-15T09:20:00Z", "event_id": "evt_0123456789abcdef01234567", "event": "bulk_payout.completed", "created": "2026-11-15T09:20:00Z", "meta": { "notices": [] }}Batch-level errors and fixes
| Code | Meaning | Fix |
|---|---|---|
| BLK03 | type is not 1 | Send type 1 |
| BLK04 | accountnumber or batchref missing or invalid | Send both; batchref 1 to 128 characters |
| BLK05, BLK06 | items missing, empty, not a list, or more than 500 | Send 1 to 500 items; split larger runs into several batches |
| BLK07 | atomic was set and some rows were rejected; nothing queued | Fix the rows in data.rejected and resubmit |
| BLK08 | No valid items | Fix the rows and resubmit |
| BLK09 | batchref reused with different items | Use a new batchref |
| BLK10, BLK13 | Currency invalid, or different from the wallet currency | Send the wallet currency |
| BLK11, BLK12 | Account not found, or wallet inactive | Check accountnumber and that the wallet is active |
| BLK14 | callback is not an HTTPS URL | Use https and at most 512 characters |
| BLK15 | 20 batches already active | Wait for some to complete |
| BLK18 | A public key was used | Use the private key |
| TK01 | IP not whitelisted | Add the server IP in the app |
Checklist
- Batch and item references are unique, stored before the submit, and derived from your own payroll or payout run.
- You use atomic for runs that must be all-or-nothing, and an Idempotency-Key equal to the batchref.
- You handle data.rejected and keep a record of every rejected row.
- You update your records per item from webhooks or Bulk payout status, not from the submit reply.
- You treat pending items as unknown and never resend them.
- You fund the wallet before the batch starts and watch balance_warning.
- You reconcile the batch total with succeeded_amount and the account statement.
