Skip to main content

Overview

The CustomersClient provides full CRUD operations for managing end-user (customer) records in your application.

Methods

identify()

Identify (upsert) a customer. Creates the customer if not found, or updates it if a record with the same customerId already exists.
const customer = await revstack.customers.identify(params);
params
IdentifyCustomerParams
required
Customer identification parameters.
customer
Customer
The created or updated customer record.
Example:
const customer = await revstack.customers.identify({
  customerId: "user-123",
  email: "[email protected]",
  name: "John Doe",
  metadata: { segment: "enterprise" },
});

get()

Retrieve a customer by ID.
const customer = await revstack.customers.get(customerId);
customerId
string
required
The customer’s unique identifier.Example: "usr_abc123"
customer
Customer
The customer record.
Example:
const customer = await revstack.customers.get("usr_abc123");
console.log(customer.email); // "[email protected]"

list()

List customers with optional pagination.
const response = await revstack.customers.list(params);
params
ListParams
Pagination parameters.
response
PaginatedResponse<Customer>
A paginated list of customer records.
Example:
const { data: customers, hasMore } = await revstack.customers.list({
  limit: 50,
  offset: 0,
});

console.log(`Found ${customers.length} customers`);

update()

Update an existing customer’s profile.
const customer = await revstack.customers.update(customerId, params);
customerId
string
required
The customer’s unique identifier.
params
UpdateCustomerParams
required
Fields to update.
customer
Customer
The updated customer record.
Example:
const customer = await revstack.customers.update("usr_abc123", {
  email: "[email protected]",
  metadata: { verified: true },
});

delete()

Delete a customer and all associated data.
const result = await revstack.customers.delete(customerId);
customerId
string
required
The customer’s unique identifier.
result
object
success
boolean
Confirmation of deletion.
Example:
const { success } = await revstack.customers.delete("usr_abc123");
if (success) {
  console.log("Customer deleted successfully");
}

Build docs developers (and LLMs) love