# CSV & JSON imports

Upload usage, billing or revenue files, with column reference and example files.

AI Spendbook documentation, Your app's data. Web page: https://www.aispendbook.com/docs/csv-imports

Upload a file, choose its type, confirm the suggested column mapping, and review validation results. Rejected rows are listed with their row numbers before anything is written. Importing the same rows again doesn't create duplicates, because rows are keyed by `event_id` or a stable hash. Files can be up to 4 MB.

## AWS billing export (Bedrock)

An AWS Cost and Usage Report CSV. Only Amazon Bedrock lines are kept; other rows are left out and counted. Columns map themselves.

| Column | Required | Meaning |
| --- | --- | --- |
| date | yes | lineItem/UsageStartDate. |
| service | yes | lineItem/ProductCode. |
| cost | yes | lineItem/UnblendedCost. |
| usage_type |  | lineItem/UsageType. |
| currency |  | lineItem/CurrencyCode. |
| end_date |  | lineItem/UsageEndDate. |
| charge_type |  | Tax lines are left out. |
| account_id |  | lineItem/UsageAccountId. |
| description |  | lineItem/LineItemDescription. |

```csv

```

## Azure billing export (Azure OpenAI)

An Azure Cost Management actual-cost export CSV. Only Azure OpenAI and Foundry Models lines are kept; other rows are left out and counted.

| Column | Required | Meaning |
| --- | --- | --- |
| date | yes | Date or UsageDateTime. |
| service | yes | MeterCategory. |
| cost | yes | CostInBillingCurrency, PreTaxCost or Cost. |
| sub_service |  | MeterSubCategory. |
| usage_type |  | MeterName. |
| currency |  | BillingCurrencyCode. |
| charge_type |  | ChargeType. |
| account_id |  | SubscriptionId. |
| description |  | ProductName. |

```csv

```

## Provider costs / invoices

Provider cost exports or invoice lines. Stored as billed spend, which is the source of truth for totals.

| Column | Required | Meaning |
| --- | --- | --- |
| date | yes | Billing day or period start. |
| provider | yes | anthropic, openai, google, … |
| cost | yes | Charged amount (in the row's currency). |
| currency |  | ISO code; defaults to USD. |
| model |  | If the line is model-specific. |
| line_item |  | Invoice description / SKU. |
| cost_type |  | tokens, web_search, code_execution, … |
| project_id |  | Provider project id. |
| workspace_id |  | Provider workspace id. |
| end_date |  | Period end, if a line spans several days. |
| event_id |  | Stable id; otherwise a hash of the row is used. |

```csv

```

## Provider token usage

Token usage aggregates per day, model and project, as exported from a provider console.

| Column | Required | Meaning |
| --- | --- | --- |
| date | yes | Usage day. |
| provider | yes | anthropic, openai, … |
| model | yes | Model id. |
| input_tokens |  | Uncached input tokens. |
| output_tokens |  | Output tokens. |
| cache_read_tokens |  | Prompt-cache reads. |
| cache_write_tokens |  | Prompt-cache writes. |
| request_count |  | Number of requests. |
| project_id |  | Provider project id. |
| service_tier |  | standard, batch, priority, … |
| event_id |  | Stable id; otherwise a hash of the row is used. |

```csv

```

## Model usage summary

Requests, tokens and reported cost per model and period.

| Column | Required | Meaning |
| --- | --- | --- |
| date | yes | Period day. |
| model | yes | Model id. |
| request_count | yes | Number of requests. |
| provider |  | Inferred from the model when missing. |
| input_tokens |  | Input tokens. |
| output_tokens |  | Output tokens. |
| cost |  | Reported cost. |
| currency |  | ISO code; defaults to USD. |
| project_id |  | Project id. |
| event_id |  | Stable id; otherwise a hash of the row is used. |

```csv

```

## Request-level records

One row per model call, for example a log export. Enables attribution by customer, feature and user.

| Column | Required | Meaning |
| --- | --- | --- |
| timestamp | yes | When the call happened (with a time zone, or set one in options). |
| model | yes | Model id. |
| provider |  | Inferred from the model when missing. |
| input_tokens |  | Uncached input tokens. |
| output_tokens |  | Output tokens. |
| cache_read_tokens |  | Prompt-cache reads. |
| cache_write_tokens |  | Prompt-cache writes. |
| customer_id |  | Your customer/account id. |
| end_user_id |  | Individual user id. |
| feature |  | Feature / workflow that made the call. |
| category |  | Usage category. |
| request_id |  | Provider request id (de-duplication). |
| cost |  | Your recorded cost, if any. |
| currency |  | ISO code; defaults to USD. |
| status |  | success / error / HTTP status. |
| latency_ms |  | Latency in milliseconds. |
| event_id |  | Stable id; otherwise a hash of the row is used. |

```csv

```

## Customer mappings

Maps external ids (for example Stripe customer ids) to your customer_id.

| Column | Required | Meaning |
| --- | --- | --- |
| external_id | yes | Id in the other system. |
| customer_id | yes | Your customer id used on usage. |
| customer_name |  | Display name. |
| source |  | System the external id comes from. |

```csv

```

## Monthly provider invoices

One row per provider invoice: month, provider and amount. Stored as billed spend for the whole month, so forecasts, budgets and spend by provider work from the first upload.

| Column | Required | Meaning |
| --- | --- | --- |
| month | yes | YYYY-MM, or any date in the invoiced month. |
| provider | yes | anthropic, openai, google, … |
| amount | yes | Invoice total for the month. |
| currency |  | ISO code; defaults to USD. |
| invoice_id |  | Optional; shown as the line item. |

```csv

```

## Customer, feature and plan names

Display names for the customer and feature ids in your telemetry and for plan ids (such as Stripe product ids), shown on margin, statements and analytics tables.

| Column | Required | Meaning |
| --- | --- | --- |
| id | yes | The customer id or feature id as it appears in telemetry, or the plan id. |
| name | yes | The name to show. |
| kind |  | customer, feature or plan; customer when missing. |

```csv

```

## Customer revenue

Monthly revenue per customer, used for AI cost as a share of revenue and margin after AI.

| Column | Required | Meaning |
| --- | --- | --- |
| customer_id | yes | Must match customer_id on usage. |
| month | yes | YYYY-MM (or a date in the month). |
| revenue | yes | Revenue for the month. |
| currency |  | ISO code; defaults to USD. |

```csv
customer_id,month,revenue_usd,customer_name
acme,2026-10,12000.00,Acme Corp
globex,2026-10,4500.00,Globex
```

Timestamps need a time zone (ISO-8601 with an offset, or epoch seconds or milliseconds). If yours have none, set “assume time zone” in the mapping options. Money is in US dollars unless the file has a currency column and you enter a rate.

- No admin key yet? The **Monthly provider invoices** type takes one row per month and provider. Each row is billed cost for the whole month, dated on its first day, so spend by provider, forecasts and budgets work after the first upload.
- A mapping that validates is remembered for the next file with the same import type and the same column names, and that file is pre-filled.
- Import history has Undo on committed imports: it removes the ledger records, revenue, customer mappings and names the import wrote.
- Card statements, seat lists and non-token cost files have their own uploads: see [cards, AP and contracts](https://www.aispendbook.com/docs/cards-ap-and-contracts), [seat connectors](https://www.aispendbook.com/docs/seat-connectors) and [voice, audio and RAG cost](https://www.aispendbook.com/docs/voice-and-audio).
