Meterd

Events API

Ingest usage events into Meterd.

Ingest a single event

POST/v1/events

Request body

json
{
  "event_type": "api_request",
  "customer_id": "01HQXYZ...",
  "timestamp": "2024-01-15T10:30:00Z",
  "properties": {
    "endpoint": "/v1/users",
    "method": "GET",
    "region": "us-east-1"
  },
  "value": 1.0,
  "idempotency_key": "req_abc123"
}
FieldTypeRequiredDescription
event_typestringYesEvent category (must match a meter's event_type)
customer_idstringYesCustomer's external ID (auto-creates the customer if not found)
timestampISO 8601NoEvent time (defaults to server time)
propertiesobjectNoArbitrary key-value metadata
valuenumberNoNumeric value (defaults to 1.0)
idempotency_keystringNoDeduplication key

Response

json
{ "accepted": 1, "rejected": 0, "warnings": [] }
FieldTypeDescription
acceptednumberNumber of events accepted
rejectednumberNumber of events rejected
warningsstring[]Non-fatal issues (e.g., unrecognized event type)

Example

bash
curl -X POST https://api.meterd.io/v1/events \
  -H "Authorization: Bearer mtd_adm_..." \
  -H "Content-Type: application/json" \
  -d '{
    "event_type": "api_request",
    "customer_id": "01HQXYZ...",
    "properties": {"endpoint": "/users"},
    "idempotency_key": "req_001"
  }'

Ingest a batch of events

POST/v1/events/batch

Send up to 1,000 events in a single request for higher throughput.

json
{
  "events": [
    { "event_type": "api_request", "customer_id": "01HQXYZ...", "properties": {"endpoint": "/users"} },
    { "event_type": "api_request", "customer_id": "01HQABC...", "properties": {"endpoint": "/orders"} }
  ]
}

Response

json
{ "accepted": 2, "rejected": 0, "warnings": [] }

Idempotency

If you include an idempotency_key, Meterd deduplicates the event. Sending the same key twice means the second request is silently accepted (no error, no double-counting). Use when retrying after timeouts or when your upstream may emit duplicates.

Rate limiting

The events API is rate-limited to 1,000 requests per minute per tenant. The response includes X-RateLimit-Limit and X-RateLimit-Remaining headers so you can track your usage.

When rate-limited, the API returns 429 Too Many Requests with a Retry-After header.