pex

Goals API

Define, track, and manage growth goals and conversion goal definitions. All endpoints require authentication.

List Goals

GET/api/goals

Retrieve all goals for the current project

curl https://your-instance.com/api/goals \ -H "x-api-key: apex_key_abc123"

Returns an array of goal objects with current progress:

[
  {
    "id": "goal_001",
    "metric": "monthly_signups",
    "target": 500,
    "current": 342,
    "deadline": "2025-03-31",
    "status": "on_track",
    "createdAt": "2025-01-01T00:00:00Z"
  }
]

Create Goal

POST/api/goals

Create a new growth goal

ParameterTypeDescription
metricrequiredstringMetric to track (e.g. monthly_signups, revenue_mrr, trial_conversion_rate)
targetrequirednumberTarget value to reach
deadlinerequiredstringISO 8601 date for the goal deadline
descriptionstringHuman-readable description of the goal
unitstringDisplay unit (e.g. users, dollars, percent)
curl -X POST https://your-instance.com/api/goals \ -H "Content-Type: application/json" \ -H "x-api-key: apex_key_abc123" \ -d '{ "metric": "monthly_signups", "target": 500, "deadline": "2025-03-31", "description": "Reach 500 signups per month by end of Q1" }'

Update Goal

PATCH/api/goals

Update an existing goal

ParameterTypeDescription
idrequiredstringGoal ID to update
targetnumberUpdated target value
deadlinestringUpdated deadline
statusstringManual status override: on_track, at_risk, behind, or completed
curl -X PATCH https://your-instance.com/api/goals \ -H "Content-Type: application/json" \ -H "x-api-key: apex_key_abc123" \ -d '{ "id": "goal_001", "target": 600, "status": "at_risk" }'

Delete Goal

DELETE/api/goals?id=goal_001

Delete a goal by ID

ParameterTypeDescription
idrequiredstringGoal ID to delete (query parameter)
curl -X DELETE "https://your-instance.com/api/goals?id=goal_001" \ -H "x-api-key: apex_key_abc123"

Create Conversion Goal

POST/api/conversion-goals

Define a conversion event that goals and experiments can track

Conversion goals define the events that count as conversions for experiments and goal tracking.

ParameterTypeDescription
namerequiredstringDisplay name (e.g. 'Signed Up', 'Started Trial')
eventTyperequiredstringEvent type to match (e.g. form_submit, purchase)
urlPatternstringURL pattern to scope the conversion (e.g. /signup/complete)
conditionsobjectAdditional matching conditions on event data properties
curl -X POST https://your-instance.com/api/conversion-goals \ -H "Content-Type: application/json" \ -H "x-api-key: apex_key_abc123" \ -d '{ "name": "Trial Signup", "eventType": "form_submit", "urlPattern": "/signup/complete" }'