Skip to main content
GET
Bill Query

Overview

Two read-only billing endpoints: day summaries for net spend trends, and line items broken down by model × token type. Amounts are always USD, billing timezone is utc+8, and data is T+1.

Consumption details

getDailyList: grain (bill day × account × model × token type). Max span 92 days per request; pageSize capped at 100.

Day summary

getDailySummary: grain (bill day × account). Max span 366 days per request; pageSize capped at 400.

Endpoints

Authentication

Send a Bearer credential in the request header — either option works:
Auth failure: HTTP 401, business code 40100.
Never put a full key in URLs, frontend code, logs, or support tickets.

Common response

Business error codes


Details · getDailyList

Returns rows keyed by (bill day × account × model × token type).

Request parameters

string
required
Start date, yyyy-MM-dd
string
required
End date, yyyy-MM-dd; span with startDate must not exceed 92 days
string
Filter by account ID. Multi-sub-account visibility requires Enterprise Management — see Conventions. Omit to return accounts visible to the current credential.
string
Filter by account name (exact). Same Enterprise Management rules; omit to return accounts visible to the current credential.
string
required
Positive integer string, 1 ~ 100; values over 100 are capped at 100
string
required
Positive integer string, starting at 1
Pagination is by detail row; data.total is the total number of matching detail rows.

Response fields (data.rows[])

tokenType

Sort: billDay desc, then account, modelName, tokenType, currency asc.

Request example

Response example


Day summary · getDailySummary

Day-level net spend. Lighter payload — suited for overviews and trend reports.

Request parameters

string
required
Start date, yyyy-MM-dd
string
required
End date, yyyy-MM-dd; span with startDate must not exceed 366 days
string
Filter by account ID (same Enterprise Management rules as details)
string
Filter by account name, exact (same Enterprise Management rules as details)
string
required
Positive integer string, 1 ~ 400; values over 400 are capped at 400
string
required
Positive integer string, starting at 1
Pagination is by (bill day × account); data.total is the combination count.

Response fields (data.rows[])

Sort: billDay desc, then account asc.

Request example

Response example


Conventions

  1. Amounts: Always string with 8 decimal places — use Decimal / BigDecimal; do not convert to binary floats.
  2. Consistency: For the same bill day and account, each day-summary amount equals the sum of the matching detail amounts that day (sum across pages).
  3. Zero days: Days with no consumption in the range are omitted.
  4. Freshness: Bills are T+1 — the latest day is queryable the next day.
  5. Account scope: Default is own account only. A primary account with Enterprise Management can see all sub-accounts — omit userId / userName for all, or pass them to filter; a sub-account credential only sees itself. Contact a TenndaAI admin to enable Enterprise Management.
  6. Out-of-range pages: When pageNum exceeds total pages, rows is empty while total remains the true total.