# Billing invoices

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

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/invoices

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

billing.invoice.v1.InvoiceService/ListInvoices (37-invoicing.md, API Surface).

Operation ID: `ListInvoices` · Capability: `billing`

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `page` | integer |  | Page number, from 1 |
| `limit` | integer |  | Items per page, 1 to 100, default 25 |
| `customer_id` | string |  | A cust_ id |
| `contract_id` | string |  | A ctr_ id |
| `status` | string |  | status |
| `kind` | string |  | kind |
| `from` | string |  | RFC 3339 time |
| `to` | string |  | RFC 3339 time |
| `number` | string |  | number |

### Responses

- `200` A list of Invoice objects with pagination: List
- `401` Unauthorized: ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse
- `404` Not Found: ErrResponse
- `409` Conflict: ErrResponse
- `422` Unprocessable Entity: ErrResponse

## POST /v1/billing/invoices

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

billing.invoice.v1.InvoiceService/CreateInvoice (37-invoicing.md, API Surface).

Operation ID: `CreateInvoice` · Capability: `billing`

### Header parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `X-Idempotency-Key` | string |  | Idempotency key |

### Responses

- `201` A Invoice object: Object
- `401` Unauthorized: ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse
- `404` Not Found: ErrResponse
- `409` Conflict: ErrResponse
- `422` Unprocessable Entity: ErrResponse

## GET /v1/billing/invoices/upcoming

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

billing.invoice.v1.InvoiceService/GetUpcomingInvoice (37-invoicing.md, API Surface).

Operation ID: `GetUpcomingInvoice` · Capability: `billing`

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `contract_id` | string |  | A ctr_ id |

### Responses

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

## GET /v1/billing/invoices/{invoice_id}

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

billing.invoice.v1.InvoiceService/GetInvoice (37-invoicing.md, API Surface).

Operation ID: `GetInvoice` · Capability: `billing`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `invoice_id` | string | yes | id_or_number |

### Responses

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

## PATCH /v1/billing/invoices/{invoice_id}

```http
PATCH https://api.{region}.pontive.com/v1/billing/invoices/{invoice_id}
```

billing.invoice.v1.InvoiceService/UpdateInvoice (37-invoicing.md, API Surface).

Operation ID: `UpdateInvoice` · Capability: `billing`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `invoice_id` | string | yes | id |

### Header parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `X-Idempotency-Key` | string |  | Idempotency key |

### Responses

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

## POST /v1/billing/invoices/{invoice_id}/finalize

```http
POST https://api.{region}.pontive.com/v1/billing/invoices/{invoice_id}/finalize
```

billing.invoice.v1.InvoiceService/FinalizeInvoice (37-invoicing.md, API Surface).

Operation ID: `FinalizeInvoice` · Capability: `billing`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `invoice_id` | string | yes | id |

### Header parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `X-Idempotency-Key` | string |  | Idempotency key |

### Responses

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

## GET /v1/billing/invoices/{invoice_id}/lines

```http
GET https://api.{region}.pontive.com/v1/billing/invoices/{invoice_id}/lines
```

billing.invoice.v1.InvoiceService/ListInvoiceLines (37-invoicing.md, API Surface).

Operation ID: `ListInvoiceLines` · Capability: `billing`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `invoice_id` | string | yes | id |

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `page` | integer |  | Page number, from 1 |
| `limit` | integer |  | Items per page, 1 to 100, default 25 |
| `product_id` | string |  | A product id |

### Responses

- `200` A list of Line objects with pagination: List
- `401` Unauthorized: ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse
- `404` Not Found: ErrResponse
- `409` Conflict: ErrResponse
- `422` Unprocessable Entity: ErrResponse

## POST /v1/billing/invoices/{invoice_id}/mark-uncollectible

```http
POST https://api.{region}.pontive.com/v1/billing/invoices/{invoice_id}/mark-uncollectible
```

billing.invoice.v1.InvoiceService/MarkInvoiceUncollectible (37-invoicing.md, API Surface).

Operation ID: `MarkInvoiceUncollectible` · Capability: `billing`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `invoice_id` | string | yes | id |

### Header parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `X-Idempotency-Key` | string |  | Idempotency key |

### Responses

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

## POST /v1/billing/invoices/{invoice_id}/pay

```http
POST https://api.{region}.pontive.com/v1/billing/invoices/{invoice_id}/pay
```

billing.invoice.v1.InvoiceService/PayInvoice (37-invoicing.md, API Surface).

