Guides

Customers

Learn how to create, manage, and query customers in NovaBilling.

Customer Management

Customers are the core entity in NovaBilling. Every subscription, invoice, and payment is associated with a customer. This guide covers all customer operations in detail.

Customer Object

A customer record contains the following fields:

FieldTypeDescription
idstringUnique identifier (e.g., cust_x1y2z3)
externalIdstringYour application's user ID for cross-referencing
emailstringCustomer's email address (unique per tenant)
namestringCustomer's full name
countrystringISO 3166-1 alpha-2 country code
currencystringPreferred currency (ISO 4217)
statusstringCustomer status: active or inactive
metadataobjectCustom key-value pairs for your application data
totalSpentnumberLifetime total amount paid
activeSubscriptionsnumberCount of active subscriptions
createdAtstringISO 8601 creation timestamp
updatedAtstringISO 8601 last update timestamp

Creating Customers

Create a customer with at minimum an email address and name.

curl -X POST http://localhost:3000/api/customers \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk_live_a1b2c3d4..." \
  -d '{
    "externalId": "usr_98765",
    "email": "sarah@kampaltech.ug",
    "name": "Nakato Sarah",
    "country": "UG",
    "currency": "UGX",
    "metadata": {
      "userId": "usr_98765",
      "accountType": "business"
    }
  }'
Customer email addresses must be unique within your tenant. Attempting to create a customer with an existing email will return a 409 Conflict error.

Updating Customers

Update any customer field. Only the fields you provide will be updated; omitted fields remain unchanged.

curl -X PATCH http://localhost:3000/api/customers/cust_x1y2z3 \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk_live_a1b2c3d4..." \
  -d '{
    "name": "Nakato Sarah Williams",
    "metadata": {
      "userId": "usr_98765",
      "accountType": "enterprise",
      "upgradeDate": "2025-03-01"
    }
  }'
The metadata field is replaced entirely on update. If you want to add a new key while preserving existing ones, include all existing metadata keys in the update request.

Listing and Filtering Customers

Retrieve customers with pagination, search, and sorting.

Basic Listing

curl -X GET "http://localhost:3000/api/customers?page=1&limit=20" \
  -H "Authorization: Bearer sk_live_a1b2c3d4..."

Search by Name or Email

curl -X GET "http://localhost:3000/api/customers?search=sarah&page=1&limit=20" \
  -H "Authorization: Bearer sk_live_a1b2c3d4..."

Getting Customer Details

curl -X GET http://localhost:3000/api/customers/cust_x1y2z3 \
  -H "Authorization: Bearer sk_live_a1b2c3d4..."

Deleting Customers

Delete a customer and all their associated data. This action is irreversible.

curl -X DELETE http://localhost:3000/api/customers/cust_x1y2z3 \
  -H "Authorization: Bearer sk_live_a1b2c3d4..."
Deleting a customer will cancel all active subscriptions and void all unpaid invoices. This action cannot be undone. Make sure to cancel subscriptions gracefully before deleting a customer if you need to process final invoices.

Best Practices

  1. Use metadata for application data -- Store your application's user IDs, account types, and other relevant data in the metadata field. This makes it easy to correlate NovaBilling customers with your application records.
  2. Store customer IDs -- Save the NovaBilling customer ID (cust_...) in your application's user record for easy lookups.
  3. Validate email uniqueness -- The API enforces email uniqueness per tenant. Handle 409 Conflict errors gracefully in your integration.
  4. Set country and currency -- Always provide the customer's country and preferred currency for accurate billing and payment routing.
Copyright © 2026