Customers
The customers resource handles the usual create, read, update, delete, plus one method built for customer detail pages:getWithRevenue. It fetches the customer record AND their revenue numbers for a time window in one round trip.
This page covers:
- Creating a customer
- Listing customers
- Getting one customer
- Updating a customer
- Deleting a customer
- Getting a customer with their revenue numbers attached
Setup
customers.create
Creates a new customer. If you pass agentCode, MarginFront also auto-creates a subscription between the customer and that agent.
Signature
Example
customers.list
Returns a paginated list of customers with optional filters.
Signature
Example
customers.get
Fetches one customer by id, including their subscriptions.
Signature
Example
customers.update
Updates an existing customer. Pass only the fields you want to change.
Signature
Example
customers.delete
Deletes a customer.
Signature
Example
customers.getWithRevenue
What it does in plain English: fetches a customer AND their revenue numbers for a time window, in one call. Lets you render a customer detail page (profile, subscriptions, revenue, cost, margin) without juggling two round trips.
Behind the scenes the SDK fires both requests in parallel, so the wall-clock time is roughly the time of one call.
Signature
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | yes | The customer id (MarginFront’s internal UUID). |
window.startDate | string | no | ISO date. Defaults to 30 days ago if omitted. |
window.endDate | string | no | ISO date. Defaults to today if omitted. |
Response shape
customer field is the same shape as customers.get returns. The revenue field is the same canonical shape analytics.revenue returns, scoped to this one customer. See Types Reference for the complete interfaces.
Example
What this returns, in plain English
customerthe usual customer record. Profile, contact info, status, subscriptions list (if populated), billing settings.revenuea full canonical revenue block for this one customer, in the window you asked for. Revenue, cost, margin, marginPercent, plus the usage/recurring/seat/onetime breakdown, a per-subscription row list, and a per-pricing-strategy row list.
RevenueMetrics, see Types Reference.
When to use this
Customer detail pages. Account manager dashboards. Churn-risk reviews. Anywhere you need the customer record AND how much they’re contributing in one view. For just the customer record, usecustomers.get. For revenue across many customers, use analytics.revenue with no filter (and read bySubscription for per-customer rollups).
Next steps
- Analytics: all seven canonical analytics methods
- Types Reference: full interface definitions
- Subscriptions with Revenue: the same pattern, but scoped to a subscription

