Subscriptions
A subscription ties a customer to a pricing plan. It’s the thing that says “starting on this date, bill this customer according to this plan’s rules.” Until a customer has a subscription, MarginFront doesn’t know how to charge them — usage events can still be logged, but there’s no pricing rule attached. Creating a subscription is the most complex create in the whole API because it brings together four other objects: a customer, an agent, a pricing plan, and a start date. All four have to already exist before you can create the subscription.The whole integration chain
Before you can create a subscription, you need (in this order):- A customer — see customers
- An agent — see agents
- One or more signals attached to that agent — see signals
- A pricing plan attached to that agent — see pricing-plans
Create a subscription
In plain English: Start billing a customer according to a pricing plan. You’re saying “from this date forward, charge this customer for this agent’s usage according to this plan.” Method & URL:name(string) — A human-readable name for the subscription. Useful for identifying it in the dashboard.planId(UUID string) — The pricing plan’s internal ID. From the pricing plan’s create response.agentId(UUID string) — The agent’s internal ID. Must match the agent that the plan belongs to.customerId(UUID string) — The customer’s internal ID. From the customer’s create response.startDate(ISO 8601 date string) — When this subscription starts billing. Can be in the past (for backdating) or the future (for scheduled activation). Example:"2026-04-10T00:00:00.000Z".
status("upcoming"|"active"|"ended", default"upcoming") — Current state. Use"active"if you want billing to start immediately.billingCycle("monthly"|"yearly"|"custom", default"monthly") — How often invoices are generated.billingModel("subscription"|"usage"|"hybrid", default"subscription") — How billing is calculated."subscription"= flat recurring fee"usage"= pay only for what you use"hybrid"= base fee + usage
netTerms(number, default30) — Payment terms in days after invoice issued.autoCollectPayment(boolean, defaultfalse) — Whether to automatically charge the customer’s saved payment method when an invoice is generated.
endDate(ISO date) — Fixed end date if this is a time-limited subscriptionisForever(boolean, defaultfalse) — Set true for subscriptions with no end date (ignoresendDate)subscriptionDetails(object) — Free-form metadata specific to this subscriptionseatsCount(number, default0) — For per-seat pricingcustomCycleDays(number) — Only whenbillingCycleis"custom"; how many days between invoicesproratedAmount(number) — Proration adjustment for mid-cycle startstimezone(string) — Override for billing period calculationsbillingDay(1-31) — Day of the month invoices are generatedinvoiceMemo(string) — A note that appears on every invoice for this subscriptionmetadata(object) — Custom key/value pairs; stored but not interpreted
201 Created):
400 Bad Request— Missing one of the required fields, or a UUID is the wrong format, orstartDateisn’t a valid ISO date.404 Not Found— One of the referenced objects (customer, agent, plan) doesn’t exist in this org.409 Conflict— This customer already has an overlapping active subscription for this plan, depending on your org’s rules.
Read a subscription
Method & URL:List subscriptions
Method & URL:customerId, status, agentId (check the controller for the full list).
Update a subscription
Method & URL:planId, agentId, customerId) generally should NOT be changed — if a customer switches plans, it’s usually cleaner to end the current subscription and create a new one rather than mutating the existing subscription, because it preserves a clean audit trail for accounting.
Update invoice dates
Method & URL:Read the subscription changelog
Method & URL:Using the Node SDK
@marginfront/sdk npm package. For now, create subscriptions through the HTTP API using curl or your language of choice — see the “Create a subscription” section above.
