Skip to content
ABUNA
DocsCustomers

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

  • idstring

    Unique identifier for the customer.
  • app_idstring

    The app the customer belongs to.
  • namestringnullable

    The customer's name.
  • phone_numberstring

    The customer's phone number. Mobile money payment requests go to this number.
  • emailstring

    The customer's email address. Abuna emails the customer's notices here.
  • created_attimestamp

    When the customer was created, in Unix seconds.
The customer object
{
  "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

  • emailstringrequired

    The customer's email address.
  • phone_numberstringrequired

    The customer's phone number, with its country code, like +237671234567.
  • namestring

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

POST /v1/apps/{appID}/customers
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"}'
Response
{
  "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

  • searchstring

    Returns only customers whose name or email contains this text. Case doesn't matter.

Extra attributes

  • telegram_connectedboolean

    Whether the customer gets their notices on Telegram too.
  • active_subscriptionsinteger

    How many of the customer's subscriptions are active.

Returns an array. It isn't paginated.

GET /v1/apps/{appID}/customers
curl 'https://api.abuna.app/v1/apps/01J9ZQ4Y7R3T6V8W2X5B1C0DEF/customers?search=jane' \
  -H "Authorization: Bearer sk_test_..."
Response
[
  {
    "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

  • namestring

    The customer's name. Send null to clear it.
  • emailstring

    The customer's email address. It can't be null.
  • phone_numberstring

    The customer's phone number, with its country code. Abuna saves it as + and digits, so 00237 671-234-567 becomes +237671234567. It can't be null.

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.

PATCH /v1/apps/{appID}/customers/{id}
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"}'
Response
{
  "id": "01J9ZQ6A1B2C3D4E5F6G7H8J9K",
  "app_id": "01J9ZQ4Y7R3T6V8W2X5B1C0DEF",
  "name": "Jane Doe",
  "phone_number": "+237671234567",
  "email": "jane.doe@example.com",
  "created_at": 1727600000
}

Next steps