# Billing fields

The GraphQL API billing endpoint, `https://api.azion.com/v4/billing/graphql`, serves three datasets: `balanceFinancialEntry`, `paymentsClientDebt`, and `billDetail`. The table of each dataset lists the fields a query can select, with the type the schema declares. Send the query in a `POST` request with the header `Authorization: Token [TOKEN VALUE]`.

> **Note**
>
> The billing endpoint of the GraphQL API is available only to *Online Sales* accounts.

Every billing dataset accepts the `filter`, `aggregate`, `groupBy`, `orderBy`, `offset`, and `limit` arguments, with `limit` set to `10` and `offset` to `0` by default. The arguments are described on [Datasets and query arguments](/en/documentation/devtools/graphql/features/).

---

## balanceFinancialEntry

The `balanceFinancialEntry` dataset holds the financial entries of an account, such as debits and trial credits, with the amount and currency of each one:

| Field            | Type   | Description                                                                                                      |
| ---------------- | ------ | ---------------------------------------------------------------------------------------------------------------- |
| `clientId`       | String | Unique identifier of the client on Azion. Example: `8437r`.                                                      |
| `entryType`      | String | Type of the financial entry. Examples: `debit`, `trial_credit`, `remaining_trial_credit`, `closing_month_debit`. |
| `description`    | String | Description of the entry that appears on the client bill and invoice. Can be an empty string.                    |
| `amount`         | Float  | Amount registered in the financial entry, in the currency of `currency`. Examples: `18750`, `0.04`.              |
| `currency`       | String | Currency of the financial entry. Examples: `BRL`, `USD`.                                                         |
| `created`        | Date   | Date the financial entry was created.                                                                            |
| `expirationDate` | Date   | Date the financial entry expires.                                                                                |

A `balanceFinancialEntry` query needs no filter. This query returns up to five financial entries of the account:

```graphql
query {
  balanceFinancialEntry(limit: 5) {
    clientId
    entryType
    description
    amount
    currency
  }
}
```

The response is cut after the third row:

```json
{
  "data": {
    "balanceFinancialEntry": [
      {
        "clientId": "1234u",
        "entryType": "remaining_trial_credit",
        "description": "",
        "amount": 0.0,
        "currency": "USD"
      },
      {
        "clientId": "1234u",
        "entryType": "trial_credit",
        "description": "",
        "amount": 0.0,
        "currency": "USD"
      },
      {
        "clientId": "1234u",
        "entryType": "debit",
        "description": "",
        "amount": 0.04,
        "currency": "USD"
      },
      …
    ]
  }
}
```

---

## paymentsClientDebt

The `paymentsClientDebt` dataset holds the client debts of an account: the amount owed for an accounted period, and the date and card of its payment:

| Field             | Type   | Description                                                                                       |
| ----------------- | ------ | ------------------------------------------------------------------------------------------------- |
| `clientId`        | String | Unique identifier of the client on Azion. Example: `8437r`.                                       |
| `created`         | Date   | Date the client debt was created, in year-month-day format. Example: `2023-07-31`.                |
| `amount`          | Float  | Total value accounted for the client debt, in the currency of `currency`. Examples: `625`, `0.0`. |
| `currency`        | String | Currency of the client debt. Examples: `BRL`, `USD`.                                              |
| `startDate`       | Date   | Start date of the accounted period, in year-month-day format. Example: `2022-06-01`.              |
| `endDate`         | Date   | End date of the accounted period, in year-month-day format. Example: `2022-06-30`.                |
| `paymentDate`     | Date   | Date of the client payment, in year-month-day format. Example: `2023-07-10`.                      |
| `cardBrand`       | String | Brand of the card the client used for the payment. Example: `VISA`.                               |
| `cardLast4Digits` | String | Last four digits of the client card. Example: `4456`.                                             |

A `paymentsClientDebt` query needs no filter. This query returns up to five client debts of the account, with the period each one covers:

