Create customer entitlement grant
Changed onPre-release Endpoint This endpoint is currently in beta and is subject to change.
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.
Request
- Base URLhttps://global.api.konghq.com
- Auth
- HTTP bearer
- or HTTP bearer
- or HTTP bearer
- or HTTP bearer
Path parameters
ULID (Universally Unique Lexicographically Sortable Identifier).
ULID (Universally Unique Lexicographically Sortable Identifier).
Request body
A grant to issue for a metered entitlement.
The amount to grant, in the feature's unit. Must be positive.
The priority of the grant. Lower values have higher priority. Grants are consumed in priority order, then by closest expiration, then by earliest creation.
The time the grant becomes effective and the anchor for recurring grants. The value is truncated to the start of the minute.
The duration after which the grant expires, counted from effective_at. Only single-unit durations are accepted, such as PT12H, P7D, P2W, P3M, or P1Y. If omitted, the grant never expires.
The maximum balance carried over at reset. The balance after a reset is MIN(max_rollover_amount, MAX(balance_before_reset, min_rollover_amount)). Defaults to amount.
The minimum balance carried over at reset. The balance after a reset is MIN(max_rollover_amount, MAX(balance_before_reset, min_rollover_amount)). Defaults to 0.
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 "_".
The recurrence of the grant. When set, the amount is issued again every interval. The anchor defaults to effective_at.
Example request
{
"amount": "100",
"priority": 1,
"effective_at": "2023-01-01T01:01:01.001Z",
"expires_after": "P1M",
"max_rollover_amount": "100",
"min_rollover_amount": "0",
"labels": {
"env": "test"
},
"recurrence": {
"interval": "P1M",
"anchor": "2023-01-01T01:01:01.001Z"
}
}Response
EntitlementGrant created response.
A grant issued for a metered entitlement. Each grant adds its amount to the entitlement's balance from its effective time until it expires, and usage is deducted from the grants in priority order.
Grants are immutable, so the balance is deterministic regardless of when it is queried. Deleting a grant ends it at the time of the deletion.
ULID (Universally Unique Lexicographically Sortable Identifier).
The ID of the entitlement the grant belongs to.
The ID of the customer the grant belongs to.
The granted amount, in the feature's unit.
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.
The time the grant takes effect.
The duration after which the grant expires, counted from effective_at. Always a single-unit duration (for example PT12H, P7D, P2W, P3M, P1Y). Absent when the grant never expires.
The time the grant expires, calculated from effective_at and expires_after. The grant is no longer in effect from this time. Absent when the grant never expires.
The maximum balance the grant carries over at reset. The balance after a reset is MIN(max_rollover_amount, MAX(balance_before_reset, min_rollover_amount)).
The minimum balance the grant carries over at reset. The balance after a reset is MIN(max_rollover_amount, MAX(balance_before_reset, min_rollover_amount)).
The recurrence of the grant. When set, the grant amount is re-issued every interval from the anchor, which defaults to effective_at. Absent for non-recurring grants.
The next time the grant recurs. Absent for non-recurring grants.
The time the grant was voided. A voided grant is no longer in effect from this time.
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 "_".
An ISO-8601 timestamp representation of entity creation date.
An ISO-8601 timestamp representation of entity last update date.
An ISO-8601 timestamp representation of entity deletion date.
Example response
{
"id": "01G65Z755AFWAKHE12NY0CQ9FH",
"entitlement_id": "01G65Z755AFWAKHE12NY0CQ9FH",
"customer_id": "01G65Z755AFWAKHE12NY0CQ9FH",
"amount": "100",
"priority": 1,
"effective_at": "2023-01-01T01:01:01.001Z",
"expires_after": "P1M",
"expires_at": "2023-02-01T01:01:01.001Z",
"max_rollover_amount": "100",
"min_rollover_amount": "0",
"recurrence": {
"anchor": "2023-01-01T01:01:01.001Z",
"interval": "P1M"
},
"next_recurrence": "2023-02-01T01:01:01.001Z",
"voided_at": "2023-01-15T01: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
- breaking
added to the
invalid_parameters/itemsresponse propertyoneOflist for the response status - warning
added the new
key_invalidenum value to theinvalid_parameters/items/oneOf[#/components/schemas/InvalidParameterStandard]/ruleresponse property for the response status - warning
added the new
uniqueenum value to theinvalid_parameters/items/oneOf[#/components/schemas/InvalidParameterStandard]/ruleresponse property for the response status
- breaking