Goals API
Create saved goals from scripts, setup tools, or internal dashboards.
Last updated June 3, 2026
Use the Goals API to create the same saved goal definitions available in the Conversions dashboard. Create an API key from Settings > API Keys, then send it as a bearer token.
POST /api/goals
1curl https://usegrometrics.com/api/goals \2-H "Authorization: Bearer YOUR_API_KEY" \3-H "Content-Type: application/json" \4-d '{5"name": "Signup completed",6"type": "Event",7"conditions": "event.name = signup_completed"8}'
Options / Configuration
| Option | Type | Required | Description |
|---|---|---|---|
| name | string | ✓ | Saved goal name, unique for the signed-in account |
| type | string | ✓ | Pageview, Event, Duration, or Pages per session |
| conditions | string | ✓ | The same goal condition expression used in the dashboard goal builder |
What happens next
After creating a goal, open Conversions and switch to Goals to review completions, conversion rate, source breakdowns, and recent visitors.
Troubleshooting
Request is unauthorized
Check that the Authorization header uses a valid, unrevoked Grometrics API key.
Goal already exists
Goal names must be unique for the account that owns the API key.
Was this page helpful?