API reference
Customers
Create, list, and update the people who subscribe.
A customer is someone who pays you. You create a customer, then start a subscription for them.
The customer object
Attributes
idstringUnique identifier for the customer.app_idstringThe app the customer belongs to.namestringnullableThe customer's name.phone_numberstringThe customer's phone number. Mobile money payment requests go to this number.emailstringThe customer's email address. Abuna emails the customer's notices here.created_attimestampWhen the customer was created, in Unix seconds.
{
"id": "01J9ZQ6A1B2C3D4E5F6G7H8J9K",
"app_id": "01J9ZQ4Y7R3T6V8W2X5B1C0DEF",
"name": "Jane Doe",
"phone_number": "+237671234567",
"email": "jane@example.com",
"created_at": 1727600000
}Create a customer
POST/v1/apps/{appID}/customers
Creates a customer.
Parameters
emailstringrequiredThe customer's email address.phone_numberstringrequiredThe customer's phone number, with its country code, like+237671234567.namestringThe customer's name.
Returns the customer with status 201. A missing email or phone number returns 422 with code invalid. An unknown field returns 400 with code invalid_json.
curl https://api.abuna.app/v1/apps/01J9ZQ4Y7R3T6V8W2X5B1C0DEF/customers \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-d '{"name": "Jane Doe", "email": "jane@example.com", "phone_number": "+237671234567"}'{
"id": "01J9ZQ6A1B2C3D4E5F6G7H8J9K",
"app_id": "01J9ZQ4Y7R3T6V8W2X5B1C0DEF",
"name": "Jane Doe",
"phone_number": "+237671234567",
"email": "jane@example.com",
"created_at": 1727600000
}List customers
GET/v1/apps/{appID}/customers
Lists the app's customers, newest first. Each one has two more fields than the customer object.
Query parameters
searchstringReturns only customers whose name or email contains this text. Case doesn't matter.
Extra attributes
telegram_connectedbooleanWhether the customer gets their notices on Telegram too.active_subscriptionsintegerHow many of the customer's subscriptions areactive.
Returns an array. It isn't paginated.
curl 'https://api.abuna.app/v1/apps/01J9ZQ4Y7R3T6V8W2X5B1C0DEF/customers?search=jane' \
-H "Authorization: Bearer sk_test_..."[
{
"id": "01J9ZQ6A1B2C3D4E5F6G7H8J9K",
"app_id": "01J9ZQ4Y7R3T6V8W2X5B1C0DEF",
"name": "Jane Doe",
"phone_number": "+237671234567",
"email": "jane@example.com",
"created_at": 1727600000,
"telegram_connected": false,
"active_subscriptions": 1
}
]Update a customer
PATCH/v1/apps/{appID}/customers/{id}
Updates the fields you send and leaves the rest as they are. If anything changed, Abuna records a customer.updated event.
Parameters
namestringThe customer's name. Sendnullto clear it.emailstringThe customer's email address. It can't benull.phone_numberstringThe customer's phone number, with its country code. Abuna saves it as+and digits, so00237 671-234-567becomes+237671234567. It can't benull.
Returns the customer. An invalid field or an unknown field returns 422 with code invalid. If the app has no customer with that ID, returns 404 with code not_found.
curl https://api.abuna.app/v1/apps/01J9ZQ4Y7R3T6V8W2X5B1C0DEF/customers/01J9ZQ6A1B2C3D4E5F6G7H8J9K \
-X PATCH \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-d '{"email": "jane.doe@example.com"}'{
"id": "01J9ZQ6A1B2C3D4E5F6G7H8J9K",
"app_id": "01J9ZQ4Y7R3T6V8W2X5B1C0DEF",
"name": "Jane Doe",
"phone_number": "+237671234567",
"email": "jane.doe@example.com",
"created_at": 1727600000
}