---
title: "Charges over time, by up to two keys"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.ezghcloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

Path: Billing API › Billing

`GET /v1/organizations/{orgId}/costs`

## Authentication

Requires one of the following:

- `apiKey`, http, header `Authorization`
- `oauth`, http, header `Authorization`
- `sessionCookie`, apiKey, in cookie

## Path parameters

- `GetCostAndUsage.path.orgId` (string, required)
  - format `uuid`

## Query parameters

- `GetCostAndUsage.query.from` (string, required) — A date (2026-09-01) or an hour-aligned UTC time (2026-09-01T10:00:00Z).
- `GetCostAndUsage.query.to` (string, required) — Exclusive, like from. Hourly windows are at most 14 days, others 13 months.
- `GetCostAndUsage.query.granularity` (string, optional)
  - one of `"hour"`, `"day"`, `"month"`; default `"day"`
- `GetCostAndUsage.query.groupBy` (string, optional) — Up to two of project, service, meter, sku, region, comma-separated.
- `GetCostAndUsage.query.filter` (string, optional) — key:value, comma-separated, keys as groupBy; values of one key are alternatives. project: is organization-level usage.

## Code samples

### cURL

```curl
curl --request GET \
  --url 'https://billing.ezghcloud.com/v1/organizations/497f6eca-6276-4993-bfeb-53cbbbba6f08/costs?from=string&to=string' \
  --header 'Authorization: Bearer <token>'
```

### TypeScript

```typescript
const url = 'https://billing.ezghcloud.com/v1/organizations/497f6eca-6276-4993-bfeb-53cbbbba6f08/costs?from=string&to=string';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://billing.ezghcloud.com/v1/organizations/497f6eca-6276-4993-bfeb-53cbbbba6f08/costs?from=string&to=string"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
```

## Responses

### 200

OK

#### Example

```json
{
  "organizationId": "string",
  "from": "2019-08-24T14:15:22Z",
  "to": "2019-08-24T14:15:22Z",
  "granularity": "string",
  "currency": "string",
  "ratedThrough": "2019-08-24T14:15:22Z",
  "periods": [
    {
      "start": "2019-08-24T14:15:22Z",
      "end": "2019-08-24T14:15:22Z",
      "estimated": true,
      "groups": [
        {
          "keys": {
            "property1": "string",
            "property2": "string"
          },
          "billedCost": "string",
          "quantity": "string",
          "unit": "string"
        }
      ]
    }
  ],
  "values": {
    "property1": [
      "string"
    ],
    "property2": [
      "string"
    ]
  },
  "labels": {
    "services": {
      "property1": "string",
      "property2": "string"
    },
    "meters": {
      "property1": "string",
      "property2": "string"
    },
    "skus": {
      "property1": "string",
      "property2": "string"
    }
  },
  "nextCursor": null
}
```

- `GetCostAndUsage.response.200.organizationId` (string, required)
- `GetCostAndUsage.response.200.from` (string, required)
  - format `date-time`
- `GetCostAndUsage.response.200.to` (string, required)
  - format `date-time`
- `GetCostAndUsage.response.200.granularity` (string, required) — hour, day or month.
- `GetCostAndUsage.response.200.currency` (string, required)
- `GetCostAndUsage.response.200.ratedThrough` (string, required) — Every hour before this is rated; later costs are still coming.
  - format `date-time`
- `GetCostAndUsage.response.200.periods` (array<object>, required) — Every period in the window.
  - `GetCostAndUsage.response.200.periods.start` (string, required)
    - format `date-time`
  - `GetCostAndUsage.response.200.periods.end` (string, required) — Exclusive.
    - format `date-time`
  - `GetCostAndUsage.response.200.periods.estimated` (boolean, required)
  - `GetCostAndUsage.response.200.periods.groups` (array<object>, required)
    - `GetCostAndUsage.response.200.periods.groups.keys` (map<string>, required) — The group's values of the groupBy keys. project "" is organization-level usage.
    - `GetCostAndUsage.response.200.periods.groups.billedCost` (string, required) — Micros.
      - pattern `^-?[0-9]+(\.[0-9]+)?$`
    - `GetCostAndUsage.response.200.periods.groups.quantity` (string | null, required) — Set when grouped by meter or sku.
    - `GetCostAndUsage.response.200.periods.groups.unit` (string | null, required) — The quantity's unit; null for charges without a meter.
- `GetCostAndUsage.response.200.values` (map<array<string>>, required) — Every value of each key in the window, whatever the filter.
- `GetCostAndUsage.response.200.labels` (object, required) — Display names for the IDs in the answer. IDs without one are left out.
  - `GetCostAndUsage.response.200.labels.services` (map<string>, required)
  - `GetCostAndUsage.response.200.labels.meters` (map<string>, required)
  - `GetCostAndUsage.response.200.labels.skus` (map<string>, required)
- `GetCostAndUsage.response.200.nextCursor` (null, required) — One page: always null.

### 400

