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

Get usage and its cost

Returns what was used and what it cost in US dollars, from a whole organisation down to one luna. You choose what each row stands for with by and narrow the rows with the filters. Rows come a page at a time, the most costly first, with the total of every row there is. An account sees the organisations it belongs to. An API key or a token needs usage:read and sees what it reaches.

GET/_luna/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:usage:read
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
orgstring

Only this organisation, by its slug or its id.

projectstring

Only this project, by its slug.

environmentstring

Only this environment, by its name.

tenantstring

Only this tenant, by its name.

typestring

Only this luna type, by its name.

lunastring

Only this luna of the type: its key as JSON, or its key encoded in hex. Give type with it.

bystring

What each row stands for: org, project, environment, tenant, type, luna, or none for the total alone. type when left out.

limitinteger

How many rows to return. 100 when left out, 1000 at most.

min 0
cursorstring

The next of the last page, to read the next one.

Responses
200

A page of usage.

sinceinteger<int64>required

Where the span starts, in milliseconds since the Unix epoch.

min 0
untilinteger<int64>required

Where the span ends, in milliseconds since the Unix epoch.

min 0
bystringrequired

What each row stands for.

rowsUsageRow[]required

The rows of this page, the most costly first.

Show properties
Array of UsageRow
orgstring | null

The organisation's slug. Null for a tenant that belongs to no organisation.

projectstring | null

The project's slug.

environmentstring | null

The environment's name.

tenantstring | null

The tenant's name.

typestring | null

The luna type's name.

lunastring | null

The luna, as its key encoded in hex. Null for usage that belongs to no one luna.

keyobject | null

The luna's key as its type declares it, when the row is a luna and its key reads.

indexboolean | null

True when the row's type is an index. Left out otherwise.

usageobjectrequired

What was used, as raw counts by meter.

costobjectrequired

What each meter cost, in US dollars, by meter.

costUsdnumber<double>required

What the row cost in all, in US dollars.

listUsdnumber<double>required

What the row would cost at the plan's rates with nothing included, in US dollars.

totalUsageCostrequired

Every row there is added up, not only the rows of this page.

Show properties
usageobjectrequired

What was used, as raw counts by meter.

costobjectrequired

What each meter cost, in US dollars, by meter. A meter with no price has usage and no cost.

costUsdnumber<double>required

What it cost in all, in US dollars. A row's cost is its share of what its organisation is charged for each meter in the month.

listUsdnumber<double>required

What it would cost at the plan's rates with nothing included, in US dollars.

indexesIndexUsage[]required

The usage of each index, the most costly first.

Show properties
Array of IndexUsage
usageobjectrequired

What was used, as raw counts by meter.

costobjectrequired

What each meter cost, in US dollars, by meter. A meter with no price has usage and no cost.

costUsdnumber<double>required

What it cost in all, in US dollars. A row's cost is its share of what its organisation is charged for each meter in the month.

listUsdnumber<double>required

What it would cost at the plan's rates with nothing included, in US dollars.

namestringrequired

The index's name.

metersobjectrequired

Each meter's unit and price, by meter.

nextstring | null

Send it back as cursor to read the next page. Null on the last page.

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/usage' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Accept: application/json'
Response
{
  "since": 0,
  "until": 0,
  "by": "string",
  "rows": [
    {
      "org": "string",
      "project": "string",
      "environment": "string",
      "tenant": "string",
      "type": "string",
      "luna": "string",
      "key": {},
      "index": true,
      "usage": {
        "property1": 0,
        "property2": 0
      },
      "cost": {
        "property1": 0.1,
        "property2": 0.1
      },
      "costUsd": 0.1,
      "listUsd": 0.1
    }
  ],
  "total": {
    "usage": {
      "property1": 0,
      "property2": 0
    },
    "cost": {
      "property1": 0.1,
      "property2": 0.1
    },
    "costUsd": 0.1,
    "listUsd": 0.1
  },
  "indexes": [
    {
      "usage": {
        "property1": 0,
        "property2": 0
      },
      "cost": {
        "property1": 0.1,
        "property2": 0.1
      },
      "costUsd": 0.1,
      "listUsd": 0.1,
      "name": "string"
    }
  ],
  "meters": {
    "property1": {
      "unit": "string",
      "scale": 0.1,
      "rate": 0,
      "included": 0
    },
    "property2": {
      "unit": "string",
      "scale": 0.1,
      "rate": 0,
      "included": 0
    }
  },
  "next": "string"
}

Was this page helpful?