Skip to main content
POST
/
v1
/
aggregators
Create 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": {
    "conditional": "and",
    "fields": [
      {
        "property": "<string>",
        "operator": "isNull"
      }
    ]
  },
  "name": "<string>",
  "description": "<string>",
  "allow_negative_values": false,
  "aggregate_on_customers_enabled": false,
  "custom_event_name": "<string>",
  "exposed_event_keys": [
    "<string>"
  ],
  "default_interval_count": 123,
  "default_interval_period": "days",
  "thresholds": [
    {
      "threshold_value": 123,
      "name": "<string>",
      "comparison_operator": "gte"
    }
  ]
}
'
{
  "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>"
  ],
  "thresholds": [
    {
      "id": "<string>",
      "name": "<string>",
      "threshold_value": 123,
      "comparison_operator": "gte"
    }
  ],
  "created_at": "2023-12-25",
  "updated_at": "2023-12-25"
}

Authorizations

Authorization
string
header
required

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

Body

application/json

Create aggregator payload

Aggregator configuration to automatically count seats from billable events. Only count aggregators are supported for seat products.

entity
string
required

The billable event entity to aggregate.

Example:

"api_calls"

operation
enum<string>
required

The aggregation operation to perform.

Available options:
count
type
enum<string>
default:metered

The type of aggregator.

Available options:
metered,
licensed
where
object

Filter conditions for the aggregation.

name
string

Name of the aggregator.

description
string

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.

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.

Response

201 - application/json

The newly created aggregator

id
string
required
entity
string
required
operation
enum<string>
required
Available options:
count,
sum
property
string | null
required
where
object
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
thresholds
object[]
required
created_at
string<date>
required
updated_at
string<date>
required