curl --request POST \
--url https://api.hyperline.co/v1/aggregators \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"entity": "api_calls",
"operation": "count",
"type": "metered",
"where": {
"fields": [
{
"property": "<string>"
}
]
},
"formula_sql": "<string>",
"name": "<string>",
"description": "<string>",
"allow_negative_values": false,
"aggregate_on_customers_enabled": false,
"custom_event_name": "<string>",
"exposed_event_keys": [
"<string>"
],
"unit_name": "user",
"default_interval_count": 123,
"thresholds": [
{
"threshold_value": 123,
"name": "<string>",
"comparison_operator": "gte"
}
]
}
'import requests
url = "https://api.hyperline.co/v1/aggregators"
payload = {
"entity": "api_calls",
"operation": "count",
"type": "metered",
"where": { "fields": [{ "property": "<string>" }] },
"formula_sql": "<string>",
"name": "<string>",
"description": "<string>",
"allow_negative_values": False,
"aggregate_on_customers_enabled": False,
"custom_event_name": "<string>",
"exposed_event_keys": ["<string>"],
"unit_name": "user",
"default_interval_count": 123,
"thresholds": [
{
"threshold_value": 123,
"name": "<string>",
"comparison_operator": "gte"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
entity: 'api_calls',
operation: 'count',
type: 'metered',
where: {fields: [{property: '<string>'}]},
formula_sql: '<string>',
name: '<string>',
description: '<string>',
allow_negative_values: false,
aggregate_on_customers_enabled: false,
custom_event_name: '<string>',
exposed_event_keys: ['<string>'],
unit_name: 'user',
default_interval_count: 123,
thresholds: [{threshold_value: 123, name: '<string>', comparison_operator: 'gte'}]
})
};
fetch('https://api.hyperline.co/v1/aggregators', 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.hyperline.co/v1/aggregators",
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([
'entity' => 'api_calls',
'operation' => 'count',
'type' => 'metered',
'where' => [
'fields' => [
[
'property' => '<string>'
]
]
],
'formula_sql' => '<string>',
'name' => '<string>',
'description' => '<string>',
'allow_negative_values' => false,
'aggregate_on_customers_enabled' => false,
'custom_event_name' => '<string>',
'exposed_event_keys' => [
'<string>'
],
'unit_name' => 'user',
'default_interval_count' => 123,
'thresholds' => [
[
'threshold_value' => 123,
'name' => '<string>',
'comparison_operator' => 'gte'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.hyperline.co/v1/aggregators"
payload := strings.NewReader("{\n \"entity\": \"api_calls\",\n \"operation\": \"count\",\n \"type\": \"metered\",\n \"where\": {\n \"fields\": [\n {\n \"property\": \"<string>\"\n }\n ]\n },\n \"formula_sql\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"allow_negative_values\": false,\n \"aggregate_on_customers_enabled\": false,\n \"custom_event_name\": \"<string>\",\n \"exposed_event_keys\": [\n \"<string>\"\n ],\n \"unit_name\": \"user\",\n \"default_interval_count\": 123,\n \"thresholds\": [\n {\n \"threshold_value\": 123,\n \"name\": \"<string>\",\n \"comparison_operator\": \"gte\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.hyperline.co/v1/aggregators")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"entity\": \"api_calls\",\n \"operation\": \"count\",\n \"type\": \"metered\",\n \"where\": {\n \"fields\": [\n {\n \"property\": \"<string>\"\n }\n ]\n },\n \"formula_sql\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"allow_negative_values\": false,\n \"aggregate_on_customers_enabled\": false,\n \"custom_event_name\": \"<string>\",\n \"exposed_event_keys\": [\n \"<string>\"\n ],\n \"unit_name\": \"user\",\n \"default_interval_count\": 123,\n \"thresholds\": [\n {\n \"threshold_value\": 123,\n \"name\": \"<string>\",\n \"comparison_operator\": \"gte\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hyperline.co/v1/aggregators")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"entity\": \"api_calls\",\n \"operation\": \"count\",\n \"type\": \"metered\",\n \"where\": {\n \"fields\": [\n {\n \"property\": \"<string>\"\n }\n ]\n },\n \"formula_sql\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"allow_negative_values\": false,\n \"aggregate_on_customers_enabled\": false,\n \"custom_event_name\": \"<string>\",\n \"exposed_event_keys\": [\n \"<string>\"\n ],\n \"unit_name\": \"user\",\n \"default_interval_count\": 123,\n \"thresholds\": [\n {\n \"threshold_value\": 123,\n \"name\": \"<string>\",\n \"comparison_operator\": \"gte\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"entity": "<string>",
"operation": "count",
"property": "<string>",
"where": {
"conditional": "and",
"fields": [
{
"property": "<string>",
"operator": "isNull"
}
]
},
"type": "metered",
"name": "<string>",
"description": "<string>",
"allow_negative_values": true,
"aggregate_on_customers_enabled": true,
"default_interval_count": 123,
"default_interval_period": "days",
"custom_event_name": "<string>",
"exposed_event_keys": [
"<string>"
],
"unit_name": "<string>",
"thresholds": [
{
"id": "<string>",
"name": "<string>",
"threshold_value": 123,
"comparison_operator": "gte"
}
],
"created_at": "2023-12-25",
"updated_at": "2023-12-25",
"formula_sql": "<string>"
}Create aggregator
Create a new aggregator.
curl --request POST \
--url https://api.hyperline.co/v1/aggregators \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"entity": "api_calls",
"operation": "count",
"type": "metered",
"where": {
"fields": [
{
"property": "<string>"
}
]
},
"formula_sql": "<string>",
"name": "<string>",
"description": "<string>",
"allow_negative_values": false,
"aggregate_on_customers_enabled": false,
"custom_event_name": "<string>",
"exposed_event_keys": [
"<string>"
],
"unit_name": "user",
"default_interval_count": 123,
"thresholds": [
{
"threshold_value": 123,
"name": "<string>",
"comparison_operator": "gte"
}
]
}
'import requests
url = "https://api.hyperline.co/v1/aggregators"
payload = {
"entity": "api_calls",
"operation": "count",
"type": "metered",
"where": { "fields": [{ "property": "<string>" }] },
"formula_sql": "<string>",
"name": "<string>",
"description": "<string>",
"allow_negative_values": False,
"aggregate_on_customers_enabled": False,
"custom_event_name": "<string>",
"exposed_event_keys": ["<string>"],
"unit_name": "user",
"default_interval_count": 123,
"thresholds": [
{
"threshold_value": 123,
"name": "<string>",
"comparison_operator": "gte"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
entity: 'api_calls',
operation: 'count',
type: 'metered',
where: {fields: [{property: '<string>'}]},
formula_sql: '<string>',
name: '<string>',
description: '<string>',
allow_negative_values: false,
aggregate_on_customers_enabled: false,
custom_event_name: '<string>',
exposed_event_keys: ['<string>'],
unit_name: 'user',
default_interval_count: 123,
thresholds: [{threshold_value: 123, name: '<string>', comparison_operator: 'gte'}]
})
};
fetch('https://api.hyperline.co/v1/aggregators', 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.hyperline.co/v1/aggregators",
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([
'entity' => 'api_calls',
'operation' => 'count',
'type' => 'metered',
'where' => [
'fields' => [
[
'property' => '<string>'
]
]
],
'formula_sql' => '<string>',
'name' => '<string>',
'description' => '<string>',
'allow_negative_values' => false,
'aggregate_on_customers_enabled' => false,
'custom_event_name' => '<string>',
'exposed_event_keys' => [
'<string>'
],
'unit_name' => 'user',
'default_interval_count' => 123,
'thresholds' => [
[
'threshold_value' => 123,
'name' => '<string>',
'comparison_operator' => 'gte'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.hyperline.co/v1/aggregators"
payload := strings.NewReader("{\n \"entity\": \"api_calls\",\n \"operation\": \"count\",\n \"type\": \"metered\",\n \"where\": {\n \"fields\": [\n {\n \"property\": \"<string>\"\n }\n ]\n },\n \"formula_sql\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"allow_negative_values\": false,\n \"aggregate_on_customers_enabled\": false,\n \"custom_event_name\": \"<string>\",\n \"exposed_event_keys\": [\n \"<string>\"\n ],\n \"unit_name\": \"user\",\n \"default_interval_count\": 123,\n \"thresholds\": [\n {\n \"threshold_value\": 123,\n \"name\": \"<string>\",\n \"comparison_operator\": \"gte\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.hyperline.co/v1/aggregators")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"entity\": \"api_calls\",\n \"operation\": \"count\",\n \"type\": \"metered\",\n \"where\": {\n \"fields\": [\n {\n \"property\": \"<string>\"\n }\n ]\n },\n \"formula_sql\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"allow_negative_values\": false,\n \"aggregate_on_customers_enabled\": false,\n \"custom_event_name\": \"<string>\",\n \"exposed_event_keys\": [\n \"<string>\"\n ],\n \"unit_name\": \"user\",\n \"default_interval_count\": 123,\n \"thresholds\": [\n {\n \"threshold_value\": 123,\n \"name\": \"<string>\",\n \"comparison_operator\": \"gte\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hyperline.co/v1/aggregators")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"entity\": \"api_calls\",\n \"operation\": \"count\",\n \"type\": \"metered\",\n \"where\": {\n \"fields\": [\n {\n \"property\": \"<string>\"\n }\n ]\n },\n \"formula_sql\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"allow_negative_values\": false,\n \"aggregate_on_customers_enabled\": false,\n \"custom_event_name\": \"<string>\",\n \"exposed_event_keys\": [\n \"<string>\"\n ],\n \"unit_name\": \"user\",\n \"default_interval_count\": 123,\n \"thresholds\": [\n {\n \"threshold_value\": 123,\n \"name\": \"<string>\",\n \"comparison_operator\": \"gte\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"entity": "<string>",
"operation": "count",
"property": "<string>",
"where": {
"conditional": "and",
"fields": [
{
"property": "<string>",
"operator": "isNull"
}
]
},
"type": "metered",
"name": "<string>",
"description": "<string>",
"allow_negative_values": true,
"aggregate_on_customers_enabled": true,
"default_interval_count": 123,
"default_interval_period": "days",
"custom_event_name": "<string>",
"exposed_event_keys": [
"<string>"
],
"unit_name": "<string>",
"thresholds": [
{
"id": "<string>",
"name": "<string>",
"threshold_value": 123,
"comparison_operator": "gte"
}
],
"created_at": "2023-12-25",
"updated_at": "2023-12-25",
"formula_sql": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Create aggregator payload
- Option 1
- Option 2
- Option 3
- Option 4
Aggregator configuration to automatically count seats from billable events. Only count aggregators are supported for seat products.
The billable event entity to aggregate.
"api_calls"
The aggregation operation to perform.
count The type of aggregator.
metered, licensed Filter conditions for the aggregation.
Show child attributes
Show child attributes
Read-only formula expression; not accepted on public writes.
Name of the aggregator.
Description of the aggregator.
Whether the aggregator can produce negative values.
Whether the aggregator should aggregate on customers.
Custom event name for the aggregator.
Event keys exposed by the aggregator.
Display name of the unit being measured (e.g. 'user', 'request'). Used as fallback for products attached to this aggregator.
"user"
Default interval count for usage periods.
Default interval period for usage periods.
days, weeks, months, years Thresholds for the aggregator.
Show child attributes
Show child attributes
Response
The newly created aggregator
count, sum, sql_formula Show child attributes
Show child attributes
metered, licensed days, weeks, months, years Show child attributes
Show child attributes
Was this page helpful?

