Skip to main content

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:
  1. Creating a customer
  2. Listing customers
  3. Getting one customer
  4. Updating a customer
  5. Deleting a customer
  6. 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

See the Customers API reference for the full field list.

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

Pass both window fields together or neither. Omitting both defaults to the last 30 days UTC.

Response shape

The 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

  • customer the usual customer record. Profile, contact info, status, subscriptions list (if populated), billing settings.
  • revenue a 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.
For the full shape of 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, use customers.get. For revenue across many customers, use analytics.revenue with no filter (and read bySubscription for per-customer rollups).

Next steps