# Billing catalog promotion

Source: https://www.pontive.com/docs/api-reference/management/billing-catalog-promotion

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

Authentication: send `Authorization: Bearer <token>` with a secret key (`pontive_sk_…`, which implies its instance) or an access token issued for this API. A token that can reach several instances also names one with `X-Pontive-Instance-ID: inst_…`. Secret keys are for servers only.

## GET /v1/billing/catalog

```http
GET https://api.{region}.pontive.com/v1/billing/catalog
```

billing.catalog.v1.CatalogPromotionService/ExportCatalog (34-billing-catalog.md, Promoting a catalog between instances; API Surface; billing-svc docs/questions.md, P113). The whole catalog as one document keyed by key, never by id: { pontive_document: "billing-catalog/v1", event_types, meters, products, features, pricing_units, rate_cards, packages, catalog_rules } (api-route-review D47), every list in key order, written as billing-svc wrote it. Needs sys:billing:read, and answers while billing is off, as every read does.

Operation ID: `GetCatalog` · Capability: `billing`

### Responses

- `200` A billing-catalog/v1 document: object
- `401` Unauthorized: ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse
- `422` Unprocessable Entity: ErrResponse

## POST /v1/billing/catalog/import

```http
POST https://api.{region}.pontive.com/v1/billing/catalog/import
```

billing.catalog.v1.CatalogPromotionService/ImportCatalog (34-billing-catalog.md, Promoting a catalog between instances; API Surface; billing-svc docs/questions.md, P113). Body { document, dry_run, effective_at }: document is a billing-catalog/v1 document, passed to billing-svc byte for byte; dry_run is true when omitted, and returns the plan without applying it; with dry_run false the plan is applied in one transaction; effective_at (RFC 3339, default now) is when changed rates start. Answers the catalog_import_plan: dry_run, effective_at, created, changed, unchanged, absent (each { kind, key, fields }) and conflicts ({ kind, key, field, message }). An apply with conflicts is import_conflict, 409, with one details entry per conflict (field <kind>.<key>.<field>), and applies nothing. The body may be up to 6 MiB (an import document is at most 5 MB). Needs sys:billing:manage.

Operation ID: `ImportCatalog` · Capability: `billing`

### Header parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `X-Idempotency-Key` | string |  | Idempotency key, read on an apply only |

### Responses

- `200` A catalog_import_plan object: Object
- `401` Unauthorized: ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse
- `409` Conflict: ErrResponse
- `422` Unprocessable Entity: ErrResponse

## Schemas

### ErrResponse

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

### Object

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string |  | ID is its prefixed id. |
| `object` | string |  | Object names the kind: customer, invoice, contract, … |

### ErrBody

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string |  | Code is the spec's machine-readable code for this error, in snake case: a domain code such as seat_limit_reached where the refusal has one, otherwise a generic one such as permission_denied, not_found, conflict, invalid_request or service_unavailable. |
| `details` | ErrDetail[] |  | Details are per-field findings, present only on a refusal that has them, e.g. a 422 invalid_theme names each invalid value by its path, a 422 package_invalid each problem, and a 409 capability_in_use each count by its name. |
| `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` | "validation_error" \| "authentication_error" \| "authorization_error" \| "not_found" \| "conflict_error" \| "rate_limit_error" \| "internal_error" |  | Type is the error's category, set by its HTTP status: one of validation_error, authentication_error, authorization_error, not_found, conflict_error, rate_limit_error, internal_error. |

### ErrDetail

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `field` | string |  | Field is where the finding is: for a theme, its dotted path. |
| `message` | string |  | Message is what is wrong there. |
