Check & consume quota
POST
/
v1
/
billing
/
entitlements
/
{feature_key}
/
consume
Check & consume quota
curl --request POST \
--url https://api.kerne.io/v1/billing/entitlements/{feature_key}/consume \
--header 'Content-Type: application/json' \
--header 'x-app-id: <api-key>' \
--data '
{
"delta": 123,
"idempotency_key": "<string>",
"dimension_id": "<string>"
}
'import requests
url = "https://api.kerne.io/v1/billing/entitlements/{feature_key}/consume"
payload = {
"delta": 123,
"idempotency_key": "<string>",
"dimension_id": "<string>"
}
headers = {
"x-app-id": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-app-id': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({delta: 123, idempotency_key: '<string>', dimension_id: '<string>'})
};
fetch('https://api.kerne.io/v1/billing/entitlements/{feature_key}/consume', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.kerne.io/v1/billing/entitlements/{feature_key}/consume",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'delta' => 123,
'idempotency_key' => '<string>',
'dimension_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-app-id: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.kerne.io/v1/billing/entitlements/{feature_key}/consume"
payload := strings.NewReader("{\n \"delta\": 123,\n \"idempotency_key\": \"<string>\",\n \"dimension_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-app-id", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.kerne.io/v1/billing/entitlements/{feature_key}/consume")
.header("x-app-id", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"delta\": 123,\n \"idempotency_key\": \"<string>\",\n \"dimension_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.kerne.io/v1/billing/entitlements/{feature_key}/consume")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-app-id"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"delta\": 123,\n \"idempotency_key\": \"<string>\",\n \"dimension_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"allowed": true,
"feature_key": "<string>",
"feature_type": "<string>",
"has_override": true,
"configured": true,
"enabled": true,
"limit": 123,
"used": 123,
"remaining": 123,
"overage_behavior": "<string>",
"access_limit": 123,
"billed_amount": 123,
"currency": "<string>",
"cap_reached": true,
"value": {},
"subscription_status": {}
}Authorizations
AppIdentifierJWT
App identifier (App.id, sent as the x-app-id header)
Path Parameters
Query Parameters
Response
200 - application/json
⌘I
Check & consume quota
curl --request POST \
--url https://api.kerne.io/v1/billing/entitlements/{feature_key}/consume \
--header 'Content-Type: application/json' \
--header 'x-app-id: <api-key>' \
--data '
{
"delta": 123,
"idempotency_key": "<string>",
"dimension_id": "<string>"
}
'import requests
url = "https://api.kerne.io/v1/billing/entitlements/{feature_key}/consume"
payload = {
"delta": 123,
"idempotency_key": "<string>",
"dimension_id": "<string>"
}
headers = {
"x-app-id": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-app-id': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({delta: 123, idempotency_key: '<string>', dimension_id: '<string>'})
};
fetch('https://api.kerne.io/v1/billing/entitlements/{feature_key}/consume', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.kerne.io/v1/billing/entitlements/{feature_key}/consume",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'delta' => 123,
'idempotency_key' => '<string>',
'dimension_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-app-id: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.kerne.io/v1/billing/entitlements/{feature_key}/consume"
payload := strings.NewReader("{\n \"delta\": 123,\n \"idempotency_key\": \"<string>\",\n \"dimension_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-app-id", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.kerne.io/v1/billing/entitlements/{feature_key}/consume")
.header("x-app-id", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"delta\": 123,\n \"idempotency_key\": \"<string>\",\n \"dimension_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.kerne.io/v1/billing/entitlements/{feature_key}/consume")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-app-id"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"delta\": 123,\n \"idempotency_key\": \"<string>\",\n \"dimension_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"allowed": true,
"feature_key": "<string>",
"feature_type": "<string>",
"has_override": true,
"configured": true,
"enabled": true,
"limit": 123,
"used": 123,
"remaining": 123,
"overage_behavior": "<string>",
"access_limit": 123,
"billed_amount": 123,
"currency": "<string>",
"cap_reached": true,
"value": {},
"subscription_status": {}
}
