Skip to main content
POST
/
api
/
v1
/
metrics
Create a billable metric
curl --request POST \
  --url https://api.example.com/api/v1/metrics \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "aggregation_type": "COUNT",
  "code": "<string>",
  "name": "<string>",
  "product_family_id": "<string>",
  "aggregation_key": "<string>",
  "description": "<string>",
  "product_id": "prd_7n42DGM5Tflk9n8mt7Fhc7",
  "segmentation_matrix": {
    "key": "<string>",
    "values": [
      "<string>"
    ]
  },
  "unit_conversion": {
    "factor": 123,
    "rounding": "UP"
  },
  "usage_group_key": "<string>"
}
'
{
  "aggregation_type": "COUNT",
  "code": "<string>",
  "created_at": "2023-11-07T05:31:56Z",
  "id": "<string>",
  "name": "<string>",
  "product_family_id": "<string>",
  "aggregation_key": "<string>",
  "archived_at": "2023-11-07T05:31:56Z",
  "description": "<string>",
  "product_id": "prd_7n42DGM5Tflk9n8mt7Fhc7",
  "segmentation_matrix": {
    "key": "<string>",
    "values": [
      "<string>"
    ]
  },
  "unit_conversion": {
    "factor": 123,
    "rounding": "UP"
  },
  "usage_group_key": "<string>"
}

Authorizations

Authorization
string
header
required

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

Body

application/json
aggregation_type
enum<string>
required
Available options:
COUNT,
LATEST,
MAX,
MIN,
MEAN,
SUM,
COUNT_DISTINCT
code
string
required
name
string
required
product_family_id
string<MeteroidId>
required
Example:

"pf_7n42DGM5Tflk9n8mt7Fhc7"

aggregation_key
string | null
description
string | null
product_id
null | string<MeteroidId>
Example:

"prd_7n42DGM5Tflk9n8mt7Fhc7"

segmentation_matrix
object
unit_conversion
object
usage_group_key
string | null

Response

Metric created

aggregation_type
enum<string>
required
Available options:
COUNT,
LATEST,
MAX,
MIN,
MEAN,
SUM,
COUNT_DISTINCT
code
string
required
created_at
string<date-time>
required
id
string<MeteroidId>
required
Example:

"bm_7n42DGM5Tflk9n8mt7Fhc7"

name
string
required
product_family_id
string<MeteroidId>
required
Example:

"pf_7n42DGM5Tflk9n8mt7Fhc7"

aggregation_key
string | null
archived_at
string<date-time> | null
description
string | null
product_id
null | string<MeteroidId>
Example:

"prd_7n42DGM5Tflk9n8mt7Fhc7"

segmentation_matrix
object
unit_conversion
object
usage_group_key
string | null