# Billing customers

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

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

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

billing.customer.v1.CustomerService/ListCustomers (32-billing-overview.md, API Surface).

Operation ID: `ListCustomers` · Capability: `billing`

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `page` | integer |  | Page number, from 1 |
| `limit` | integer |  | Items per page, 1 to 100, default 25 |
| `subject_type` | string |  | subject_type |
| `subject_id` | string |  | subject_id |
| `ingest_alias` | string |  | ingest_alias |
| `status` | string |  | status |
| `email` | string |  | email |
| `invoicing_status` | string |  | invoicing_status |
| `time_machine_id` | string |  | time_machine_id |

### Responses

- `200` A list of Customer 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/customers

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

billing.customer.v1.CustomerService/CreateCustomer (32-billing-overview.md, API Surface; Customer). tax_status is auto, taxable, exempt or reverse_charge; left out, it is auto: billing decides reverse charge, and taxable forces tax (billing-svc docs/questions.md, P104, P105).

Operation ID: `CreateCustomer` · Capability: `billing`

### Header parameters

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

### Responses

- `201` A Customer 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/customers/{customer_id}

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

billing.customer.v1.CustomerService/GetCustomer (32-billing-overview.md, API Surface).

Operation ID: `GetCustomer` · Capability: `billing`

### Path parameters

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

### Responses

- `200` A Customer 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/customers/{customer_id}

```http
PATCH https://api.{region}.pontive.com/v1/billing/customers/{customer_id}
```

billing.customer.v1.CustomerService/UpdateCustomer (32-billing-overview.md, API Surface; Customer). tax_status is auto, taxable, exempt or reverse_charge (billing-svc docs/questions.md, P105).

Operation ID: `UpdateCustomer` · Capability: `billing`

### Path parameters

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

### Header parameters

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

### Responses

- `200` A Customer 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/customers/{customer_id}/anonymize

```http
POST https://api.{region}.pontive.com/v1/billing/customers/{customer_id}/anonymize
```

billing.customer.v1.CustomerService/AnonymizeCustomer (32-billing-overview.md, Customers, Anonymizing). Removes a settled Customer's personal data for a GDPR erasure: its name becomes the given one (default "Deleted customer"); its email, billing address, tax ids, locale, ingest aliases and metadata are cleared; its payment methods are detached on the provider; it is archived and its anonymized_at set. Its id, subject and history stay, and its issued invoices keep their documents, the tax record. Refused with customer_in_use while a contract has not ended or an invoice is a draft, held or open. Idempotent and irreversible: later writes are customer_anonymized.

Operation ID: `AnonymizeCustomer` · Capability: `billing`

### Path parameters

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

### Header parameters

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

### Responses

- `200` A Customer 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
- `503` Service Unavailable: ErrResponse

## POST /v1/billing/customers/{customer_id}/archive

```http
POST https://api.{region}.pontive.com/v1/billing/customers/{customer_id}/archive
```

billing.customer.v1.CustomerService/ArchiveCustomer (32-billing-overview.md, API Surface).

Operation ID: `ArchiveCustomer` · Capability: `billing`

### Path parameters

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

### Header parameters

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

### Responses

- `200` A Customer 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/customers/{customer_id}/change-subject

```http
POST https://api.{region}.pontive.com/v1/billing/customers/{customer_id}/change-subject
```

billing.customer.v1.CustomerService/ChangeCustomerSubject (32-billing-overview.md, Changing the subject). Re-points the Customer from user to organization, or from external to user or organization; the new subject must have no Customer of its own.

Operation ID: `ChangeCustomerSubject` · Capability: `billing`

### Path parameters

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

### Header parameters

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

### Responses

- `200` A Customer 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/customers/{customer_id}/unarchive

```http
POST https://api.{region}.pontive.com/v1/billing/customers/{customer_id}/unarchive
```

billing.customer.v1.CustomerService/UnarchiveCustomer (32-billing-overview.md, API Surface).

Operation ID: `UnarchiveCustomer` · Capability: `billing`

### Path parameters

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

### Header parameters

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

### Responses

- `200` A Customer 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. |
