---
agent:
  instructions: "Use this search API to find relevant content across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://truto.one/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Get the team's credits

> Source: https://truto.one/docs/api-reference/admin/billing/get-credit-grant/

`GET /billing/credit-grant`

Resource: **Billing**

**Every live credit grant the team holds, and their total.** Credits add up: each offer the team got gives its own grant. Also the last grants that ended.

## Query parameters

- **`team_id`** _(string, required)_

## Response body

- **`result`** _(object)_
  The team's credits. They add up: a team holds one live grant per offer it got. Draws take from the grant that ends first, then the oldest.
  - **`total_left_cents`** _(integer)_
    Credits left across every live grant.
  - **`total_amount_cents`** _(integer)_
    What the live grants gave, together.
  - **`grants`** _(array<object>)_
    The live grants (not ended), the one that ends first first. Empty when there are none.
    - **`id`** _(string)_
    - **`team_offer_id`** _(string)_
    - **`offer_id`** _(string)_
    - **`offer_key`** _(string)_
    - **`offer_name`** _(string)_
    - **`amount_cents`** _(integer)_
      Credits given, in cents.
    - **`left_cents`** _(integer)_
      Credits left, in cents. 0 once ended.
    - **`status`** _(string)_
      `locked` until the team saves a card.
      Allowed: `locked`, `active`, `ended`
    - **`pays_for`** _(object)_
      - **`usage`** _(boolean)_
      - **`pro`** _(boolean)_
    - **`includes_pro`** _(boolean)_
      Pro is turned on, paid by the credits, when they switch on.
    - **`pro_continue_ask`** _(boolean)_
      The card dialog asks whether Pro continues on the card after the credits end (`pro_continue_consent`).
    - **`pro_cap_cents`** _(integer)_
      The most these credits pay of Pro. Null for no cap.
    - **`pro_cap_left_cents`** _(integer)_
      What is left of `pro_cap_cents`. Null for no cap, and once ended.
    - **`granted_at`** _(string)_
    - **`activated_at`** _(string)_
    - **`expires_at`** _(string)_
    - **`ended_at`** _(string)_
    - **`end_reason`** _(string)_
      `replaced` only on grants from before credits added up.
      Allowed: `expired`, `used_up`, `revoked`, `enterprise`, `replaced`
    - **`pro_paid_by_credits`** _(boolean)_
      This grant pays Pro now.
  - **`ended`** _(array<object>)_
    The last 5 grants that ended, newest first.
    - **`id`** _(string)_
    - **`team_offer_id`** _(string)_
    - **`offer_id`** _(string)_
    - **`offer_key`** _(string)_
    - **`offer_name`** _(string)_
    - **`amount_cents`** _(integer)_
      Credits given, in cents.
    - **`left_cents`** _(integer)_
      Credits left, in cents. 0 once ended.
    - **`status`** _(string)_
      `locked` until the team saves a card.
      Allowed: `locked`, `active`, `ended`
    - **`pays_for`** _(object)_
      - **`usage`** _(boolean)_
      - **`pro`** _(boolean)_
    - **`includes_pro`** _(boolean)_
      Pro is turned on, paid by the credits, when they switch on.
    - **`pro_continue_ask`** _(boolean)_
      The card dialog asks whether Pro continues on the card after the credits end (`pro_continue_consent`).
    - **`pro_cap_cents`** _(integer)_
      The most these credits pay of Pro. Null for no cap.
    - **`pro_cap_left_cents`** _(integer)_
      What is left of `pro_cap_cents`. Null for no cap, and once ended.
    - **`granted_at`** _(string)_
    - **`activated_at`** _(string)_
    - **`expires_at`** _(string)_
    - **`ended_at`** _(string)_
    - **`end_reason`** _(string)_
      `replaced` only on grants from before credits added up.
      Allowed: `expired`, `used_up`, `revoked`, `enterprise`, `replaced`
    - **`pro_paid_by_credits`** _(boolean)_
      This grant pays Pro now.
  - **`pro_paid_by_credits`** _(boolean)_
    Credits pay Pro now.
  - **`pro_turn_off_locked`** _(boolean)_
    While true, `DELETE /billing/add-on/pro` is a `409`.
  - **`pro_turn_off_opens_at`** _(string)_
    When Pro can be turned off, the 1st of the month the credits end in. The credits pay that month; the card pays from the month after.

## Errors

| Status | Description |
| :----- | :---------- |
| `403` | Forbidden if the caller is not an admin of the team |

## Code examples

### curl

```bash
curl -X GET 'https://api.truto.one/billing/credit-grant' \
  -H 'Authorization: Bearer <your_api_token>' \
  -H 'Content-Type: application/json'
```

### JavaScript

```javascript
const response = await fetch('https://api.truto.one/billing/credit-grant', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer <your_api_token>',
    'Content-Type': 'application/json',
  },
});

const data = await response.json();
console.log(data);
```

### Python

```python
import requests

url = "https://api.truto.one/billing/credit-grant"
headers = {
    "Authorization": "Bearer <your_api_token>",
    "Content-Type": "application/json",
}
params = {
}

response = requests.get(url, headers=headers, params=params)
print(response.json())
```
