Bulk payouts
Pay up to 500 people in one request, checked upfront, with optional approval by a second person.
A batch pays many people in one request: riders at the end of the week, farmers after a harvest, casual staff on payday. Up to 500 payouts per batch. Endpoint details are in the Batches reference.
Sending a batch
curl https://api.autopayke.com/api/v1/batches \
-H "Authorization: Bearer $AUTOPAYKE_API_KEY" \
-H "Idempotency-Key: riders-week-46" \
-H "Content-Type: application/json" \
-d '{
"reference": "riders-week-46",
"require_approval": true,
"payouts": [
{ "amount": 150000, "currency": "KES", "reference": "rider-118",
"destination": { "type": "mobile_money", "phone": "+254712345678" } },
{ "amount": 200000, "currency": "KES", "reference": "rider-207",
"destination": { "type": "mobile_money", "phone": "+254722334455" } }
]
}'Each line has the same shape as a single payout. Use your own id as each line's reference so you can match payouts back to people.
All or nothing upfront
Before any money moves, we check every line (amount, destination, your per-payout limit), the batch total against today's and this month's limits, and your balance against the total with fees. If anything fails, nothing is paid and you get every problem at once:
{
"ok": false,
"code": "VALIDATION_ERROR",
"error": "2 of 120 payouts can't be sent. Nothing was paid; fix them and send the batch again.",
"details": {
"lines": [
{ "index": 14, "code": "VALIDATION_ERROR", "message": "Enter a valid Kenyan mobile number" },
{ "index": 87, "code": "LIMIT_PER_TX_EXCEEDED", "message": "The most one payout can be is KES 150,000." }
]
}
}Approval by a second person
Every live batch waits as awaiting_approval until a workspace owner or admin approves it in the Console with their PIN. The API key that sent it can't approve it, so a leaked key alone can't pay out a batch. In the sandbox, batches start at once unless you send require_approval: true.
POST /api/v1/batches/{id}/cancel. Lines not yet sent are cancelled; payouts already created carry on.Following it
batch.processingwhen paying starts (straight away, or on approval).- Each line becomes a payout with
batch_idandbatch_indexin its metadata, and sends the usualpayout.*webhooks. batch.completedwhen every line has a payout or has failed. Checkcounts, andGET /api/v1/batches/{id}/itemsfor each line.
failed with a failure_code; send it again in a new batch.Testing
Fund the sandbox with POST /api/v1/sandbox/faucet, then send a batch with an apk_test_ key. Each line follows the sandbox payout numbers, so you can mix lines that succeed and fail.