> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gravitex.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Daily Bill Query

> Query daily bill consumption details and day-level summaries for reconciliation, cost analysis, and bill collection

<Info>
  Query **consumption details** and **day-level summaries** by date for reconciliation, cost analysis, and bill collection on the client side.
</Info>

## Endpoint info

| Item               | Description                         |
| ------------------ | ----------------------------------- |
| Base URL           | `https://maas.gravitex.ai/prod-api` |
| Content type       | `application/json`                  |
| Character encoding | `UTF-8`                             |
| Protocol           | `HTTPS` (required)                  |
| Currency           | `USD`                               |
| Billing timezone   | `utc+8`                             |

### Endpoints

| Endpoint            | URL                             | Purpose                                                              |
| ------------------- | ------------------------------- | -------------------------------------------------------------------- |
| Consumption details | `GET /api/logs/getDailyList`    | Returns details keyed by `(bill day × account × model × token type)` |
| Day summary         | `GET /api/logs/getDailySummary` | Returns net consumption summary keyed by `(bill day × account)`      |

## Authentication

All requests must include a Bearer credential in the HTTP header. **Either of the following credentials is accepted**:

| Credential type                                              | Description                                                                  |
| ------------------------------------------------------------ | ---------------------------------------------------------------------------- |
| [Access Token](https://maas.gravitex.ai/#/profile?tab=token) | Access token assigned to the account by the platform                         |
| [API Key](/cn/interface-module/token-management)             | API key created for the account by the platform, usually starting with `sk-` |

<ParamField header="Authorization" type="string" required>
  Format `Bearer <credential>`; use either credential above
</ParamField>

```http theme={null}
# Option 1: Access Token
Authorization: Bearer <access_token>

# Option 2: API Key
Authorization: Bearer sk-xxxxxxxxxxxxxxxxxxxx
```

Authentication failure returns HTTP `401` with business code `40100`.

<Warning>
  Do not log full keys in URLs, frontend code, logs, or support tickets.
</Warning>

## Common response structure

All endpoints return a unified structure:

```json theme={null}
{
  "code": 0,
  "message": "success",
  "data": {
    "total": 128,
    "rows": []
  }
}
```

| Field        | Type    | Description                                                     |
| ------------ | ------- | --------------------------------------------------------------- |
| `code`       | integer | Business status code; `0` means success, non-zero means failure |
| `message`    | string  | Status message                                                  |
| `data`       | object  | Business payload; `null` on failure                             |
| `data.total` | integer | Total matching rows (for pagination)                            |
| `data.rows`  | array   | Row list                                                        |

### Business error codes

| code  | HTTP status | Description                                                                      |
| ----- | ----------- | -------------------------------------------------------------------------------- |
| 0     | 200         | Success                                                                          |
| 40001 | 400         | Invalid format error (invalid date format, non-positive pagination params, etc.) |
| 40002 | 400         | Missing required parameter                                                       |
| 40003 | 400         | Invalid date range (`startDate` after `endDate`, or span exceeds the limit)      |
| 40100 | 401         | Token missing, invalid, or expired                                               |
| 50000 | 500         | Internal server error                                                            |

***

## Consumption details

```
GET https://maas.gravitex.ai/prod-api/api/logs/getDailyList
```

Returns consumption details keyed by `(bill day × account × model × token type)`.

### Query parameters

<ParamField query="startDate" type="string" required>
  Start date, format `yyyy-MM-dd`
</ParamField>

<ParamField query="endDate" type="string" required>
  End date, format `yyyy-MM-dd`; span with `startDate` must not exceed **92 days**
</ParamField>

<ParamField query="userId" type="string">
  Filter by account ID (multi-sub-account visibility requires Enterprise Management; see [Business rules](#business-rules)); omit to return accounts visible to the current credential
</ParamField>

<ParamField query="userName" type="string">
  Filter by account name, exact match (multi-sub-account visibility requires Enterprise Management; see [Business rules](#business-rules)); omit to return accounts visible to the current credential
</ParamField>

<ParamField query="pageSize" type="string" required>
  Page size as a positive integer string; range `1 ~ 100`; values over 100 are capped at 100
</ParamField>

<ParamField query="pageNum" type="string" required>
  Page number as a positive integer string, starting from `1`
</ParamField>

<Note>
  Pagination is by consumption detail row; `data.total` is the total number of matching detail rows.
</Note>

### Response row fields (`data.rows[]`)

| Field                   | Type   | Description                                                                                                                                                                                             |
| ----------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `billMonth`             | string | Billing month, format `yyyyMM`                                                                                                                                                                          |
| `billDay`               | string | Billing day, format `yyyy-MM-dd`                                                                                                                                                                        |
| `billingDateTimezone`   | string | Billing timezone, always `utc+8`                                                                                                                                                                        |
| `account`               | string | Account name                                                                                                                                                                                            |
| `modelType`             | string | Model category, e.g. `claude`, `gpt`, `gemini`, `qwen`, `deepseek`                                                                                                                                      |
| `modelName`             | string | Model name                                                                                                                                                                                              |
| `tokenType`             | string | Token type; see enum below                                                                                                                                                                              |
| `tokenCount`            | string | Token count for this type (integer as string)                                                                                                                                                           |
| `tokenUnit`             | string | Token unit, always `million` (priced per million tokens)                                                                                                                                                |
| `currency`              | string | Currency, always `USD`                                                                                                                                                                                  |
| `subtotalBeforeTax`     | string | Pre-discount, pre-tax amount (8 decimal places)                                                                                                                                                         |
| `subtotalAfterDiscount` | string | Post-discount, pre-tax amount (8 decimal places)                                                                                                                                                        |
| `totalAmountAfterTax`   | string | Post-discount, post-tax amount (8 decimal places)                                                                                                                                                       |
| `price`                 | string | Unit price: pre-discount price per **1 `tokenUnit` (i.e. per million tokens)** (8 decimal places). Formula: `subtotalBeforeTax = price × tokenCount ÷ 1,000,000`; may be omitted when `tokenCount` is 0 |
| `entryType`             | string | Entry type; `normal` means normal consumption                                                                                                                                                           |

### `tokenType` enum

| Value                   | Description                          |
| ----------------------- | ------------------------------------ |
| `textInputTokens`       | Text input tokens                    |
| `textOutputTokens`      | Text output tokens                   |
| `reasoningTokens`       | Reasoning / thinking tokens          |
| `cacheCreationTokens5m` | Cache creation tokens (5-minute TTL) |
| `cacheCreationTokens1h` | Cache creation tokens (1-hour TTL)   |
| `cacheTokens`           | Cache hit (read) tokens              |
| `imageInputTokens`      | Image input tokens                   |
| `imageOutputTokens`     | Image output tokens                  |
| `audioInputTokens`      | Audio input tokens                   |
| `audioOutputTokens`     | Audio output tokens                  |
| `videoInputTokens`      | Video input tokens                   |
| `videoOutputTokens`     | Video output tokens                  |

<Note>
  Sort order: `billDay` descending, then `account`, `modelName`, `tokenType`, `currency` ascending.
</Note>

### Request example

```bash theme={null}
curl "https://maas.gravitex.ai/prod-api/api/logs/getDailyList?startDate=2026-07-27&endDate=2026-07-27&pageSize=100&pageNum=1" \
  -H "Authorization: Bearer <your_token>"
```

### Response example

```json theme={null}
{
  "code": 0,
  "message": "success",
  "data": {
    "total": 23,
    "rows": [
      {
        "billMonth": "202607",
        "billDay": "2026-07-27",
        "billingDateTimezone": "utc+8",
        "account": "your_account",
        "modelType": "claude",
        "modelName": "claude-opus-4-8",
        "tokenType": "textOutputTokens",
        "tokenCount": "2931",
        "tokenUnit": "million",
        "currency": "USD",
        "subtotalBeforeTax": "0.07327564",
        "subtotalAfterDiscount": "0.07327564",
        "totalAmountAfterTax": "0.07327564",
        "price": "25.00021836",
        "entryType": "normal"
      }
    ]
  }
}
```

***

## Day summary

```
GET https://maas.gravitex.ai/prod-api/api/logs/getDailySummary
```

Returns day-level net consumption summaries. The payload is lighter than the details endpoint and is suited for bill overviews, daily trends, and monthly reports.

### Query parameters

<ParamField query="startDate" type="string" required>
  Start date, format `yyyy-MM-dd`
</ParamField>

<ParamField query="endDate" type="string" required>
  End date, format `yyyy-MM-dd`; span with `startDate` must not exceed **366 days**
</ParamField>

<ParamField query="userId" type="string">
  Filter by account ID (multi-sub-account visibility requires Enterprise Management; see [Business rules](#business-rules)); omit to return accounts visible to the current credential
</ParamField>

<ParamField query="userName" type="string">
  Filter by account name, exact match (multi-sub-account visibility requires Enterprise Management; see [Business rules](#business-rules)); omit to return accounts visible to the current credential
</ParamField>

<ParamField query="pageSize" type="string" required>
  Page size as a positive integer string; range `1 ~ 400`; values over 400 are capped at 400
</ParamField>

<ParamField query="pageNum" type="string" required>
  Page number as a positive integer string, starting from `1`
</ParamField>

<Note>
  Pagination is by `(bill day × account)`; `data.total` is the total number of matching combinations.
</Note>

### Response row fields (`data.rows[]`)

| Field                   | Type   | Description                                              |
| ----------------------- | ------ | -------------------------------------------------------- |
| `billMonth`             | string | Billing month, format `yyyyMM`                           |
| `billDay`               | string | Billing day, format `yyyy-MM-dd`                         |
| `billingDateTimezone`   | string | Billing timezone, always `utc+8`                         |
| `account`               | string | Account name                                             |
| `currency`              | string | Currency, always `USD`                                   |
| `subtotalBeforeTax`     | string | Day total, pre-discount pre-tax net (8 decimal places)   |
| `subtotalAfterDiscount` | string | Day total, post-discount pre-tax net (8 decimal places)  |
| `totalAmountAfterTax`   | string | Day total, post-discount post-tax net (8 decimal places) |

<Note>
  Sort order: `billDay` descending, then `account` ascending.
</Note>

### Request example

```bash theme={null}
curl "https://maas.gravitex.ai/prod-api/api/logs/getDailySummary?startDate=2026-07-01&endDate=2026-07-27&pageSize=31&pageNum=1" \
  -H "Authorization: Bearer <your_token>"
```

### Response example

```json theme={null}
{
  "code": 0,
  "message": "success",
  "data": {
    "total": 2,
    "rows": [
      {
        "billMonth": "202607",
        "billDay": "2026-07-27",
        "billingDateTimezone": "utc+8",
        "account": "your_account",
        "currency": "USD",
        "subtotalBeforeTax": "0.26569400",
        "subtotalAfterDiscount": "0.26569400",
        "totalAmountAfterTax": "0.26569400"
      }
    ]
  }
}
```

***

## Business rules

1. **Amount precision**: All amount fields are transmitted as `string` with 8 decimal places to avoid JSON number precision loss.
2. **Amount consistency**: For the same bill day and account, each day-summary amount field equals the sum of the corresponding detail amount fields for that day (sum across pages).
3. **Zero-consumption days**: Days with no consumption in the query range are omitted.
4. **Data lag**: Bill data is T+1 — the latest day's data becomes queryable the next day.
5. **Account scope and Enterprise Management**: By default, a credential can only query **its own account**. If the account has **Enterprise Management** enabled and is the primary account, it can see bills for **all sub-accounts** — omitting `userId`/`userName` returns all sub-accounts; providing them filters to a specific sub-account (a sub-account credential can only query itself). **Contact a platform admin to enable Enterprise Management.**
6. **Out-of-range pages**: When `pageNum` exceeds the total page count, `rows` is empty while `total` remains the true total.
