Skip to main content
POST
/
api
/
v1
/
billable-metric
Create new billable metric
curl --request POST \
  --url https://dev-billing-api.iqraa.ai/api/v1/api/v1/billable-metric \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'x-admin-api-key: <x-admin-api-key>' \
  --data '
{
  "name": "Storage",
  "code": "storage",
  "description": "storage billable metric",
  "recurring": false,
  "aggregatorType": "sum_agg",
  "fieldName": "gb"
}
'
{
  "name": "Storage",
  "code": "storage",
  "description": "storage billable metric",
  "recurring": false,
  "aggregatorType": "sum_agg",
  "fieldName": "gb"
}

Authorizations

Authorization
string
header
required

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

Headers

x-admin-api-key
string
required

The API key to access the admin API

Body

application/json
name
string
required
Example:

"Storage"

code
string
required
Example:

"storage"

description
string
required
Example:

"storage billable metric"

recurring
boolean
required
Example:

false

aggregatorType
enum<string>
required

Billing Aggregator

Available options:
count_agg,
sum_agg,
max_agg,
unique_count_agg,
weighted_sum_agg,
latest_agg
Example:

"sum_agg"

fieldName
string
required

aggregating usage data

Example:

"gb"

Response

Creates a new Billable Metric

name
string
required
Example:

"Storage"

code
string
required
Example:

"storage"

description
string
required
Example:

"storage billable metric"

recurring
boolean
required
Example:

false

aggregatorType
enum<string>
required

Billing Aggregator

Available options:
count_agg,
sum_agg,
max_agg,
unique_count_agg,
weighted_sum_agg,
latest_agg
Example:

"sum_agg"

fieldName
string
required

aggregating usage data

Example:

"gb"