Passer au contenu principal
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": {
    "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"
    }
  ]
}
'
{
  "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>"
}

Autorisations

Authorization
string
header
requis

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

Corps

application/json

Create aggregator payload

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

entity
string
requis

The billable event entity to aggregate.

Exemple:

"api_calls"

operation
enum<string>
requis

The aggregation operation to perform.

Options disponibles:
count
type
enum<string>
défaut:metered

The type of aggregator.

Options disponibles:
metered,
licensed
where
object

Filter conditions for the aggregation.

formula_sql
string
obsolète

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

name
string

Name of the aggregator.

description
string | null

Description of the aggregator.

allow_negative_values
boolean
défaut:false

Whether the aggregator can produce negative values.

aggregate_on_customers_enabled
boolean
défaut: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.

Exemple:

"user"

default_interval_count
integer

Default interval count for usage periods.

default_interval_period
enum<string>

Default interval period for usage periods.

Options disponibles:
days,
weeks,
months,
years
thresholds
object[]

Thresholds for the aggregator.

Réponse

201 - application/json

The newly created aggregator

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