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

OptionTypeRequiredDescription
namestringSaved metric name
numerator.stepsarrayThe steps a visitor must match to count in the numerator
numerator.windowSecondsnumber or nullnoWhen a denominator exists, this window starts at the denominator match
denominator.stepsarraynoThe base population. Omit it to use all visitors in the selected reporting range
steps[].filters / or / modearray/stringnoSame 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?