POST
/
usage-metrics
curl --request POST \
  --url https://eu.sequencehq.com/api/usage-metrics \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "Total length of sent messages.",
  "description": "Total length of sent messages.",
  "metricType": "GROUPED",
  "eventType": "message_sent",
  "aggregationType": "COUNT",
  "aggregationProperty": "message_length",
  "groupingProperty": "channel",
  "unit": "bytes",
  "deletedAt": "2022-06-28T16:47:00Z",
  "propertyFilters": {
    "channels": [
      "text",
      "email"
    ]
  },
  "caseSensitive": true,
  "propertiesToNegate": [
    "channels"
  ]
}'
{
  "id": "f092246c-6b90-4106-bcca-304ccf06bf45",
  "sequenceAccountId": "ec1479a2-6ba1-421f-a7de-0853a20d17a1",
  "name": "Total length of sent messages.",
  "description": "Total length of sent messages.",
  "metricType": "GROUPED",
  "eventType": "message_sent",
  "aggregationType": "COUNT",
  "aggregationProperty": "message_length",
  "groupingProperty": "channel",
  "unit": "bytes",
  "createdAt": "2022-06-28T16:47:00Z",
  "deletedAt": "2022-06-28T16:47:00Z",
  "propertyFilters": {
    "channels": [
      "text",
      "email"
    ]
  },
  "caseSensitive": true,
  "propertiesToNegate": [
    "channels"
  ],
  "parameters": [
    {
      "id": "2963e49a-c8e0-4673-89f5-7a805c0faf14",
      "usageMetricId": "f092246c-6b90-4106-bcca-304ccf06bf45",
      "name": "myParam",
      "type": "INTEGER",
      "description": "My parameter",
      "defaultValue": "10"
    }
  ]
}

Headers

Authorization
string
required

Your API credentials. Eg. Basic {credentials}.

Body

application/json
name
string
required

Human-readable name for this metric, which should be unique

description
string

Description for this metric

metricType
enum<string>
required

Type of metric (simple or grouped)

Available options:
SIMPLE,
GROUPED
eventType
string
required

The eventType of the Usage Event to be aggregated

aggregationType
enum<string>
required

Type of aggregation to perform

Available options:
COUNT,
UNIQUE,
SUM,
CUSTOM
aggregationProperty
string

Property within the event to aggregate

groupingProperty
string

Property within the event to group results by

unit
string

Human-readable unit of the aggregated metric, eg. API calls)

deletedAt
string

Created at

propertyFilters
object

propertyFilters

caseSensitive
boolean

caseSensitive

propertiesToNegate
string[]

propertiesToNegate

Response

201 - application/json
id
string
required

Unique ID

sequenceAccountId
string
required

Sequence Account ID

name
string
required

Human-readable name for this metric, which should be unique

description
string

Description for this metric

metricType
enum<string>
required

Type of metric (simple or grouped)

Available options:
SIMPLE,
GROUPED
eventType
string
required

The eventType of the Usage Event to be aggregated

aggregationType
enum<string>
required

Type of aggregation to perform

Available options:
COUNT,
UNIQUE,
SUM,
CUSTOM
aggregationProperty
string

Property within the event to aggregate

groupingProperty
string

Property within the event to group results by

unit
string

Human-readable unit of the aggregated metric, eg. API calls)

createdAt
string

Created at

deletedAt
string

Created at

propertyFilters
object
required

propertyFilters

caseSensitive
boolean

caseSensitive

propertiesToNegate
string[]

propertiesToNegate

parameters
object[]
required

Required parameters