Skip to content
New Revenue by source: MRR from Stripe or Paddle beside your live traffic, each subscription credited to its first visit

Subscriptions API

POST /api/v1/subscriptions gives mettr your own billing's subscriptions, for MRR, ARR, churn and revenue by source when you do not bill through Stripe or Paddle.

mettr reads Stripe and Paddle itself. For any other billing (your own, LiqPay, Gumroad, a bank's), your app sends each subscription as it is now, and mettr works out MRR and how it moved. Revenue comes with the Pro plan.

Send a subscription

curl https://mettr.app/api/v1/subscriptions \
  -H "Authorization: Bearer $METTR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "sub_4821",
    "status": "active",
    "amount": 19.00,
    "currency": "USD",
    "interval": "month",
    "user_id": "4821",
    "plan": "Pro",
    "started_at": "2026-03-01T10:00:00Z"
  }'
{"accepted": 1}

Several at once as {"subscriptions": [...]}, up to 100. The Laravel and PHP SDKs have a method for it.

When to send

  • Whenever one changes: a new subscription, an upgrade, a cancellation, a failed payment. A model observer or your billing's own events are a good place.
  • Every subscription once, past ones included, when you start: that fills the history. A subscription seen for the first time counts as paying from its started_at, or from started_at to canceled_at if it has already stopped.

Sending the same subscription again is safe: it moves MRR only if its monthly amount changed, at its changed_at (or when it stopped, or now).

The first subscription sent connects the site's revenue to your own billing. A site that reads Stripe or Paddle refuses them with 409, so nothing counts twice.

Fields

Field Type What it is
id string Required. Your id for the subscription, up to 64 characters
status string Required. active or past_due (both count as paying), trialing, paused, canceled
amount number Required. What it charges each cycle, before tax, in the main unit (19.00, not cents)
currency string Required. ISO 4217, upper case: USD, EUR, UAH
interval string Required. day, week, month or year
interval_count integer Cycles of the interval per charge, 1 to 36 (3 and month: quarterly). 1 when left out
user_id string Your id for the customer, as your server sends it with events. It ties the revenue to the visit they came from
plan string The plan's name, up to 120 characters
started_at string When it started paying, ISO 8601
canceled_at string When it stopped paying
changed_at string When it became as sent. Now when left out; never in the future

Currencies

Each subscription keeps its own currency. The dashboard shows the site's revenue in one currency, converted at the European Central Bank's rate of each day. A currency the ECB has no rate for is left out and named on the dashboard, never guessed.

Responses

Status Means
200 Accepted: {"accepted": n}
401 No secret key, or not a valid one
402 The site's team is on the Free plan
409 The site reads Stripe or Paddle
422 A field does not fit: see errors, by place in the batch

One-off payments are not subscriptions: send them as revenue events.

Updated · This page as Markdown · Something unclear? [email protected]

Search the docs, features, comparisons, blog and changelog