Skip to content

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

POST/api/v1/customers
API keycustomers:write Idempotency-Key required

A new customer wallet with a zero balance.

Body (JSON)
  • namestringoptional

    Up to 120 characters.

  • emailstringoptional

    Their email.

  • phonestringoptional

    Their phone number.

  • referencestringoptional

    Your own id for them, unique in the environment.

  • metadataobjectoptional

    Up to 20 string key-value pairs.

Request
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"
  }'
Response201 application/json
{
  "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"
  }
}
Errors

Plus the key and rate errors any keyed call can return.

List customers

GET/api/v1/customers
API keycustomers:read

Newest first, with their balances.

Query parameters
  • limitintegeroptional

    How many to return, 1 to 100. Default 20.

  • starting_afterstringoptional

    Cursor 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.

  • referencestringoptional

    Only this reference.

  • emailstringoptional

    Only this email.

Request
curl "https://api.autopayke.com/api/v1/customers" \
  -H "Authorization: Bearer $AUTOPAYKE_API_KEY"
Response200 application/json
{
  "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

GET/api/v1/customers/{id}
API keycustomers:read

One customer and their balance.

Path parameters
  • idstringrequired

    The customer id (cus_…).

Request
curl "https://api.autopayke.com/api/v1/customers/cus_6Tn3Qw8Lx2Zp7Vk4Rm9Yd5Hc" \
  -H "Authorization: Bearer $AUTOPAYKE_API_KEY"
Response200 application/json
{
  "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"
  }
}
Errors

Plus the key and rate errors any keyed call can return.

Update a customer

PATCH/api/v1/customers/{id}
API keycustomers:write

Change name, email, phone or metadata. The balance only changes through collections, payouts, transfers and adjustments.

Path parameters
  • idstringrequired

    The customer id (cus_…).

Body (JSON)
  • namestring | nulloptional

    New name.

  • emailstring | nulloptional

    New email.

  • phonestring | nulloptional

    New phone.

  • metadataobjectoptional

    Replaces the metadata.

Request
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"
  }'
Response200 application/json
{
  "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"
  }
}
Errors

Plus the key and rate errors any keyed call can return.

List balance transactions

GET/api/v1/customers/{id}/balance-transactions
API keycustomers:read

Every credit and debit on the wallet, newest first, with the balance after each.

Path parameters
  • idstringrequired

    The customer id (cus_…).

Query parameters
  • limitintegeroptional

    1 to 100, default 20.

  • beforestringoptional

    A transaction id: return older ones.

Request
curl "https://api.autopayke.com/api/v1/customers/cus_6Tn3Qw8Lx2Zp7Vk4Rm9Yd5Hc/balance-transactions" \
  -H "Authorization: Bearer $AUTOPAYKE_API_KEY"
Response200 application/json
{
  "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
  }
}
Errors

Plus the key and rate errors any keyed call can return.

Adjust a balance

POST/api/v1/customers/{id}/adjustments
API keycustomers:write Idempotency-Key required

Credit (positive) or debit (negative) a wallet by hand, with a reason. A debit can't take it below zero.

Path parameters
  • idstringrequired

    The customer id (cus_…).

Body (JSON)
  • amount_usdcstringrequired

    USDC as a decimal string, like "25" or "-3.50".

  • descriptionstringrequired

    Why, 3 to 200 characters.

Request
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"
  }'
Response201 application/json
{
  "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"
  }
}
Errors

Plus the key and rate errors any keyed call can return.

Transfer between customers

POST/api/v1/customer-transfers
API keycustomers:write Idempotency-Key required

Move balance from one customer to another in one step. No money leaves the workspace.

Body (JSON)
  • fromstringrequired

    The customer to take from (cus_…).

  • tostringrequired

    The customer to give to (cus_…).

  • amount_usdcstringrequired

    USDC as a decimal string, like "4.25".

  • descriptionstringoptional

    Why.

Request
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"
  }'
Response201 application/json
{
  "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"
  }
}
Errors

Plus the key and rate errors any keyed call can return.