# Organization API: Organizations & Members: Analytics

> The 2 Organization API operations for analytics.

Source: https://www.coritan.com/docs/api/reference/organizations/organizations-members/analytics/

Part of [Organizations & Members](/docs/api/reference/organizations/organizations-members/).

## Operations

| Method | Path | Summary |
| --- | --- | --- |
| GET | [`/api/v1/orgs/{org_slug}/analytics/money`](#op-get-api-v1-orgs-org-slug-analytics-money) | Money in and money handed back per day |
| GET | [`/api/v1/orgs/{org_slug}/analytics/resources`](#op-get-api-v1-orgs-org-slug-analytics-resources) | What the organization's customer servers hold now and used per day |

### Money in and money handed back per day {#op-get-api-v1-orgs-org-slug-analytics-money}

`GET /api/v1/orgs/{org_slug}/analytics/money`

Money in and money handed back per day. Billing, admins and the owner.

The window is the last ``days`` days ending today (UTC), ``from`` to
``to``, and ``previous`` is the window of the same length before it.
``days`` is 7, 30, 90 or 365; any other number answers 422 naming them.

**What counts.** Money is counted when a gateway took it, as the
organization's revenue and its payouts count it
(``app.billing.org_revenue``). ``gross`` is hosting payments and wallet
top-ups a gateway charged, plus the store's captured live payments.
``refunds`` is money that went back out, as a positive figure: hosting
refunds and chargebacks, and the store's refunds that succeeded.
``net`` is ``gross`` less ``refunds``. An invoice staff marked paid, an
invoice paid from wallet credit, credit that was granted, a store payment
that was never captured and a test order are not money and are left out.
A payment that failed writes no row, so it is never counted.

**Currency.** Money is never added across currencies. ``currency`` is the
one with the most money in the window (the organization's default
currency when the window is empty), and ``series``, ``totals``,
``previous``, ``by_source`` and ``by_method`` are in it.
``other_currencies`` lists the window's payments in every other currency
(``currency``, ``gross``, ``payments``).

**The answer.** ``series`` has one row per day, oldest first, with zeros
for a day with no money: ``date``, ``gross``, ``refunds``, ``net`` and
``payments`` (how many payments). ``totals`` and ``previous`` hold
``gross``, ``refunds``, ``net``, ``payments``, ``refund_count`` and
``average_payment`` (``gross`` over ``payments``, ``0.00`` with none).
``by_source`` always has ``hosting``, and ``store`` when the organization
has a store: ``source``, ``label``, ``gross`` and ``payments``.
``by_method`` splits ``gross`` by who took the payment (``method``,
``label``, ``gross``, ``payments``), largest first. Amounts are strings
with two decimals and counts are numbers.

A store payment counts on the day it was captured and a store refund on
the day it was made. A store chargeback is not in ``refunds``: the store's
disputes list holds it.

#### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `org_slug` | path | string | yes |  |
| `days` | query | integer | no | The length of the window in days, ending today (UTC): one of 7, 30, 90 or 365. Any other number answers 422 naming them. Default: `30`. |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### What the organization's customer servers hold now and used per day {#op-get-api-v1-orgs-org-slug-analytics-resources}

`GET /api/v1/orgs/{org_slug}/analytics/resources`

What the organization's customer servers hold now and used per day. Any member.

The window is the last ``days`` days ending today (UTC), ``from`` to
``to``, and ``previous`` is the window of the same length before it.
``days`` is 7, 30, 90 or 365; any other number answers 422 naming them.

**Now.** ``now`` counts the game servers and virtual machines behind the
organization's services that have not ended (``services``), those whose
recorded power state is running (``running``), and the memory and storage
they are allocated (``memory_gb``, ``storage_gb``). ``by_product`` gives
the same per product of the organization (``product_id``, ``name``,
``services``, ``memory_gb``, ``storage_gb``), the 20 with the most memory,
with the CPU and traffic each used over the window (``cpu_vcpu_hours``,
``traffic_gb``, null when nothing was measured).

**Per day.** ``metered`` says whether Coritan rates each server's use per
day: memory, storage, CPU time and traffic out. It is true for an
organization on the usage billing basis, and for one Coritan owns, whose
figures are then what it would pay (``simulated`` is true and nothing is
charged). When it is, ``series`` has one row per day, oldest first:
``memory_gb_hours`` and ``storage_gb_hours`` (what was rated, zero for a
day with nothing rated), ``memory_gb`` and ``storage_gb`` (the average in
use that day: the GB-hours over 24), ``cpu_vcpu_hours`` (the CPU time
used), ``cpu_vcpus`` (the average vCPUs in use: the hours over 24),
``traffic_gb`` (the data sent out) and ``cost``. ``cpu_vcpu_hours``,
``cpu_vcpus`` and ``traffic_gb`` are null for a day on which nothing was
measured, which is not a day on which nothing was used. ``totals`` and
``previous`` hold ``memory_gb_hours``, ``storage_gb_hours``,
``cpu_vcpu_hours``, ``traffic_gb`` and ``cost``: the sums of the days'
figures, so their CPU and traffic count the days that were measured and
read zero when none was. A day is rated after it closes, so today and
sometimes yesterday read zero. A void row is left out, and so is a
simulated row once the organization pays. When ``metered`` is false
``series`` is empty, ``simulated`` is false, the totals are zero and
every ``cost`` is null.

**Cost.** ``cost`` is what the organization pays Coritan for the use, in
``currency`` (USD), as a string with four decimals: every meter together.
Only billing, admins and the owner read it: for every other member each
``cost`` is null. In ``by_product`` it is the product's cost over the
window. Quantities are strings with at most three decimals.

#### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `org_slug` | path | string | yes |  |
| `days` | query | integer | no | The length of the window in days, ending today (UTC): one of 7, 30, 90 or 365. Any other number answers 422 naming them. Default: `30`. |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |
