# Billing

Source: https://www.pontive.com/docs/api-reference/platform/billing

Base URL: `https://api.pontive.com/v1` (operations that name another server say so).

## Get the billing account

```http
GET https://api.pontive.com/v1/workspaces/{workspace_id}/billing
```

The workspace's plan and billing interval, the plan a pending downgrade moves it to and when (scheduled_plan, scheduled_plan_at), what it holds (projects, seats, FGA instances, custom domains), what its plan grants, and the Free checklist. Pontive bills workspaces through billing-svc on the Directory instance: plan and interval changes, payment and invoices are billing's, in its portal on the dashboard's Billing page, not here. Any workspace member reads it.

Operation ID: `GetWorkspaceBilling`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `workspace_id` | string | yes | Workspace ID |

### Responses

- `200` OK: BillingAccount
- `403` Forbidden: ErrResponse
- `404` Not Found: ErrResponse

## Workspace usage

```http
GET https://api.pontive.com/v1/workspaces/{workspace_id}/usage
```

The current calendar month: every meter pooled across the workspace's instances against its plan's allowances and caps, split by project; tracked token counts; each project and instance. Nothing is priced here. Trails real time by up to 15 minutes.

Operation ID: `GetWorkspaceUsage`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `workspace_id` | string | yes | Workspace ID |

### Responses

- `200` OK: WorkspaceUsage
- `403` Forbidden: ErrResponse

## Schemas

### BillingAccount

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `billing_interval` | "monthly" \| "annual" |  | monthly or annual: the contract's billing frequency on a paid plan. |
| `custom_domains` | integer |  |  |
| `entitlements` | WorkspaceEntitlement |  | What the workspace's plan grants, as the console shows it. |
| `fga_instances` | integer |  | Production instances with Fine-Grained Authorization on, and custom auth domains. |
| `has_subscription` | boolean |  | Whether the workspace is on a paid plan. |
| `plan` | string |  | The workspace's plan, and when it last changed. It follows the package of the workspace's contract on the directory instance, changed in billing's portal on the Billing page. |
| `plan_changed_at` | string (date-time) |  |  |
| `projects` | ProjectCounts |  | Projects: the plan's included slots, the live ones, those beyond the slots, the b2b ones, the paused ones. |
| `scheduled_plan` | string |  | The plan of the contract's pending change: a downgrade waiting for the end of the period or the term. A pending change of billing interval alone is none. Null while none is pending. |
| `scheduled_plan_at` | string (date-time) |  | When the scheduled plan applies; null with no scheduled plan. |
| `scheduled_plan_blockers` | Blocker[] |  | The Free checklist (pontive-spec 10, Downgrade to Free): while a downgrade to Free is pending, what the workspace would hold that Free cannot; while a move to Free keeps it paused, what still does. Null otherwise. |
| `seats` | SeatCounts |  | Seats: the members, and the plan's included seats. A pending invitation holds no seat. |
| `workspace_id` | string |  |  |

### ErrResponse

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `error` | ErrBody |  |  |

### WorkspaceUsage

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `billing_interval` | "monthly" \| "annual" |  |  |
| `meters` | Record<string, MeterUsage> |  | Meters is every meter pooled across the workspace's instances, production and non-production alike, against the plan's allowances. |
| `period` | Period |  |  |
| `plan` | "free" |  |  |
| `projects` | ProjectLine[] |  |  |
| `reported_at` | string |  |  |
| `tracked` | Record<string, integer> |  | Tracked holds measured-only counters: tokens issued, by kind. |
| `workspace_id` | string |  |  |

### WorkspaceEntitlement

What the workspace's plan grants, as the console shows it.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `audit_log_retention_hours` | integer |  | How long the audit log's standard entries and the request log are kept, in hours. |
| `included_projects` | integer |  | Projects and seats the plan includes. |
| `included_seats` | integer |  |  |
| `max_non_prod_instances` | integer |  | Bounds each project's non-production instances; null is unlimited. |
| `modules_available` | string[] |  |  |
| `modules_non_production` | string[] |  |  |
| `name` | string |  |  |
| `plan` | string |  |  |
| `request_log_retention_hours` | integer |  |  |
| `usage` | Record<string, MeterPrice> |  |  |

### ProjectCounts

Projects: the plan's included slots, the live ones, those beyond the
slots, the b2b ones, the paused ones.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `additional` | integer |  |  |
| `b2b` | integer |  |  |
| `included` | integer |  |  |
| `live` | integer |  |  |
| `paused` | integer |  |  |

### Blocker

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `count` | integer |  |  |
| `kind` | "seats" \| "fga_instances" \| "custom_domains" |  |  |

### SeatCounts

Seats: the members, and the plan's included seats. A pending
invitation holds no seat.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `current` | integer |  |  |
| `included` | integer |  |  |

### ErrBody

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string |  | Code is a stable machine-readable identifier for this error: the domain code where one exists (e.g. slug_conflict, instance_not_found, confirmation_required), else the spec's generic code (invalid_request, permission_denied, not_found, conflict, internal_error). |
| `doc_url` | string |  | DocURL links to documentation about this error, when available. |
| `message` | string |  | Message is a human-readable description of what went wrong. |
| `object` | string |  | Object is the discriminator; always "error". |
| `param` | string |  | Param names the request parameter this error refers to, when applicable. |
| `type` | string |  | Type is the error's category, from its HTTP status: validation_error, authentication_error, authorization_error, not_found, conflict_error, rate_limit_error or internal_error. |

### MeterUsage

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `by_project` | Record<string, integer> |  |  |
| `cap` | integer |  |  |
| `included` | integer |  |  |
| `usage` | integer |  |  |

### Period

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `end` | string |  |  |
| `source` | string |  | Source is "calendar" (the UTC calendar month) or "contract" (the usage period of the workspace's contract on the directory instance, SourceContract). |
| `start` | string |  |  |

### ProjectLine

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `included` | boolean |  |  |
| `instances` | InstanceLine[] |  |  |
| `name` | string |  |  |
| `project_id` | string |  |  |
| `status` | string |  |  |
| `tenancy_mode` | string |  |  |

### MeterPrice

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `cap` | integer |  | A hard limit (quota_exceeded); null where there is none. |
| `included` | integer |  | The allowance before the meter bills; null where it is not billed. |
| `per` | integer |  | The unit the meter bills in beyond the allowance. |

### InstanceLine

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `custom_domains` | integer |  |  |
| `environment` | string |  |  |
| `fga` | boolean |  |  |
| `instance_id` | string |  |  |
| `meters` | Record<string, integer> |  |  |
| `name` | string |  |  |
| `reported_at` | string |  |  |