Operation ID: `PayInvoice` · Capability: `billing`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `invoice_id` | string | yes | id |

### Header parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `X-Idempotency-Key` | string |  | Idempotency key |

### Responses

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

## GET /v1/billing/invoices/{invoice_id}/pdf

```http
GET https://api.{region}.pontive.com/v1/billing/invoices/{invoice_id}/pdf
```

billing.invoice.v1.InvoiceService/GetInvoicePdf (37-invoicing.md, API Surface; The document). The invoice's PDF as a download, not an envelope: Content-Type application/pdf and Content-Disposition attachment with the file name billing-svc gives, {number}.pdf. A voided invoice's is the VOID rendition (billing-svc docs/questions.md, X158); a draft has none (not_found). locale is not read until documents are localized.

Operation ID: `GetInvoicePdf` · Capability: `billing`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `invoice_id` | string | yes | id |

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `locale` | string |  | locale |

### Responses

- `200` The PDF: file, file
- `401` Unauthorized: ErrResponse, ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse
- `404` Not Found: ErrResponse, ErrResponse
- `422` Unprocessable Entity: ErrResponse, ErrResponse

## POST /v1/billing/invoices/{invoice_id}/recompute

```http
POST https://api.{region}.pontive.com/v1/billing/invoices/{invoice_id}/recompute
```

billing.invoice.v1.InvoiceService/RecomputeInvoice (37-invoicing.md, API Surface).

Operation ID: `RecomputeInvoice` · Capability: `billing`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `invoice_id` | string | yes | id |

### Header parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `X-Idempotency-Key` | string |  | Idempotency key |

### Responses

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

## POST /v1/billing/invoices/{invoice_id}/send

```http
POST https://api.{region}.pontive.com/v1/billing/invoices/{invoice_id}/send
```

billing.invoice.v1.InvoiceService/SendInvoice (37-invoicing.md, API Surface; Emails). Sends the invoice issued email again, with its PDF, to the Customer's email as it is now, whatever the emails toggles say. A draft, held or void invoice is invoice_not_open (billing-svc docs/questions.md, X163). X-Idempotency-Key is passed through. The body takes no field.

Operation ID: `SendInvoice` · Capability: `billing`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `invoice_id` | string | yes | id |

### Header parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `X-Idempotency-Key` | string |  | Idempotency key |

### Responses

- `200` The Invoice object: object
- `401` Unauthorized: ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse
- `404` Not Found: ErrResponse
- `409` Conflict: ErrResponse
- `422` Unprocessable Entity: ErrResponse

## GET /v1/billing/invoices/{invoice_id}/usage-detail

```http
GET https://api.{region}.pontive.com/v1/billing/invoices/{invoice_id}/usage-detail
```

billing.invoice.v1.InvoiceService/GetInvoiceUsageCsv (37-invoicing.md, API Surface; The document). One row per rated usage line (billing-svc docs/questions.md, X157), as a download, not an envelope: Content-Type text/csv; charset=utf-8 and Content-Disposition attachment with the file name billing-svc gives, {number}-usage-detail.csv.

Operation ID: `GetInvoiceUsageCsv` · Capability: `billing`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `invoice_id` | string | yes | id |

### Responses

- `200` The CSV: file, file
- `401` Unauthorized: ErrResponse, ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse
- `404` Not Found: ErrResponse, ErrResponse
- `422` Unprocessable Entity: ErrResponse, ErrResponse

## POST /v1/billing/invoices/{invoice_id}/void

```http
POST https://api.{region}.pontive.com/v1/billing/invoices/{invoice_id}/void
```

billing.invoice.v1.InvoiceService/VoidInvoice (37-invoicing.md, API Surface).

Operation ID: `VoidInvoice` · Capability: `billing`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `invoice_id` | string | yes | id |

### Header parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `X-Idempotency-Key` | string |  | Idempotency key |

### Responses

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

## Schemas

### List

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | Object[] |  |  |
| `object` | string |  |  |
| `pagination` | Pagination |  | Pagination is the page answered (api-route-review D9). |

### 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, … |

### Pagination

Pagination is the page answered (api-route-review D9).

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `limit` | integer |  | Limit is the maximum number of items per page. |
| `page` | integer |  | Page is the 1-based index of the returned page. |
| `total` | integer |  | Total is the total number of items across all pages. |
| `total_pages` | integer |  | TotalPages is the total number of pages available. |

### 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. |
