Skip to main content
PUT
/
v1
/
meters
/
{id}
Update Meter
curl --request PUT \
  --url https://api.example.com/v1/meters/{id} \
  --header 'Content-Type: application/json' \
  --data '
{
  "filters": [
    {
      "filters[].key": "<string>",
      "filters[].values": [
        {}
      ]
    }
  ]
}
'
{
  "id": "<string>",
  "name": "<string>",
  "tenant_id": "<string>",
  "event_name": "<string>",
  "aggregation": {},
  "filters": [
    {}
  ],
  "reset_usage": "<string>",
  "status": "<string>",
  "created_at": "<string>",
  "updated_at": "<string>"
}

Path Parameters

id
string
required
Unique identifier of the meter to update.Example: "meter_550e8400e29b41d4a716446655440000"

Request Body

filters
array
required
Updated array of filters to apply before aggregation. This replaces all existing filters.

Response

id
string
Unique identifier for the meter.
name
string
Human-readable name for the meter.
tenant_id
string
Tenant ID that owns this meter.
event_name
string
Name of the event being tracked.
aggregation
object
Aggregation configuration.
filters
array
Updated array of filters.
reset_usage
string
Usage reset configuration.
status
string
Status of the meter.
created_at
string
ISO 8601 timestamp when the meter was created.
updated_at
string
ISO 8601 timestamp when the meter was last updated.

Example Request

cURL
curl --request PUT \
  --url https://api.flexprice.io/v1/meters/meter_550e8400e29b41d4a716446655440000 \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "filters": [
      {
        "key": "region",
        "values": ["us-east-1", "eu-west-1"]
      },
      {
        "key": "environment",
        "values": ["production"]
      }
    ]
  }'

Example Response

{
  "id": "meter_550e8400e29b41d4a716446655440000",
  "name": "API Usage Meter",
  "tenant_id": "tenant_123",
  "event_name": "api_request",
  "aggregation": {
    "type": "COUNT"
  },
  "filters": [
    {
      "key": "region",
      "values": ["us-east-1", "eu-west-1"]
    },
    {
      "key": "environment",
      "values": ["production"]
    }
  ],
  "reset_usage": "BILLING_PERIOD",
  "status": "published",
  "created_at": "2024-03-20T15:04:05Z",
  "updated_at": "2024-03-20T16:30:15Z"
}