invalid_request: the request is malformed (with issues), or invalid_cursor.

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "issues": [
      {
        "path": "string",
        "message": "string"
      }
    ]
  }
}
```

- `GetCostAndUsage.response.400.error` (object, required)
  - `GetCostAndUsage.response.400.error.code` (string, required) — What went wrong, for programs: branch on this, never on message.
  - `GetCostAndUsage.response.400.error.message` (string, required) — What went wrong, for people.
  - `GetCostAndUsage.response.400.error.issues` (array<object>, optional) — With invalid_request: each invalid field.
    - `GetCostAndUsage.response.400.error.issues.path` (string, required)
    - `GetCostAndUsage.response.400.error.issues.message` (string, required)

### 401

unauthenticated: no valid credential.

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "issues": [
      {
        "path": "string",
        "message": "string"
      }
    ]
  }
}
```

- `GetCostAndUsage.response.401.error` (object, required)
  - `GetCostAndUsage.response.401.error.code` (string, required) — What went wrong, for programs: branch on this, never on message.
  - `GetCostAndUsage.response.401.error.message` (string, required) — What went wrong, for people.
  - `GetCostAndUsage.response.401.error.issues` (array<object>, optional) — With invalid_request: each invalid field.
    - `GetCostAndUsage.response.401.error.issues.path` (string, required)
    - `GetCostAndUsage.response.401.error.issues.message` (string, required)

### 403

access_denied: the caller isn't allowed to (the message names the action); forbidden_origin: a cookie-authenticated write from another site.

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "issues": [
      {
        "path": "string",
        "message": "string"
      }
    ]
  }
}
```

- `GetCostAndUsage.response.403.error` (object, required)
  - `GetCostAndUsage.response.403.error.code` (string, required) — What went wrong, for programs: branch on this, never on message.
  - `GetCostAndUsage.response.403.error.message` (string, required) — What went wrong, for people.
  - `GetCostAndUsage.response.403.error.issues` (array<object>, optional) — With invalid_request: each invalid field.
    - `GetCostAndUsage.response.403.error.issues.path` (string, required)
    - `GetCostAndUsage.response.403.error.issues.message` (string, required)

### 404

not_found: the organization (or one the caller doesn't belong to), or the resource, doesn't exist.

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "issues": [
      {
        "path": "string",
        "message": "string"
      }
    ]
  }
}
```

- `GetCostAndUsage.response.404.error` (object, required)
  - `GetCostAndUsage.response.404.error.code` (string, required) — What went wrong, for programs: branch on this, never on message.
  - `GetCostAndUsage.response.404.error.message` (string, required) — What went wrong, for people.
  - `GetCostAndUsage.response.404.error.issues` (array<object>, optional) — With invalid_request: each invalid field.
    - `GetCostAndUsage.response.404.error.issues.path` (string, required)
    - `GetCostAndUsage.response.404.error.issues.message` (string, required)

### 429

too_many_requests: slow down.

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "issues": [
      {
        "path": "string",
        "message": "string"
      }
    ]
  }
}
```

- `GetCostAndUsage.response.429.error` (object, required)
  - `GetCostAndUsage.response.429.error.code` (string, required) — What went wrong, for programs: branch on this, never on message.
  - `GetCostAndUsage.response.429.error.message` (string, required) — What went wrong, for people.
  - `GetCostAndUsage.response.429.error.issues` (array<object>, optional) — With invalid_request: each invalid field.
    - `GetCostAndUsage.response.429.error.issues.path` (string, required)
    - `GetCostAndUsage.response.429.error.issues.message` (string, required)

### 500

internal_error: a bug; the details are in the logs, under the request ID.

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "issues": [
      {
        "path": "string",
        "message": "string"
      }
    ]
  }
}
```

- `GetCostAndUsage.response.500.error` (object, required)
  - `GetCostAndUsage.response.500.error.code` (string, required) — What went wrong, for programs: branch on this, never on message.
  - `GetCostAndUsage.response.500.error.message` (string, required) — What went wrong, for people.
  - `GetCostAndUsage.response.500.error.issues` (array<object>, optional) — With invalid_request: each invalid field.
    - `GetCostAndUsage.response.500.error.issues.path` (string, required)
    - `GetCostAndUsage.response.500.error.issues.message` (string, required)

### 503

unavailable, ledger_unavailable or payments_unavailable: retry later.

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "issues": [
      {
        "path": "string",
        "message": "string"
      }
    ]
  }
}
```

- `GetCostAndUsage.response.503.error` (object, required)
  - `GetCostAndUsage.response.503.error.code` (string, required) — What went wrong, for programs: branch on this, never on message.
  - `GetCostAndUsage.response.503.error.message` (string, required) — What went wrong, for people.
  - `GetCostAndUsage.response.503.error.issues` (array<object>, optional) — With invalid_request: each invalid field.
    - `GetCostAndUsage.response.503.error.issues.path` (string, required)
    - `GetCostAndUsage.response.503.error.issues.message` (string, required)


Source: https://docs.ezghcloud.com/billing-api/Billing/GetCostAndUsage/index.md
