---
title: "Earnings report"
method: GET
path: "/v1/analytics/earnings"
tags: ["Analytics"]
---

# Earnings report

`GET /v1/analytics/earnings`

## Request

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

The full earnings breakdown (gross, fees, net, transaction count) plus a timeseries bucketed by `granularity`: `day` (the default), `week` or `month`.

```bash
curl "https://api.subscriby.net/v1/analytics/earnings?granularity=week" \
  -H "Authorization: Bearer $SUBSCRIBY_TOKEN"
```

Every money figure is USD-normalised so buckets in different currencies add up; `totals.currency` says so.

## Query parameters

- `project_id` string, uuid
- `period` string
- `from` string, date
- `to` string, date
- `granularity` string
- `plan_ids[]` string[]
- `statuses[]` string[]
- `payment_method_ids[]` string[]

## Response `200`

Gross, fees and net per bucket.

- object
  - `data` object, required: The response's payload.
    - `range` object, required: The window the preset resolved to, and how it was bucketed.
      - `from` string, required: The first day of the window, `YYYY-MM-DD`.
      - `to` string, required: The last day of the window, `YYYY-MM-DD`.
      - `granularity` string, required: `day`, `week` or `month`: how wide each timeseries bucket is.
    - `totals` object, required: The whole window summed.
      - `gross` number, required: Every settled payment in the window, in USD.
      - `fees` number, required: The provider fees attributed to those payments, in USD.
      - `net` number, required: `gross` minus `fees`.
      - `transactions` integer, required: How many settled payments the window holds.
      - `currency` string, required: Always `USD`: the figures are normalised.
    - `timeseries` object[], required: One row per bucket, oldest first; empty buckets are omitted.
      - `bucket` string, required: The bucket's first day, `YYYY-MM-DD`.
      - `gross` number, required: Settled payments in the bucket, in USD.
      - `fees` number, required: Provider fees in the bucket, in USD.
      - `net` number, required: `gross` minus `fees` for the bucket.
      - `transactions` integer, required: Settled payments in the bucket.
  - `meta` object, required: The request's window and scope, echoed back.
    - `period` string, required: The preset the window resolved from, as requested.
    - `granularity` string, required: The bucket width, 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.
- `422`: `VALIDATION_FAILED`: when `granularity` is not `day`, `week` or `month`, or `project_id` is not a UUID.
- `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)
