Metrics API
Create saved metric definitions with numerator and denominator legs.
Last updated June 3, 2026
Use the Metrics API to save activation or quality definitions that combine ordered steps, all-of groups, property filters, and denominator-anchored windows.
POST /api/metrics
1curl https://usegrometrics.com/api/metrics \2-H "Authorization: Bearer YOUR_API_KEY" \3-H "Content-Type: application/json" \4-d '{5"name": "Activated users",6"denominator": {7"windowSeconds": null,8"steps": [{ "type": "Event", "value": "account_created" }]9},10"numerator": {11"windowSeconds": 604800,12"steps": [{13"type": "Event",14"value": "verified",15"mode": "all_of",16"or": [17{ "type": "Event", "value": "trip_added" },18{ "type": "Event", "value": "first_connection" }19]20}]21}22}'
Options / Configuration
| Option | Type | Required | Description |
|---|---|---|---|
| name | string | ✓ | Saved metric name |
| numerator.steps | array | ✓ | The steps a visitor must match to count in the numerator |
| numerator.windowSeconds | number or null | no | When a denominator exists, this window starts at the denominator match |
| denominator.steps | array | no | The base population. Omit it to use all visitors in the selected reporting range |
| steps[].filters / or / mode | array/string | no | Same advanced step fields supported by saved funnels |
What happens next
Read saved metric performance from GET /api/analytics/metrics with the same date range parameters used by the other Analytics API endpoints.
Troubleshooting
Metric rate is zero
Confirm the denominator step exists in the selected date range and the numerator steps occur within the configured window.
Was this page helpful?