> For the complete documentation index, see [llms.txt](https://help.blotato.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.blotato.com/api/credits.md).

# Credits

Blotato credits pay for AI generations such as videos and images. Use these endpoints to check your remaining credit balance, see current pricing, and buy more credits. Two endpoints:

* [Get Credit Balance](#get-credit-balance) — `GET /v2/credits`
* [Buy Credits](#buy-credits) — `POST /v2/credits`

Credits belong to a single account and are non-transferable. Confirm the account email from [Get Credit Balance](#get-credit-balance) before you buy, so the credits land on the account you intend.

***

## Get Credit Balance

### Endpoint

**Base URL:** `https://backend.blotato.com/v2`

**URL:** `/credits`

**Method:** `GET`

### Description

Returns your remaining credits, the email of the account the API key belongs to, and current purchase pricing.

### Response

**Status Code:** `200 OK`

| Field                    | Type      | Description                                                        |
| ------------------------ | --------- | ------------------------------------------------------------------ |
| `creditsRemaining`       | `integer` | Credits left on the account.                                       |
| `accountEmail`           | `string`  | Email of the account the API key belongs to.                       |
| `purchaseQuantityRange`  | `object`  | Allowed purchase range, with `min` and `max` credits per purchase. |
| `pricePer1000CreditsUsd` | `number`  | Price in US dollars per 1,000 credits.                             |

Example response:

```json
{
  "creditsRemaining": 54688,
  "accountEmail": "user@example.com",
  "purchaseQuantityRange": { "min": 1000, "max": 10000 },
  "pricePer1000CreditsUsd": 6.0
}
```

### Errors

| Status | Reason                      |
| ------ | --------------------------- |
| `401`  | Missing or invalid API key. |
| `500`  | Server error.               |

***

## Buy Credits

### Endpoint

**URL:** `/credits`

**Method:** `POST`

### Description

Creates a Stripe Checkout link to buy credits. Creating the link does not charge anything. The account owner opens the link in a browser and completes payment there, and the purchased credits land on this account. Buy between 1,000 and 10,000 credits per request.

Confirm the account email from [Get Credit Balance](#get-credit-balance) first, since credits are non-transferable between accounts.

### Request Body

| Field      | Type      | Required | Description                               |
| ---------- | --------- | -------- | ----------------------------------------- |
| `quantity` | `integer` | Yes      | Credits to buy. Between 1,000 and 10,000. |
| `referral` | `string`  | No       | Optional referral code.                   |

### Response

**Status Code:** `201 Created`

| Field         | Type     | Description                                                                                                |
| ------------- | -------- | ---------------------------------------------------------------------------------------------------------- |
| `checkoutUrl` | `string` | Stripe Checkout URL. Open it in a browser to complete payment. No charge happens until checkout completes. |

Example response:

```json
{
  "checkoutUrl": "https://checkout.stripe.com/c/pay/cs_test_123"
}
```

### Errors

| Status | Reason                                                                             |
| ------ | ---------------------------------------------------------------------------------- |
| `400`  | The quantity is outside the 1,000 to 10,000 range, or the request body is invalid. |
| `401`  | Missing or invalid API key.                                                        |
| `429`  | Rate limit exceeded (10 requests per hour).                                        |
| `500`  | Server error.                                                                      |

***

## Pricing

Credits cost $6.00 per 1,000 credits. Read the current price from [Get Credit Balance](#get-credit-balance) (`pricePer1000CreditsUsd`), since pricing changes over time.


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.blotato.com/api/credits.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
