---
title: "Revenue composition"
method: GET
path: "/v1/analytics/composition"
tags: ["Analytics"]
---

# Revenue composition

`GET /v1/analytics/composition`

## Request

- Base URL: `https://api.subscriby.net`
- URL: `https://api.subscriby.net/v1/analytics/composition`
- Auth: HTTP bearer

How the window's revenue and payments are composed, as the five donuts the dashboards draw: transaction fees by payment provider, settled transactions by plan kind, gross revenue by currency, payment attempts by outcome, and the monthly recurring revenue split by plan.

```bash
curl "https://api.subscriby.net/v1/analytics/composition?project_id=$PROJECT_ID&period=30d" \
  -H "Authorization: Bearer $SUBSCRIBY_TOKEN"
```

- Every dataset carries `total`, `unit` (`usd` or `count`) and `slices` sorted largest first; each slice has its `key`, `label`, `value`, `share_percent` and the `color` the dashboard draws it in, so a client can render the same donut.
- `fees_by_provider`, `transactions_by_kind` and `revenue_by_currency` read the same settled payments, so they agree with each other to the cent; `payment_outcomes` reads every attempt in the window, because a failed charge is exactly what it exists to show.
- `mrr_by_plan` ignores the window: MRR is a balance, not a flow. It counts every active subscription on a recurring plan, normalised to a monthly USD figure, filed under its plan.
- Labels come back in the creator's language.

## Query parameters

- `project_id` string, uuid
- `period` string
- `from` string, date
- `to` string, date

## Response `200`

The four dashboard donuts for the window plus the MRR base split by plan, each as `total`, `unit` and `slices`.

- object
  - `data` object, required: The response's payload.
    - `range` object, required: The window the preset resolved to.
      - `from` string, required: The first day of the window, `YYYY-MM-DD`.
      - `to` string, required: The last day of the window, `YYYY-MM-DD`.
    - `fees_by_provider` object, required: Provider fees on the window's settled payments, split by payment provider, in USD.
    - `transactions_by_kind` object, required: The window's settled payments counted by the kind of plan they bought.
    - `revenue_by_currency` object, required: The window's settled payments summed by the currency they were charged in, each converted to USD.
    - `payment_outcomes` object, required: Every payment attempt in the window counted by outcome, including the failed ones.
    - `mrr_by_plan` object, required: The monthly recurring revenue of every active subscription on a recurring plan, split by plan, in USD; independent of the window.
      - `total` number, required: The MRR summed.
      - `unit` string, required: Always `usd`.
      - `slices` object[], required: One slice per recurring plan with active subscriptions, largest first.
        - `key` string, required: The plan's id.
        - `label` string, required: The plan's name.
        - `value` number, required: The plan's MRR in USD.
        - `share_percent` number, required: The slice's part of `total`, one decimal.
        - `color` string, required: The colour the dashboard draws the slice in.
  - `meta` object, required: The request's window and scope, echoed back.
    - `period` string, required: The preset the window resolved from, as requested.
    - `project_id` string, nullable, required: The project the figures were scoped to, or `null` for every project the token may see.

## Other responses

- `401`: `AUTHENTICATION_REQUIRED`: the request carries no bearer token, or one that is revoked, malformed, or minted for another environment (an `sbt_test_` token on production).
- `403`: `TOKEN_MISSING_ABILITY`: the token is valid but does not carry the ability this endpoint requires; `error.context.required_ability` names the one to grant. An endpoint that also checks who owns a row or which tier the account is on answers `FORBIDDEN`, `TEAM_TIER_REQUIRED` or `CONNECTOR_TIER_REQUIRED` with the same status, and says so in its own description.
- `429`: `RATE_LIMITED`: the token has spent its 300 requests a minute or 10,000 an hour; `Retry-After` says when the next one is accepted.

---

[API](https://skmtc.dev/memberpass/apis/subscriby-rest-api.md) · [All operations](https://skmtc.dev/memberpass/apis/subscriby-rest-api/llms.txt) · [OpenAPI document](https://skmtc.dev/memberpass/apis/subscriby-rest-api/revisions/59c4df91d764?raw)
