Skip to content
Luna
Esc
↑↓navigate↵open⌘Jpreview

Get an organisation's usage

Returns what an organisation used hour by hour and what each hour cost in US dollars, with the totals and a line for each package. Only hours that have ended are here. For the month as it stands, read the billing summary.

GET/_luna/orgs/{org}/usage
Authorization
AuthorizationBearer token · headerrequired

An account key (la_…), an API key (lt_…) or a session token (ls_…). The scopes listed are the permissions the operation needs.

Scopes:billing:read
Path parameters
orgstringrequired

The organisation, by its slug.

Query parameters
sinceinteger<int64>

Usage from this moment on, in milliseconds since the Unix epoch. 31 days before until when left out.

min 0
untilinteger<int64>

Usage up to this moment, in milliseconds since the Unix epoch. Now when left out.

min 0
Responses
200

The organisation's usage.

organisationstringrequired

The organisation's slug.

hoursOrgUsageHour[]required

Each hour that has ended, oldest first.

Show properties
Array of OrgUsageHour
hourinteger<int64>required

The hour's number, counted from the Unix epoch.

min 0
startMsinteger<int64>required

When the hour starts, in milliseconds since the Unix epoch.

min 0
usageobjectrequired

What was used in the hour, as raw counts by meter.

costUsdnumber<double>required

What the hour cost, in US dollars.

totalsobjectrequired

Every hour added up, as raw counts by meter.

costUsdnumber<double>required

What the hours cost together, in US dollars.

packagesobjectrequired

A line for each package the organisation uses, by package.

default

The request failed. The status says how and error.message says why.

errorErrorDetailrequired
Show properties
codestring | null

A code for programs to branch on, when the error has one.

messagestringrequired

What went wrong, in a sentence a person can read.

Try it
Server
Authorization
Parameters
Request
curl -X GET 'https://luna.example.com/_luna/orgs/string/usage' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Accept: application/json'
Response
{
  "organisation": "string",
  "hours": [
    {
      "hour": 0,
      "startMs": 0,
      "usage": {
        "property1": 0,
        "property2": 0
      },
      "costUsd": 0.1
    }
  ],
  "totals": {
    "property1": 0,
    "property2": 0
  },
  "costUsd": 0.1,
  "packages": {
    "property1": {
      "usage": {
        "property1": 0,
        "property2": 0
      },
      "costUsd": 0.1
    },
    "property2": {
      "usage": {
        "property1": 0,
        "property2": 0
      },
      "costUsd": 0.1
    }
  }
}

Was this page helpful?