> For the complete documentation index, see [llms.txt](https://docs.gitloom.cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gitloom.cloud/api-reference/usage-and-billing.md).

# Usage and billing

What an account has consumed, and how to move money.

#### GET /v1/usage

This period's consumption against the account's plan. `memories` is a level (goes down as well as up), not scoped to a period.

```bash
curl -s "$GITLOOM_API/v1/usage" -H "Authorization: Bearer $GITLOOM_KEY"
```

```json
{
  "period": "2026-08", "plan": "starter",
  "used": {"writes": 340, "reads": 41200, "memories": 3108, "chats": 12},
  "limits": {"writes": 1000, "reads": 50000, "memories": 10000, "chats": 200},
  "exceeded": false
}
```

#### GET /v1/billing

Plan, wallet balance, rate card, and a recent statement in one read. Flushes accumulated debits to the Dodo credit-ledger mirror first, so the balance and the provider's own ledger agree.

```bash
curl -s "$GITLOOM_API/v1/billing" -H "Authorization: Bearer $GITLOOM_KEY"
```

```json
{
  "plan": "payg", "currency": "INR", "ledger": "dodo", "balance_paise": 44998,
  "min_recharge_paise": 50000,
  "rates_paise": {"writes": 50, "reads": 2, "chats": 100},
  "transactions": [{"amount_paise": -2, "note": "1 reads", "at": "2026-08-01T09:14:02Z"}]
}
```

#### POST /v1/billing/recharge

**Dashboard sessions only** — an API key must not mint checkout links in someone's name. Mints a hosted checkout link; payment happens on Dodo's page, this route never sees a card.

| field          | type    | notes                           |
| -------------- | ------- | ------------------------------- |
| `amount_paise` | integer | ₹500 minimum, ₹1,00,000 maximum |

```bash
curl -s -X POST "$GITLOOM_API/v1/billing/recharge" \
  -H "Authorization: Bearer $ID_TOKEN" -H "content-type: application/json" \
  -d '{"amount_paise": 50000}'
```

```json
{"payment_link": "https://checkout.dodopayments.com/...", "payment_id": "pay_..."}
```

`400 below_minimum` / `400 above_maximum` outside the range; `403 dashboard_only` for an API key; `503 merchant_not_live` if payments aren't switched on yet — not a client error, retrying won't help.

#### POST /v1/billing/subscribe

**Dashboard sessions only.** Mints a checkout link for a monthly plan; the plan takes effect once Dodo's webhook reports the subscription active, not at checkout click.

| field  | type   | notes                                      |
| ------ | ------ | ------------------------------------------ |
| `plan` | string | one of `starter`, `growth`, `scale`, `max` |

```bash
curl -s -X POST "$GITLOOM_API/v1/billing/subscribe" \
  -H "Authorization: Bearer $ID_TOKEN" -H "content-type: application/json" \
  -d '{"plan": "starter"}'
```

```json
{"payment_link": "https://checkout.dodopayments.com/..."}
```

`400 unknown_plan` for anything else. See [Plans and pricing](https://docs.gitloom.cloud/documentation/content/pricing) for what each meter costs, and [Billing FAQ](https://docs.gitloom.cloud/help-center/billing-faq) for what to do when a payment fails.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.gitloom.cloud/api-reference/usage-and-billing.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
