OpenMeter Entitlements

Create customer entitlement grant

Changed on

Issue a grant for a metered entitlement of the customer. Boolean and static entitlements cannot have grants, so the request is rejected for them.

Grants are immutable. The amount is added to the balance from effective_at, which cannot be earlier than the start of the current usage period.

post/openmeter/customers/{customerId}/entitlements/{entitlementId}/grants

Request

  • Base URL: http://localhost:8888/api/v3
  • URL: http://localhost:8888/api/v3/openmeter/customers/{customerId}/entitlements/{entitlementId}/grants
  • Auth: none declared

Path parameters

customerIdstring required

ULID (Universally Unique Lexicographically Sortable Identifier).

Example:01G65Z755AFWAKHE12NY0CQ9FH
entitlementIdstring required

ULID (Universally Unique Lexicographically Sortable Identifier).

Example:01G65Z755AFWAKHE12NY0CQ9FH

Request body

amountstring required

Numeric represents an arbitrary precision number.

priorityinteger

The priority of the grant. Lower values have higher priority. Grants are consumed in priority order, then by closest expiration, then by earliest creation.

effective_atstring date-time required

RFC3339 formatted date-time string in UTC.

expires_afterstring ISO8601
max_rollover_amountstring

Numeric represents an arbitrary precision number.

min_rollover_amountstring

Numeric represents an arbitrary precision number.

labelsLabels

Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types.

Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_".

Example request

{
  "priority": 1,
  "effective_at": "2023-01-01T01:01:01.001Z",
  "expires_after": "P1Y",
  "labels": {
    "env": "test"
  },
  "recurrence": {
    "interval": "P1Y",
    "anchor": "2023-01-01T01:01:01.001Z"
  }
}

Response

EntitlementGrant created response.

idstring required

ULID (Universally Unique Lexicographically Sortable Identifier).

entitlement_idstring required

ULID (Universally Unique Lexicographically Sortable Identifier).

customer_idstring

ULID (Universally Unique Lexicographically Sortable Identifier).

amountstring required

Numeric represents an arbitrary precision number.

priorityinteger required

The priority of the grant. Lower values are consumed first: a grant with priority 1 is consumed before one with priority 2. Among equal priorities, the grant closest to expiration is consumed first, then the earliest created.

effective_atstring date-time required

RFC3339 formatted date-time string in UTC.

expires_afterstring ISO8601
expires_atstring date-time

RFC3339 formatted date-time string in UTC.

max_rollover_amountstring required

Numeric represents an arbitrary precision number.

min_rollover_amountstring required

Numeric represents an arbitrary precision number.

next_recurrencestring date-time

RFC3339 formatted date-time string in UTC.

voided_atstring date-time

RFC3339 formatted date-time string in UTC.

labelsLabels

Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types.

Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_".

created_atstring date-time required

RFC3339 formatted date-time string in UTC.

updated_atstring date-time required

RFC3339 formatted date-time string in UTC.

deleted_atstring date-time

RFC3339 formatted date-time string in UTC.

Example response

{
  "id": "01G65Z755AFWAKHE12NY0CQ9FH",
  "entitlement_id": "01G65Z755AFWAKHE12NY0CQ9FH",
  "customer_id": "01G65Z755AFWAKHE12NY0CQ9FH",
  "priority": 1,
  "effective_at": "2023-01-01T01:01:01.001Z",
  "expires_after": "P1Y",
  "expires_at": "2023-01-01T01:01:01.001Z",
  "recurrence": {
    "anchor": "2023-01-01T01:01:01.001Z",
    "interval": "P1Y"
  },
  "next_recurrence": "2023-01-01T01:01:01.001Z",
  "voided_at": "2023-01-01T01:01:01.001Z",
  "labels": {
    "env": "test"
  },
  "created_at": "2023-01-01T01:01:01.001Z",
  "updated_at": "2023-01-01T01:01:01.001Z",
  "deleted_at": "2023-01-01T01:01:01.001Z"
}

Changes