Batches (bulk payouts)
Send up to 500 payouts in one request. The whole batch is checked before any money moves, and can wait for a second person to approve it.
Every line is checked first: amount, destination, your per-payout, daily and monthly limits, and your balance against the total with fees. If any line fails, nothing is paid and details.lines says which.
Each line becomes an ordinary payout (po_…) with batch_id and batch_index in its metadata, so it gets the same payout.* webhooks.
Statuses: awaiting_approval, processing, completed, cancelled.
Send your API key as Authorization: Bearer apk_test_… (sandbox) or apk_live_… (live). Each endpoint lists the scope the key needs. See API keys.
Create a batch
/api/v1/batchesbatches:write Idempotency-Key requiredChecks every line, then queues them. With require_approval it waits for a workspace owner or admin to approve it in the Console.
payoutsarrayrequired1 to 500 payouts, each shaped like the body of POST /api/v1/payouts: amount, currency, destination, reference?, description?, metadata?.
require_approvalbooleanoptionalTest keys: wait for approval in the Console before paying (default false). Live batches always wait for approval.
referencestringoptionalYour own id for the batch, up to 64 characters.
descriptionstringoptionalUp to 140 characters.
metadataobjectoptionalUp to 20 string key-value pairs, copied onto every payout.
curl -X POST "https://api.autopayke.com/api/v1/batches" \
-H "Authorization: Bearer $AUTOPAYKE_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"reference": "riders-week-46",
"description": "Rider pay, week 46",
"payouts": [
{
"amount": 150000,
"currency": "KES",
"destination": {
"type": "mobile_money",
"phone": "+254712345678"
},
"reference": "rider-118"
},
{
"amount": 200000,
"currency": "KES",
"destination": {
"type": "mobile_money",
"phone": "+254722334455"
},
"reference": "rider-207"
},
{
"amount": 100000,
"currency": "KES",
"destination": {
"type": "till",
"till_number": "5123456"
},
"reference": "fuel-stage-3"
}
]
}'{
"ok": true,
"data": {
"id": "bat_6Tn3Qw8Lx2Zp7Vk4Rm9Yd5Hc",
"object": "batch",
"livemode": false,
"status": "processing",
"reference": "riders-week-46",
"description": "Rider pay, week 46",
"metadata": {},
"item_count": 3,
"total_amount": 450000,
"currency": "KES",
"counts": {
"queued": 3,
"created": 0,
"failed": 0,
"cancelled": 0
},
"approved_at": null,
"completed_at": null,
"cancelled_at": null,
"created": "2026-11-03T09:10:00.000Z",
"updated": "2026-11-03T09:10:00.000Z"
}
}IDEMPOTENCY_KEY_REQUIREDIDEMPOTENCY_KEY_REUSEDVALIDATION_ERRORINSUFFICIENT_BALANCELIMIT_DAILY_EXCEEDEDLIMIT_MONTHLY_EXCEEDEDCAPABILITY_PAUSEDPlus the key and rate errors any keyed call can return.
List batches
/api/v1/batchesbatches:readNewest first, in the key's environment.
limitintegeroptionalHow many to return, 1 to 100. Default 20.
starting_afterstringoptionalCursor for the next page: the id of the last item you got. Lists are newest first; when has_more is true, pass the last id here.
statusstringoptionalOnly batches in this status.
awaiting_approvalprocessingcompletedcancelled
curl "https://api.autopayke.com/api/v1/batches" \
-H "Authorization: Bearer $AUTOPAYKE_API_KEY"{
"ok": true,
"data": {
"object": "list",
"data": [
{
"id": "bat_6Tn3Qw8Lx2Zp7Vk4Rm9Yd5Hc",
"object": "batch",
"livemode": false,
"status": "processing",
"reference": "riders-week-46",
"description": "Rider pay, week 46",
"metadata": {},
"item_count": 3,
"total_amount": 450000,
"currency": "KES",
"counts": {
"queued": 3,
"created": 0,
"failed": 0,
"cancelled": 0
},
"approved_at": null,
"completed_at": null,
"cancelled_at": null,
"created": "2026-11-03T09:10:00.000Z",
"updated": "2026-11-03T09:10:00.000Z"
}
],
"has_more": false
}
}Get a batch
/api/v1/batches/{id}batches:readOne batch with counts of queued, created, failed and cancelled lines.
idstringrequiredThe batch id (bat_…).
curl "https://api.autopayke.com/api/v1/batches/bat_6Tn3Qw8Lx2Zp7Vk4Rm9Yd5Hc" \
-H "Authorization: Bearer $AUTOPAYKE_API_KEY"{
"ok": true,
"data": {
"id": "bat_6Tn3Qw8Lx2Zp7Vk4Rm9Yd5Hc",
"object": "batch",
"livemode": false,
"status": "completed",
"reference": "riders-week-46",
"description": "Rider pay, week 46",
"metadata": {},
"item_count": 3,
"total_amount": 450000,
"currency": "KES",
"counts": {
"queued": 0,
"created": 3,
"failed": 0,
"cancelled": 0
},
"approved_at": null,
"completed_at": "2026-11-03T09:10:00.000Z",
"cancelled_at": null,
"created": "2026-11-03T09:10:00.000Z",
"updated": "2026-11-03T09:10:00.000Z"
}
}List a batch's lines
/api/v1/batches/{id}/itemsbatches:readLines in the order you sent them, each with its payout id once created. Phone and account numbers are masked.
idstringrequiredThe batch id (bat_…).
limitintegeroptional1 to 100, default 50.
offsetintegeroptionalLines to skip, default 0.
curl "https://api.autopayke.com/api/v1/batches/bat_6Tn3Qw8Lx2Zp7Vk4Rm9Yd5Hc/items" \
-H "Authorization: Bearer $AUTOPAYKE_API_KEY"{
"ok": true,
"data": {
"object": "list",
"data": [
{
"object": "batch_item",
"index": 0,
"status": "created",
"amount": 150000,
"destination": {
"type": "mobile_money",
"phone": "+2547•••••678",
"network": "safaricom"
},
"reference": "rider-118",
"payout": "po_8Fq2mZx7Lk3Rt9Vb",
"failure_code": null,
"failure_message": null
}
],
"has_more": true
}
}Cancel a batch
/api/v1/batches/{id}/cancelbatches:writeStops lines not yet sent. Payouts already created carry on.
idstringrequiredThe batch id (bat_…).
curl -X POST "https://api.autopayke.com/api/v1/batches/bat_6Tn3Qw8Lx2Zp7Vk4Rm9Yd5Hc/cancel" \
-H "Authorization: Bearer $AUTOPAYKE_API_KEY"{
"ok": true,
"data": {
"id": "bat_6Tn3Qw8Lx2Zp7Vk4Rm9Yd5Hc",
"object": "batch",
"livemode": false,
"status": "cancelled",
"reference": "riders-week-46",
"description": "Rider pay, week 46",
"metadata": {},
"item_count": 3,
"total_amount": 450000,
"currency": "KES",
"counts": {
"queued": 0,
"created": 0,
"failed": 0,
"cancelled": 3
},
"approved_at": null,
"completed_at": null,
"cancelled_at": "2026-11-03T09:10:00.000Z",
"created": "2026-11-03T09:10:00.000Z",
"updated": "2026-11-03T09:10:00.000Z"
}
}