# Billing event types

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

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/event-types

```http
GET https://api.{region}.pontive.com/v1/billing/event-types
```

billing.metering.v1.EventTypeService/ListEventTypes (33-metering.md, API Surface, Event types; Event types and schemas; billing-svc docs/questions.md, P99). Served under /billing, since /v1/event-types is webhook-svc's (11-webhooks.md), as /v1/billing/events is (P32). The instance's event types, newest first.

Operation ID: `ListEventTypes` · Capability: `billing`

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `page` | integer |  | Page number, from 1 |
| `limit` | integer |  | Items per page, 1 to 100, default 25 |
| `status` | string |  | active or archived |
| `origin` | string |  | client or detected |

### Responses

- `200` A list of event_type objects with pagination: List
- `401` Unauthorized: ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse
- `422` Unprocessable Entity: ErrResponse

## POST /v1/billing/event-types

```http
POST https://api.{region}.pontive.com/v1/billing/event-types
```

billing.metering.v1.EventTypeService/CreateEventType (33-metering.md, API Surface, Event types; Event types and schemas; billing-svc docs/questions.md, P99). Served under /billing, since /v1/event-types is webhook-svc's (11-webhooks.md), as /v1/billing/events is (P32). Defines an event type before any event of its key is sent: origin client, validation warn unless given (none, warn or reject), auto_enrich true unless given. Each property is { key, type, required, description }, type string, number or boolean, up to 100. A key already used, detected or defined, is event_type_key_conflict; at the instance's limit of active event types, event_type_limit_reached.

Operation ID: `CreateEventType` · Capability: `billing`

### Header parameters

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

### Responses

- `201` An event_type object: Object
- `401` Unauthorized: ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse
- `409` event_type_key_conflict, event_type_limit_reached: ErrResponse
- `422` invalid_event_type_schema: ErrResponse

## POST /v1/billing/event-types/infer

```http
POST https://api.{region}.pontive.com/v1/billing/event-types/infer
```

billing.metering.v1.EventTypeService/InferEventType (33-metering.md, API Surface, Event types; Event types and schemas; billing-svc docs/questions.md, P99). Served under /billing, since /v1/event-types is webhook-svc's (11-webhooks.md), as /v1/billing/events is (P32). Takes { event }, one sample event as it would be sent, and answers a draft: the key, and one property per property of the sample with its value's type, each required false. Nothing is saved, so the draft has an empty id, null timestamps, and X-Idempotency-Key is not read; the client edits the draft and creates it.

Operation ID: `InferEventType` · Capability: `billing`

### Responses

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

## GET /v1/billing/event-types/{event_type}

```http
GET https://api.{region}.pontive.com/v1/billing/event-types/{event_type}
```

billing.metering.v1.EventTypeService/GetEventType (33-metering.md, API Surface, Event types; Event types and schemas; billing-svc docs/questions.md, P99). Served under /billing, since /v1/event-types is webhook-svc's (11-webhooks.md), as /v1/billing/events is (P32). An event type by its etyp_ id or its key. Each property carries its source, types_seen, first_seen_at and last_seen_at, read-only. An unknown one is event_type_not_found.

Operation ID: `GetEventType` · Capability: `billing`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `event_type` | string | yes | The event type's etyp_ id or its key (api-route-review D55) |

### Responses

- `200` An event_type object: Object
- `401` Unauthorized: ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse
- `404` event_type_not_found: ErrResponse

## PATCH /v1/billing/event-types/{event_type}

```http
PATCH https://api.{region}.pontive.com/v1/billing/event-types/{event_type}
```

billing.metering.v1.EventTypeService/UpdateEventType (33-metering.md, API Surface, Event types; Event types and schemas; billing-svc docs/questions.md, P99). Served under /billing, since /v1/event-types is webhook-svc's (11-webhooks.md), as /v1/billing/events is (P32). A field left out keeps its value; the key does not change. properties replaces the whole list: a property left out is removed, one set or changed becomes source client, and [] removes them all. properties, auto_enrich and validation may not be null. Removing a property a meter names, or changing its type away from number where a meter needs one, is event_type_property_in_use.

Operation ID: `UpdateEventType` · Capability: `billing`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `event_type` | string | yes | The event type's etyp_ id or its key (api-route-review D55) |

### Header parameters

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

### Responses

- `200` An event_type object: Object
- `401` Unauthorized: ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse
- `404` event_type_not_found: ErrResponse
- `409` event_type_property_in_use: ErrResponse
- `422` invalid_event_type_schema: ErrResponse

## POST /v1/billing/event-types/{event_type}/archive

```http
POST https://api.{region}.pontive.com/v1/billing/event-types/{event_type}/archive
```

billing.metering.v1.EventTypeService/ArchiveEventType (33-metering.md, API Surface, Event types; Event types and schemas; billing-svc docs/questions.md, P99). Served under /billing, since /v1/event-types is webhook-svc's (11-webhooks.md), as /v1/billing/events is (P32). Refused with event_type_in_use while a meter's current or future version names it. Events of an archived type are accepted with no check and no enrichment.

Operation ID: `ArchiveEventType` · Capability: `billing`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `event_type` | string | yes | The event type's etyp_ id or its key (api-route-review D55) |

### Header parameters

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

### Responses

- `200` An event_type object: Object
- `401` Unauthorized: ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse
- `404` event_type_not_found: ErrResponse
- `409` event_type_in_use: ErrResponse

## POST /v1/billing/event-types/{event_type}/unarchive

```http
POST https://api.{region}.pontive.com/v1/billing/event-types/{event_type}/unarchive
```

billing.metering.v1.EventTypeService/UnarchiveEventType (33-metering.md, API Surface, Event types; Event types and schemas; billing-svc docs/questions.md, P99). Served under /billing, since /v1/event-types is webhook-svc's (11-webhooks.md), as /v1/billing/events is (P32). At the instance's limit of active event types, refused with event_type_limit_reached.

Operation ID: `UnarchiveEventType` · Capability: `billing`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `event_type` | string | yes | The event type's etyp_ id or its key (api-route-review D55) |

### Header parameters

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

### Responses

- `200` An event_type object: Object
- `401` Unauthorized: ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse
- `404` event_type_not_found: ErrResponse
- `409` event_type_limit_reached: 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. |
