Skip to main content
POST
/
v1
/
meters
Create Meter
curl --request POST \
  --url https://api.spairehq.com/v1/meters/ \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "filter": {
    "clauses": [
      {
        "property": "<string>",
        "value": "<string>"
      }
    ]
  },
  "aggregation": {
    "func": "count"
  },
  "metadata": {},
  "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"
}
'
{
  "metadata": {},
  "created_at": "2023-11-07T05:31:56Z",
  "modified_at": "2023-11-07T05:31:56Z",
  "id": "<string>",
  "name": "<string>",
  "filter": {
    "clauses": [
      {
        "property": "<string>",
        "value": "<string>"
      }
    ]
  },
  "aggregation": {
    "func": "count"
  },
  "organization_id": "<string>",
  "archived_at": "2023-11-07T05:31:56Z"
}

Documentation Index

Fetch the complete documentation index at: https://docs.spairehq.com/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

You can generate a Personal Access Token from your settings.

Body

application/json
name
string
required

The name of the meter. Will be shown on customer's invoices and usage.

Minimum string length: 3
filter
Filter · object
required

The filter to apply on events that'll be used to calculate the meter.

aggregation
CountAggregation · object
required

The aggregation to apply on the filtered events to calculate the meter.

metadata
Metadata · object

Key-value object allowing you to store additional information.

The key must be a string with a maximum length of 40 characters. The value must be either:

  • A string with a maximum length of 500 characters
  • An integer
  • A floating-point number
  • A boolean

You can store up to 50 key-value pairs.

organization_id
string<uuid4> | null

The organization ID.

Example:

"1dbfc517-0bbf-4301-9ba8-555ca42b9737"

Response

Meter created.

metadata
object
required
created_at
string<date-time>
required

Creation timestamp of the object.

modified_at
string<date-time> | null
required

Last modification timestamp of the object.

id
string<uuid4>
required

The ID of the object.

name
string
required

The name of the meter. Will be shown on customer's invoices and usage.

filter
Filter · object
required

The filter to apply on events that'll be used to calculate the meter.

aggregation
CountAggregation · object
required

The aggregation to apply on the filtered events to calculate the meter.

organization_id
string<uuid4>
required

The ID of the organization owning the meter.

archived_at
string<date-time> | null

Whether the meter is archived and the time it was archived.