```graphql
query {
  paymentsClientDebt(limit: 5) {
    clientId
    created
    amount
    currency
    startDate
    endDate
  }
}
```

The response holds one row per client debt:

```json
{
  "data": {
    "paymentsClientDebt": [
      {
        "clientId": "1234u",
        "created": "2026-08-02",
        "amount": 0.0,
        "currency": "USD",
        "startDate": "2026-07-01",
        "endDate": "2026-07-31"
      }
    ]
  }
}
```

---

## billDetail

The `billDetail` dataset holds the bill details of an account. Each row is the usage accounted for one product, metric, and region in a billing period, with its bill and invoice:

| Field           | Type    | Description                                                                                    |
| --------------- | ------- | ---------------------------------------------------------------------------------------------- |
| `clientId`      | String  | Unique identifier of the client. Example: `0001a`.                                             |
| `periodFrom`    | Date    | Start date of the accounted period, in year-month-day format. Example: `2023-07-01`.           |
| `periodTo`      | Date    | End date of the accounted period, in year-month-day format. Example: `2023-07-31`.             |
| `productSlug`   | String  | Identifier of the product. Examples: `edge_functions`, `application`.                          |
| `metricSlug`    | String  | Identifier of the metric. Examples: `invocations`, `data_transferred`.                         |
| `regionName`    | String  | Region where the metric was accounted. Example: `Brazil`.                                      |
| `accounted`     | Float   | Total usage accounted for the bill detail. Examples: `1767504904`, `0.024962217`.              |
| `billId`        | Int     | Unique identifier of the bill. Example: `1000`.                                                |
| `billDetailId`  | Int     | Unique identifier of the bill detail. Example: `100000`.                                       |
| `createdDate`   | Date    | Creation date of the bill, in year-month-day format. Example: `2023-07-01`.                    |
| `temporaryBill` | Boolean | Whether the bill is for the current month, which makes it temporary. Example: `false`.         |
| `invoiceNumber` | String  | Unique identifier of the invoice generated for the client bill. Example: `BRLTDA-2769z072023`. |
| `value`         | Decimal | Monetary value of the bill detail.                                                             |
| `totalValue`    | Decimal | Total monetary value of the bill.                                                              |
| `currency`      | String  | Currency of the monetary values.                                                               |

This query returns up to five bill details whose period starts inside the range set in `periodFromRange`:

```graphql
query {
  billDetail(limit: 5, filter: { periodFromRange: { begin: "2026-01-01", end: "2026-10-01" } }) {
    clientId
    periodFrom
    periodTo
    productSlug
    metricSlug
    accounted
  }
}
```

The response holds five rows, cut here after the third:

```json
{
  "data": {
    "billDetail": [
      {
        "clientId": "1234u",
        "periodFrom": "2026-07-01",
        "periodTo": "2026-07-31",
        "productSlug": "application",
        "metricSlug": "data_transferred",
        "accounted": 0.0
      },
      {
        "clientId": "1234u",
        "periodFrom": "2026-07-01",
        "periodTo": "2026-07-31",
        "productSlug": "application",
        "metricSlug": "data_transferred",
        "accounted": 0.0
      },
      {
        "clientId": "1234u",
        "periodFrom": "2026-07-01",
        "periodTo": "2026-07-31",
        "productSlug": "application",
        "metricSlug": "data_transferred",
        "accounted": 0.024962217
      },
      …
    ]
  }
}
```

---

## Related resources

- [Queries](/en/documentation/devtools/graphql/queries.md): The query shape for financial data, with the endpoints that serve billed and accounted amounts.
- [Datasets and query arguments](/en/documentation/devtools/graphql/features.md): The datasets of each endpoint and the filter, sort, and pagination arguments a query accepts.
- [Accounting fields](/en/documentation/devtools/graphql/gql-accounting-fields.md): The fields of `accountingDetail`, the accounted amounts per period on the accounting endpoint.
- [Billing](/en/documentation/fundamentals/billing-and-subscriptions.md): How Azion bills the usage of its products and keeps an account active.
