Customers (wallets)
Your own records of how your workspace balance is split between your customers. The money is your business's; AutoPayKe doesn't hold it for them.
Pass customer on POST /api/v1/collections to credit the wallet when it succeeds, and on POST /api/v1/payouts (or a batch line) to pay from it.
Balances are USDC strings with 6 decimals. A wallet never goes below zero; each change is a balance transaction.
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 customer
/api/v1/customerscustomers:write Idempotency-Key requiredA new customer wallet with a zero balance.
namestringoptionalUp to 120 characters.
emailstringoptionalTheir email.
phonestringoptionalTheir phone number.
referencestringoptionalYour own id for them, unique in the environment.
metadataobjectoptionalUp to 20 string key-value pairs.
curl -X POST "https://api.autopayke.com/api/v1/customers" \
-H "Authorization: Bearer $AUTOPAYKE_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"name": "Jane Wanjiku",
"reference": "rider-118",
"phone": "+254712345678"
}'{
"ok": true,
"data": {
"id": "cus_6Tn3Qw8Lx2Zp7Vk4Rm9Yd5Hc",
"object": "customer",
"livemode": false,
"name": "Jane Wanjiku",
"email": null,
"phone": "+254712345678",
"reference": "rider-118",
"metadata": {},
"balance_usdc": "0.000000",
"created": "2026-11-03T09:10:00.000Z",
"updated": "2026-11-03T09:10:00.000Z"
}
}Plus the key and rate errors any keyed call can return.
List customers
/api/v1/customerscustomers:readNewest first, with their balances.
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.
referencestringoptionalOnly this reference.
emailstringoptionalOnly this email.
curl "https://api.autopayke.com/api/v1/customers" \
-H "Authorization: Bearer $AUTOPAYKE_API_KEY"{
"ok": true,
"data": {
"object": "list",
"data": [
{
"id": "cus_6Tn3Qw8Lx2Zp7Vk4Rm9Yd5Hc",
"object": "customer",
"livemode": false,
"name": "Jane Wanjiku",
"email": null,
"phone": "+254712345678",
"reference": "rider-118",
"metadata": {},
"balance_usdc": "37.420000",
"created": "2026-11-03T09:10:00.000Z",
"updated": "2026-11-03T09:10:00.000Z"
}
],
"has_more": false
}
}Get a customer
/api/v1/customers/{id}customers:readOne customer and their balance.
idstringrequiredThe customer id (cus_…).
curl "https://api.autopayke.com/api/v1/customers/cus_6Tn3Qw8Lx2Zp7Vk4Rm9Yd5Hc" \
-H "Authorization: Bearer $AUTOPAYKE_API_KEY"{
"ok": true,
"data": {
"id": "cus_6Tn3Qw8Lx2Zp7Vk4Rm9Yd5Hc",
"object": "customer",
"livemode": false,
"name": "Jane Wanjiku",
"email": null,
"phone": "+254712345678",
"reference": "rider-118",
"metadata": {},
"balance_usdc": "37.420000",
"created": "2026-11-03T09:10:00.000Z",
"updated": "2026-11-03T09:10:00.000Z"
}
}Update a customer
/api/v1/customers/{id}customers:writeChange name, email, phone or metadata. The balance only changes through collections, payouts, transfers and adjustments.
idstringrequiredThe customer id (cus_…).
namestring | nulloptionalNew name.
emailstring | nulloptionalNew email.
phonestring | nulloptionalNew phone.
metadataobjectoptionalReplaces the metadata.
curl -X PATCH "https://api.autopayke.com/api/v1/customers/cus_6Tn3Qw8Lx2Zp7Vk4Rm9Yd5Hc" \
-H "Authorization: Bearer $AUTOPAYKE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"email": "jane@example.com"
}'{
"ok": true,
"data": {
"id": "cus_6Tn3Qw8Lx2Zp7Vk4Rm9Yd5Hc",
"object": "customer",
"livemode": false,
"name": "Jane Wanjiku",
"email": "jane@example.com",
"phone": "+254712345678",
"reference": "rider-118",
"metadata": {},
"balance_usdc": "37.420000",
"created": "2026-11-03T09:10:00.000Z",
"updated": "2026-11-03T09:10:00.000Z"
}
}List balance transactions
/api/v1/customers/{id}/balance-transactionscustomers:readEvery credit and debit on the wallet, newest first, with the balance after each.
idstringrequiredThe customer id (cus_…).
limitintegeroptional1 to 100, default 20.
beforestringoptionalA transaction id: return older ones.
curl "https://api.autopayke.com/api/v1/customers/cus_6Tn3Qw8Lx2Zp7Vk4Rm9Yd5Hc/balance-transactions" \
-H "Authorization: Bearer $AUTOPAYKE_API_KEY"{
"ok": true,
"data": {
"object": "list",
"data": [
{
"id": "4b2f8e10-6c3a-4d9e-8f21-0a7c5e3b9d64",
"object": "customer_balance_transaction",
"customer": "cus_6Tn3Qw8Lx2Zp7Vk4Rm9Yd5Hc",
"type": "collection",
"amount_usdc": "37.420000",
"balance_after_usdc": "37.420000",
"source": "col_7Rm2Xq9Lt4Wz8Kb3Np6Vd1Hs",
"description": "M-Pesa collection",
"created": "2026-11-03T09:10:00.000Z"
}
],
"has_more": false
}
}Adjust a balance
/api/v1/customers/{id}/adjustmentscustomers:write Idempotency-Key requiredCredit (positive) or debit (negative) a wallet by hand, with a reason. A debit can't take it below zero.
idstringrequiredThe customer id (cus_…).
amount_usdcstringrequiredUSDC as a decimal string, like "25" or "-3.50".
descriptionstringrequiredWhy, 3 to 200 characters.
curl -X POST "https://api.autopayke.com/api/v1/customers/cus_6Tn3Qw8Lx2Zp7Vk4Rm9Yd5Hc/adjustments" \
-H "Authorization: Bearer $AUTOPAYKE_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"amount_usdc": "25",
"description": "Bank deposit 14 Nov"
}'{
"ok": true,
"data": {
"id": "cus_6Tn3Qw8Lx2Zp7Vk4Rm9Yd5Hc",
"object": "customer",
"livemode": false,
"name": "Jane Wanjiku",
"email": null,
"phone": "+254712345678",
"reference": "rider-118",
"metadata": {},
"balance_usdc": "62.420000",
"created": "2026-11-03T09:10:00.000Z",
"updated": "2026-11-03T09:10:00.000Z"
}
}Plus the key and rate errors any keyed call can return.
Transfer between customers
/api/v1/customer-transferscustomers:write Idempotency-Key requiredMove balance from one customer to another in one step. No money leaves the workspace.
fromstringrequiredThe customer to take from (cus_…).
tostringrequiredThe customer to give to (cus_…).
amount_usdcstringrequiredUSDC as a decimal string, like "4.25".
descriptionstringoptionalWhy.
curl -X POST "https://api.autopayke.com/api/v1/customer-transfers" \
-H "Authorization: Bearer $AUTOPAYKE_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"from": "cus_6Tn3Qw8Lx2Zp7Vk4Rm9Yd5Hc",
"to": "cus_2Kd7Pw4Xn9Lt3Vb8Rq5Zm1Hc",
"amount_usdc": "4.25",
"description": "Shared delivery"
}'{
"ok": true,
"data": {
"id": "ctr_9Hq2Lm7Xt4Wz8Kb3Np6Vd1Rs",
"object": "customer_transfer",
"from": "cus_6Tn3Qw8Lx2Zp7Vk4Rm9Yd5Hc",
"to": "cus_2Kd7Pw4Xn9Lt3Vb8Rq5Zm1Hc",
"amount_usdc": "4.250000",
"description": "Shared delivery",
"created": "2026-11-03T09:10:00.000Z"
}
}Plus the key and rate errors any keyed call can return.