Skip to main content
PUT
/
v1
/
aggregators
/
{id}
Update aggregator
curl --request PUT \
  --url https://api.hyperline.co/v1/aggregators/{id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "entity": "api_calls",
  "type": "metered",
  "where": {
    "fields": [
      {
        "property": "<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,
      "id": "<string>",
      "name": "<string>",
      "comparison_operator": "gte"
    }
  ],
  "formula_sql": "<string>",
  "property": "<string>"
}
'
import requests

url = "https://api.hyperline.co/v1/aggregators/{id}"

payload = {
"entity": "api_calls",
"type": "metered",
"where": { "fields": [{ "property": "<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,
"id": "<string>",
"name": "<string>",
"comparison_operator": "gte"
}
],
"formula_sql": "<string>",
"property": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
entity: 'api_calls',
type: 'metered',
where: {fields: [{property: '<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,
id: '<string>',
name: '<string>',
comparison_operator: 'gte'
}
],
formula_sql: '<string>',
property: '<string>'
})
};

fetch('https://api.hyperline.co/v1/aggregators/{id}', 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/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'entity' => 'api_calls',
'type' => 'metered',
'where' => [
'fields' => [
[
'property' => '<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,
'id' => '<string>',
'name' => '<string>',
'comparison_operator' => 'gte'
]
],
'formula_sql' => '<string>',
'property' => '<string>'
]),
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/{id}"

payload := strings.NewReader("{\n \"entity\": \"api_calls\",\n \"type\": \"metered\",\n \"where\": {\n \"fields\": [\n {\n \"property\": \"<string>\"\n }\n ]\n },\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 \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"comparison_operator\": \"gte\"\n }\n ],\n \"formula_sql\": \"<string>\",\n \"property\": \"<string>\"\n}")

req, _ := http.NewRequest("PUT", 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.put("https://api.hyperline.co/v1/aggregators/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"entity\": \"api_calls\",\n \"type\": \"metered\",\n \"where\": {\n \"fields\": [\n {\n \"property\": \"<string>\"\n }\n ]\n },\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 \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"comparison_operator\": \"gte\"\n }\n ],\n \"formula_sql\": \"<string>\",\n \"property\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.hyperline.co/v1/aggregators/{id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"entity\": \"api_calls\",\n \"type\": \"metered\",\n \"where\": {\n \"fields\": [\n {\n \"property\": \"<string>\"\n }\n ]\n },\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 \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"comparison_operator\": \"gte\"\n }\n ],\n \"formula_sql\": \"<string>\",\n \"property\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": "<string>",
  "entity": "<string>",
  "property": "<string>",
  "where": {
    "fields": [
      {
        "property": "<string>"
      }
    ]
  },
  "name": "<string>",
  "description": "<string>",
  "allow_negative_values": true,
  "aggregate_on_customers_enabled": true,
  "default_interval_count": 123,
  "custom_event_name": "<string>",
  "exposed_event_keys": [
    "<string>"
  ],
  "unit_name": "<string>",
  "thresholds": [
    {
      "id": "<string>",
      "name": "<string>",
      "threshold_value": 123
    }
  ],
  "created_at": "2023-12-25",
  "updated_at": "2023-12-25",
  "formula_sql": "<string>"
}
{
"message": "<string>"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

id
string
required

Body

application/json
entity
string

The billable event entity to aggregate.

Example:

"api_calls"

type
enum<string>
default:metered

The type of aggregator.

Available options:
metered,
licensed
where
object | null

Filter conditions for the aggregation.

name
string

Name of the aggregator.

description
string | null

Description of the aggregator.

allow_negative_values
boolean
default:false

Whether the aggregator can produce negative values.

aggregate_on_customers_enabled
boolean
default:false

Whether the aggregator should aggregate on customers.

custom_event_name
string

Custom event name for the aggregator.

exposed_event_keys
string[]

Event keys exposed by the aggregator.

unit_name
string | null

Display name of the unit being measured (e.g. 'user', 'request'). Used as fallback for products attached to this aggregator.

Example:

"user"

default_interval_count
integer

Default interval count for usage periods.

default_interval_period
enum<string>

Default interval period for usage periods.

Available options:
days,
weeks,
months,
years
thresholds
object[]

Thresholds for the aggregator. Replaces existing thresholds.

formula_sql
string
deprecated

Read-only formula expression; not accepted on public writes.

operation
enum<string>

The aggregation operation to perform.

Available options:
count,
sum
property
string

The property to sum. Required when operation is 'sum'.

Response

id
string
required
entity
string
required
operation
enum<string>
required
Available options:
count,
sum,
sql_formula
property
string | null
required
where
object | null
required
type
enum<string>
required
Available options:
metered,
licensed
name
string | null
required
description
string | null
required
allow_negative_values
boolean
required
aggregate_on_customers_enabled
boolean
required
default_interval_count
integer | null
required
default_interval_period
enum<string> | null
required
Available options:
days,
weeks,
months,
years
custom_event_name
string | null
required
exposed_event_keys
string[]
required
unit_name
string | null
required
thresholds
object[]
required
created_at
string<date>
required
updated_at
string<date>
required
formula_sql
string | null