HTTP API

Meter

POST/api/v1/meter/events
POST
/api/v1/meter/events

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/api/v1/meter/events" \  -H "Content-Type: application/json" \  -d '{    "events": [      {        "idempotency_key": "string",        "metric": "string",        "value": 0.1      }    ]  }'
{  "accepted": 0,  "duplicates": 0,  "rejected": 0,  "results": [    {      "bucket": "string",      "idempotency_key": "string",      "status": "accepted"    }  ]}
GET/api/v1/meter/metrics
GET
/api/v1/meter/metrics

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Query Parameters

q?string

Full-text search query applied to metric name

page?integer

1-indexed page number

Formatint64
Range0 <= value
page_size?integer

Page size

Formatint64
Range0 <= value
sort_by?string

Sort field

sort_order?string

Sort order (asc or desc)

Value in

  • "asc"
  • "desc"
filter?array<string>

Additional filter expressions in the form field:operator:value

Response Body

application/json

curl -X GET "https://example.com/api/v1/meter/metrics"
{  "metrics": [    {      "aggregation": {        "bucket": "minute",        "kind": "sum",        "rollups": [          "minute"        ]      },      "created_at": "2019-08-24T14:15:22Z",      "dimensions": [        {          "cardinality": "low",          "name": "string",          "required": true        }      ],      "metric_id": "string",      "name": "string",      "pricing": {        "currency": "string",        "tiers": [          {            "unit_price": 0.1,            "up_to": 0          }        ]      },      "quota": {        "enabled": true,        "hard_limit": 0,        "period": "day",        "soft_limit": 0      },      "retention": {        "hot_bucket_days": 0,        "report_days": 0      },      "unit": "string",      "updated_at": "2019-08-24T14:15:22Z",      "version": 0    }  ],  "pagination": {    "has_more": true,    "page": 0,    "page_size": 0,    "total": 0  }}
POST/api/v1/meter/metrics
POST
/api/v1/meter/metrics

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/api/v1/meter/metrics" \  -H "Content-Type: application/json" \  -d '{    "name": "string",    "unit": "string"  }'
{  "aggregation": {    "bucket": "minute",    "kind": "sum",    "rollups": [      "minute"    ]  },  "created_at": "2019-08-24T14:15:22Z",  "dimensions": [    {      "cardinality": "low",      "name": "string",      "required": true    }  ],  "metric_id": "string",  "name": "string",  "pricing": {    "currency": "string",    "tiers": [      {        "unit_price": 0.1,        "up_to": 0      }    ]  },  "quota": {    "enabled": true,    "hard_limit": 0,    "period": "day",    "soft_limit": 0  },  "retention": {    "hot_bucket_days": 0,    "report_days": 0  },  "unit": "string",  "updated_at": "2019-08-24T14:15:22Z",  "version": 0}
GET/api/v1/meter/metrics/{metric}
GET
/api/v1/meter/metrics/{metric}

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

metric*string

Response Body

application/json

curl -X GET "https://example.com/api/v1/meter/metrics/string"
{  "aggregation": {    "bucket": "minute",    "kind": "sum",    "rollups": [      "minute"    ]  },  "created_at": "2019-08-24T14:15:22Z",  "dimensions": [    {      "cardinality": "low",      "name": "string",      "required": true    }  ],  "metric_id": "string",  "name": "string",  "pricing": {    "currency": "string",    "tiers": [      {        "unit_price": 0.1,        "up_to": 0      }    ]  },  "quota": {    "enabled": true,    "hard_limit": 0,    "period": "day",    "soft_limit": 0  },  "retention": {    "hot_bucket_days": 0,    "report_days": 0  },  "unit": "string",  "updated_at": "2019-08-24T14:15:22Z",  "version": 0}
GET/api/v1/meter/{metric}/alarms
GET
/api/v1/meter/{metric}/alarms

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

metric*string

Response Body

application/json

curl -X GET "https://example.com/api/v1/meter/string/alarms"
{  "alarms": [    {      "alarm_id": "string",      "limit": 0.1,      "metric": "string",      "scope": "string",      "status": "triggered",      "threshold": "soft_limit",      "triggered_at": "2019-08-24T14:15:22Z",      "usage": 0.1    }  ],  "count": 0}
POST/api/v1/meter/{metric}/check
POST
/api/v1/meter/{metric}/check

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

