Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/styles/base/Dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ crd
crds
created_at
creationTimestamp
CRMs
cronjob
CrowdStrike
cryptocurrency
Expand Down
2 changes: 1 addition & 1 deletion app/_data/schemas/frontmatter/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"type": "array",
"items": {
"type": "string",
"enum": ["ai-gateway", "gateway", "insomnia", "mesh", "kic", "catalog", "advanced-analytics", "dev-portal", "operator", "konnect", "event-gateway", "konnect-reference-platform"]
"enum": ["ai-gateway", "gateway", "insomnia", "mesh", "kic", "catalog", "advanced-analytics", "dev-portal", "operator", "konnect", "event-gateway", "konnect-reference-platform", "metering-and-billing"]
}
},
"tools": {
Expand Down
12 changes: 12 additions & 0 deletions app/_indices/metering-and-billing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
title: Metering and Billing Documentation Index
sections:
- title: Reference
items:
- path: /metering-and-billing/
- path: /metering-and-billing/**/*
auto_exclude: true
- title: How-Tos
items:
- type: how-to
products:
- metering-and-billing
14 changes: 14 additions & 0 deletions app/_landing_pages/metering-and-billing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
metadata:
title: "Metering and Billing"
content_type: landing_page
description: Learn how to meter and bill for your features with Metering and Billing.
breadcrumbs:
- /metering-and-billing/
products:
- metering-and-billing

rows:
- header:
type: h1
text: "Metering and Billing"
sub_text: Turn any events, logs, and metrics into revenue with usage-based metering and billing.
96 changes: 96 additions & 0 deletions app/metering-and-billing/subjects.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
---
title: "Subjects"
content_type: reference
description: "Learn how subjects work in {{site.konnect_short_name}} Metering and Billing and how they relate to usage tracking and external billing systems."
layout: reference
products:
- metering-and-billing
tools:
- konnect-api
works_on:
- konnect
breadcrumbs:
- /metering-and-billing/
related_resources:
- text: "{{site.konnect_short_name}} Metering and Billing"
url: /metering-and-billing/

---

## What is a subject?

Subjects represent the entity that consume metered resources in {{site.konnect_short_name}} Metering and Billing. Billable events ingested to Metering and Billing have a subject associated with them.

A subject can represent any unique event in your system, such as:
* Customer ID or User ID
* Hostname or IP address
* Service or application name
* Device ID

The subject model is intentionally generic, enabling flexible application across different metering scenarios.
In most implementations, a subject maps 1:1 with a customer or user in your system. You can use the same identifier for both, but they can differ if your usage producer and billing entity are not the same. For example:
* One customer may have multiple usage-producing subjects
* A single subject’s usage may need to be billed to a different customer

You can also have multiple subjects assigned to a customer. This abstraction allows you to group usage data and billing for a customer. For example, a customer can have multiple subjects like `department1` or `department2`:

{% mermaid %}
flowchart TD

subgraph a ["Customer Kong Air"]
subject1["Subject"]
end

subgraph Customer-ACME Inc
subject2["Subject (Department 1)"]
subject3["Subject (Department 2)"]
end

subject1 --> UsageEvents1["Usage Events"]
subject2 --> UsageEvents2["Usage Events"]
subject3 --> UsageEvents3["Usage Events"]
{% endmermaid %}

{:.info}
> We recommend creating a subject when a new customer or user is created in your system and deleting a subject when a customer or user is deleted. Keeping the subjects in sync in Metering and Billing is necessary if you synchronize usage to external systems, such as Stripe billing or CRMs, as {{site.konnect_short_name}} knows the mapping between the subject and the external system.
> {{site.konnect_short_name}} Metering and Billing will also automatically create a subject for you when you ingest an usage event for a new subject.

## How do subjects work?

{{site.konnect_short_name}} Metering and Billing uses subjects to:

* Associate usage with external systems (for example, Stripe or CRM tools)
* Store descriptive metadata
* Identify the entity producing metered events

Each subject contains the following fields:

* **Key** – The subject’s unique identifier
* **Display name** – A human-readable label shown in the UI
* **Metadata** – Optional key-value attributes for additional context


## Data ingestion

When shipping data to {{site.konnect_short_name}} you must include the subject within the events payload:

```ts
{
"specversion": "1.0",
"type": "api-calls",
"id": "00002",
"time": "2023-01-01T00:00:00.001Z",
"source": "service-0",
"subject": "customer-1",
"data": {...}
}
```


## Schema

[Insert Schema here](https://openmeter.io/docs/api/cloud#tag/subjects)

## Set up a subject

CRUD a subject here
1 change: 1 addition & 0 deletions jekyll.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ operator_product_name_short: KO
event_gateway: Kong Event Gateway
event_gateway_short: Event Gateway
konnect_catalog: Catalog
metering_and_billing: Metering & Billing

repos:
developer: https://github.com/Kong/developer.konghq.com
Expand Down
Loading