---
title: "Credits, newest first: what's left on each and when it expires"
---

> 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}/credits`

## Authentication

Requires one of the following:

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

## Path parameters

- `ListCredits.path.orgId` (string, required) — The organization's UUID or prefixed ID (org_…).

## Query parameters

- `ListCredits.query.limit` (integer, optional)
  - min 1; max 100; default `20`
- `ListCredits.query.cursor` (string, optional) — A previous page's nextCursor.

## Code samples

### cURL

```curl
curl --request GET \
  --url https://billing.ezghcloud.com/v1/organizations/string/credits \
  --header 'Authorization: Bearer <token>'
```

### TypeScript

```typescript
const url = 'https://billing.ezghcloud.com/v1/organizations/string/credits';
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/string/credits"

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

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

print(response.text)
```

## Responses

### 200

OK

#### Example

```json
{
  "credits": [
    {
      "id": "string",
      "description": "string",
      "status": "active",
      "grantedMicros": "string",
      "remainingMicros": "string",
      "expiresAt": "2019-08-24T14:15:22Z",
      "createdAt": "2019-08-24T14:15:22Z"
    }
  ],
  "nextCursor": "string"
}
```

- `ListCredits.response.200.credits` (array<object>, required)
  - `ListCredits.response.200.credits.id` (string, required)
  - `ListCredits.response.200.credits.description` (string, required)
  - `ListCredits.response.200.credits.status` (string, required)
    - one of `"active"`, `"used_up"`, `"expired"`, `"revoked"`
  - `ListCredits.response.200.credits.grantedMicros` (string, required) — Micros.
    - pattern `^-?[0-9]+(\.[0-9]+)?$`
  - `ListCredits.response.200.credits.remainingMicros` (string, required) — Micros.
    - pattern `^-?[0-9]+(\.[0-9]+)?$`
  - `ListCredits.response.200.credits.expiresAt` (string | null, required) — Pays invoices for billing periods starting before this; null never expires.
    - format `date-time`
  - `ListCredits.response.200.credits.createdAt` (string, required)
    - format `date-time`
- `ListCredits.response.200.nextCursor` (string | null, required)

### 400

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

#### Example

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

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

### 401

unauthenticated: no valid credential.

#### Example

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

- `ListCredits.response.401.error` (object, required)
  - `ListCredits.response.401.error.code` (string, required) — What went wrong, for programs: branch on this, never on message.
  - `ListCredits.response.401.error.message` (string, required) — What went wrong, for people.
  - `ListCredits.response.401.error.issues` (array<object>, optional) — With invalid_request: each invalid field.
    - `ListCredits.response.401.error.issues.path` (string, required)
    - `ListCredits.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"
      }
    ]
  }
}
```

- `ListCredits.response.403.error` (object, required)
  - `ListCredits.response.403.error.code` (string, required) — What went wrong, for programs: branch on this, never on message.
  - `ListCredits.response.403.error.message` (string, required) — What went wrong, for people.
  - `ListCredits.response.403.error.issues` (array<object>, optional) — With invalid_request: each invalid field.
    - `ListCredits.response.403.error.issues.path` (string, required)
    - `ListCredits.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"
      }
    ]
  }
}
```

- `ListCredits.response.404.error` (object, required)
  - `ListCredits.response.404.error.code` (string, required) — What went wrong, for programs: branch on this, never on message.
  - `ListCredits.response.404.error.message` (string, required) — What went wrong, for people.
  - `ListCredits.response.404.error.issues` (array<object>, optional) — With invalid_request: each invalid field.
    - `ListCredits.response.404.error.issues.path` (string, required)
    - `ListCredits.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"
      }
    ]
  }
}
```

- `ListCredits.response.429.error` (object, required)
  - `ListCredits.response.429.error.code` (string, required) — What went wrong, for programs: branch on this, never on message.
  - `ListCredits.response.429.error.message` (string, required) — What went wrong, for people.
  - `ListCredits.response.429.error.issues` (array<object>, optional) — With invalid_request: each invalid field.
    - `ListCredits.response.429.error.issues.path` (string, required)
    - `ListCredits.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"
      }
    ]
  }
}
```

- `ListCredits.response.500.error` (object, required)
  - `ListCredits.response.500.error.code` (string, required) — What went wrong, for programs: branch on this, never on message.
  - `ListCredits.response.500.error.message` (string, required) — What went wrong, for people.
  - `ListCredits.response.500.error.issues` (array<object>, optional) — With invalid_request: each invalid field.
    - `ListCredits.response.500.error.issues.path` (string, required)
    - `ListCredits.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"
      }
    ]
  }
}
```

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


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