metric*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/api/v1/meter/string/check" \  -H "Content-Type: application/json" \  -d '{    "planned_units": 0.1  }'
{  "allowed": true,  "current_usage": 0.1,  "hard_limit": 0,  "hard_limit_exceeded": true,  "planned_units": 0.1,  "reserved_units": 0.1,  "soft_limit": 0,  "soft_limit_exceeded": true}
POST/api/v1/meter/{metric}/commit
POST
/api/v1/meter/{metric}/commit

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

metric*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/api/v1/meter/string/commit" \  -H "Content-Type: application/json" \  -d '{    "actual_units": 0.1,    "reservation_id": "string"  }'
{  "committed_units": 0.1,  "released_units": 0.1,  "reservation_id": "string",  "status": "reserved"}
POST/api/v1/meter/{metric}/estimate
POST
/api/v1/meter/{metric}/estimate

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

metric*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/api/v1/meter/string/estimate" \  -H "Content-Type: application/json" \  -d '{    "units": 0.1  }'
{  "currency": "string",  "estimated_cost": 0.1,  "metric": "string",  "units": 0.1}
GET/api/v1/meter/{metric}/forecast
GET
/api/v1/meter/{metric}/forecast

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

metric*string

Query Parameters

user_id?string

User to forecast usage for (defaults to the caller)

period?string

Reset period to forecast against

Value in

  • "day"
  • "month"
  • "billing_cycle"
  • "prepaid"

Response Body

application/json

curl -X GET "https://example.com/api/v1/meter/string/forecast"
{  "confidence": 0.1,  "current_usage": 0.1,  "metric": "string",  "period_fraction_elapsed": 0.1,  "projected_usage": 0.1,  "user_id": "string"}
GET/api/v1/meter/{metric}/reports
GET
/api/v1/meter/{metric}/reports

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

metric*string

Query Parameters

page?integer

1-indexed page number

Formatint64
Range0 <= value
page_size?integer

Page size

Formatint64
Range0 <= value

Response Body

application/json

curl -X GET "https://example.com/api/v1/meter/string/reports"
{  "pagination": {    "has_more": true,    "page": 0,    "page_size": 0,    "total": 0  },  "reports": [    {      "estimated_cost": 0.1,      "generated_at": "2019-08-24T14:15:22Z",      "metric": "string",      "quota": {        "hard_limit_exceeded": true,        "soft_limit_exceeded": true      },      "report_id": "string",      "top_consumers": [        {          "dimension": "string",          "usage": 0.1,          "value": "string"        }      ],      "total": 0.1,      "unique_count": 0    }  ]}
POST/api/v1/meter/{metric}/reports/generate
POST
/api/v1/meter/{metric}/reports/generate

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

metric*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/api/v1/meter/string/reports/generate" \  -H "Content-Type: application/json" \  -d '{}'
{  "estimated_cost": 0.1,  "generated_at": "2019-08-24T14:15:22Z",  "metric": "string",  "quota": {    "hard_limit_exceeded": true,    "soft_limit_exceeded": true  },  "report_id": "string",  "top_consumers": [    {      "dimension": "string",      "usage": 0.1,      "value": "string"    }  ],  "total": 0.1,  "unique_count": 0}
POST/api/v1/meter/{metric}/reserve
POST
/api/v1/meter/{metric}/reserve

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

metric*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/api/v1/meter/string/reserve" \  -H "Content-Type: application/json" \  -d '{    "units": 0.1  }'
{  "expires_at": "2019-08-24T14:15:22Z",  "reservation_id": "string",  "reserved_units": 0.1,  "status": "reserved"}
GET/api/v1/meter/{metric}/top
GET
/api/v1/meter/{metric}/top

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

metric*string

Query Parameters

dimension?string

Dimension to rank consumers by

period?string

Bucket resolution to read top consumers from

limit?integer

Maximum consumers to return

Formatint64
Range0 <= value

Response Body

application/json

curl -X GET "https://example.com/api/v1/meter/string/top"
{  "consumers": [    {      "dimension": "string",      "usage": 0.1,      "value": "string"    }  ],  "dimension": "string",  "metric": "string",  "period": "string"}
GET/api/v1/meter/{metric}/usage
GET
/api/v1/meter/{metric}/usage

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

metric*string

Query Parameters

user_id?string

User to query usage for (defaults to the caller)

period?string

Bucket resolution (minute, hour, day, billing_cycle)

Response Body

application/json

curl -X GET "https://example.com/api/v1/meter/string/usage"
{  "buckets": [    {      "bucket": "string",      "value": 0.1    }  ],  "metric": "string",  "period": "string",  "total": 0.1,  "user_id": "string"}

On this page