# API reference: Billing

[Guide index](../../v1.md) · [API reference](../api-reference.md) · [Developer API](../api.md)

## `GET /v1/companies/{companyId}/billing`

| Parameter | In | Type | Required | Notes |
|---|---|---|---|---|
| `companyId` | path | string (uuid) | yes |  |

Answers 200 with `BillingAccount`.

## `GET /v1/companies/{companyId}/billing/ledger`

| Parameter | In | Type | Required | Notes |
|---|---|---|---|---|
| `companyId` | path | string (uuid) | yes |  |
| `page` | query | integer (int32) |  |  |
| `size` | query | integer (int32) |  |  |

Answers 200 with list of LedgerEntry.

## `GET /v1/companies/{companyId}/billing/price-changes`

| Parameter | In | Type | Required | Notes |
|---|---|---|---|---|
| `companyId` | path | string (uuid) | yes |  |

Answers 200 with list of PriceChange.

## `GET /v1/companies/{companyId}/billing/requests`

| Parameter | In | Type | Required | Notes |
|---|---|---|---|---|
| `companyId` | path | string (uuid) | yes |  |
| `all` | query | boolean |  |  |

Answers 200 with list of BillingRequestResponse.

## `POST /v1/companies/{companyId}/billing/requests`

| Parameter | In | Type | Required | Notes |
|---|---|---|---|---|
| `companyId` | path | string (uuid) | yes |  |

Body (application/json): `SendBillingRequest`

Answers 201 with `BillingRequestResponse`.

## Types

**BillingAccount**

| Field | Type | Required | Notes |
|---|---|---|---|
| `companyId` | string (uuid) | yes |  |
| `currency` | string | yes |  |
| `balance` | number | yes |  |
| `plan` | Plan |  |  |
| `nextPlan` | Plan |  |  |
| `periodStart` | string (date-time) |  |  |
| `periodEnd` | string (date-time) |  |  |
| `actionsUsed` | integer (int64) | yes |  |
| `llmUsed` | number | yes |  |
| `emailsUsed` | integer (int64) | yes |  |
| `overageCharged` | number | yes |  |
| `monthlyCap` | number |  |  |
| `refusal` | string |  |  |
| `paymentInstructions` | string |  |  |
| `storageBytes` | integer (int64) | yes |  |
| `extraStoragePrice` | number |  |  |
| `owed` | number | yes |  |
| `grants` | list of CreditGrant | yes |  |
| `packages` | list of CreditPackage | yes |  |
| `trialEndsAt` | string (date-time) |  |  |
| `trialRefused` | string |  |  |

**LedgerEntry**

| Field | Type | Required | Notes |
|---|---|---|---|
| `id` | string (uuid) | yes |  |
| `kind` | string | yes |  |
| `amount` | number | yes |  |
| `balanceAfter` | number | yes |  |
| `quantity` | number |  |  |
| `note` | string |  |  |
| `actor` | string |  |  |
| `at` | string (date-time) | yes |  |
| `usedValue` | number |  |  |
| `includedValue` | number |  |  |
| `allowanceLeft` | number |  |  |
| `ourCost` | number |  |  |

**PriceChange**

| Field | Type | Required | Notes |
|---|---|---|---|
| `id` | string (uuid) | yes |  |
| `subject` | `SETTINGS` \| `PLAN` \| `PACKAGE` \| `OFFERING` \| `EMBEDDING` | yes |  |
| `subjectId` | string (uuid) |  |  |
| `subjectName` | string | yes |  |
| `up` | boolean | yes |  |
| `lines` | list of ChangeLine | yes |  |
| `effectiveFrom` | string (date-time) | yes |  |
| `status` | `SCHEDULED` \| `APPLIED` \| `CANCELLED` | yes |  |
| `appliedAt` | string (date-time) |  |  |
| `cancelledAt` | string (date-time) |  |  |
| `notified` | integer (int32) | yes |  |
| `createdAt` | string (date-time) | yes |  |

**BillingRequestResponse**

| Field | Type | Required | Notes |
|---|---|---|---|
| `id` | string (uuid) | yes |  |
| `companyId` | string (uuid) | yes |  |
| `companyName` | string | yes |  |
| `planId` | string (uuid) |  |  |
| `planName` | string |  |  |
| `planMonthlyFee` | number |  |  |
| `months` | integer (int32) |  |  |
| `packageId` | string (uuid) |  |  |
| `packageName` | string |  |  |
| `packagePrice` | number |  |  |
| `message` | string |  |  |
| `status` | `PENDING` \| `ACKNOWLEDGED` \| `RESOLVED` | yes |  |
| `createdByType` | string | yes |  |
| `createdByName` | string |  |  |
| `createdAt` | string (date-time) | yes |  |
| `acknowledgedAt` | string (date-time) |  |  |
| `resolvedAt` | string (date-time) |  |  |

**SendBillingRequest**

| Field | Type | Required | Notes |
|---|---|---|---|
| `planId` | string (uuid) |  |  |
| `months` | integer (int32) |  | from 1; up to 12 |
| `packageId` | string (uuid) |  |  |
| `message` | string |  | at most 2000 characters |

**CreditGrant**

| Field | Type | Required | Notes |
|---|---|---|---|
| `id` | string (uuid) | yes |  |
| `kind` | `PAID` \| `BONUS` \| `FREE` \| `TRIAL` | yes |  |
| `amount` | number | yes |  |
| `remaining` | number | yes |  |
| `expiresAt` | string (date-time) |  |  |
| `packageName` | string |  |  |
| `note` | string |  |  |
| `createdAt` | string (date-time) | yes |  |

**CreditPackage**

| Field | Type | Required | Notes |
|---|---|---|---|
| `id` | string (uuid) | yes |  |
| `name` | string | yes |  |
| `price` | number | yes |  |
| `baseCredits` | number | yes |  |
| `bonusPercent` | number |  |  |
| `bonusValidDays` | integer (int32) |  |  |
| `active` | boolean | yes |  |
| `createdAt` | string (date-time) | yes |  |
| `updatedAt` | string (date-time) | yes |  |
| `totalCredits` | number | yes |  |
| `bonusCredits` | number | yes |  |

**ChangeLine**

| Field | Type | Required | Notes |
|---|---|---|---|
| `field` | string | yes |  |
| `label` | string | yes |  |
| `from` | string | yes |  |
| `to` | string | yes |  |
| `unit` | string | yes |  |
