pex

Targets & Conversions API

Two related surfaces:

  • Targets — aggregate KPI numbers to hit by a date (MRR, pipeline, "1,000 signups by Q3"). Canonical route: /api/targets.
  • Conversions — the owned-event definitions of a valued action (a purchase, a signup) that experiments, journeys, and Targets reference. Route: /api/conversion-goals.

"Goal" is retired as a noun. The legacy /api/goals route is a deprecated alias for /api/targets and returns the same shapes — migrate to /api/targets. All endpoints require authentication.

List Targets

GET/api/targets

Retrieve all Targets for the current workspace

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

Returns an array of Target objects. When a Target is bound to a Conversion (sourceConversionId), its current is auto-computed from that conversion's completions since createdAt, and currentIsAuto is true. If the bound conversion was deleted, sourceMissing is true and current falls back to the last stored value.

[
  {
    "id": "target-001",
    "metric": "monthly_signups",
    "target": 500,
    "current": 342,
    "deadline": "2026-03-31",
    "createdAt": "2026-01-01T00:00:00Z",
    "sourceConversionId": "cg_signup",
    "currentIsAuto": true
  }
]

Create Target

POST/api/targets

Create a new KPI Target

ParameterTypeDescription
metricrequiredstringMetric to track (e.g. monthly_signups, revenue_mrr, trial_conversion_rate)
targetrequirednumberTarget value to reach
deadlinerequiredstringISO 8601 date for the Target deadline
currentnumberStarting value for a manual Target. Ignored when sourceConversionId is set (auto-computed).
sourceConversionIdstringBind to a Conversion (id from /api/conversion-goals) to auto-track progress from its completions. Must reference an existing owned-event conversion.
curl -X POST https://your-instance.com/api/targets \ -H "Content-Type: application/json" \ -H "x-api-key: apex_key_abc123" \ -d '{ "metric": "monthly_signups", "target": 500, "deadline": "2026-03-31", "sourceConversionId": "cg_signup" }'

Update Target

PATCH/api/targets

Update an existing Target

ParameterTypeDescription
idrequiredstringTarget ID to update
targetnumberUpdated target value
deadlinestringUpdated deadline
currentnumberUpdated value for a manual Target
sourceConversionIdstring | nullSet to a Conversion id to (re)bind for auto-tracking, or null to unbind back to a manual number.
curl -X PATCH https://your-instance.com/api/targets \ -H "Content-Type: application/json" \ -H "x-api-key: apex_key_abc123" \ -d '{ "id": "target-001", "target": 600 }'

Delete Target

DELETE/api/targets?id=target-001

Delete a Target by ID

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

Create Conversion

POST/api/conversion-goals

Define a Conversion — an owned event that counts as a valued action

Conversions define the events that count as completions for experiments, journeys, and Target auto-tracking. Manage them in the dashboard at /dashboard/conversions.

ParameterTypeDescription
namerequiredstringDisplay name (e.g. 'Signed Up', 'Started Trial')
typerequiredstringHow it's detected: form_submit, click, pageview, custom_event, file_download, engaged_time
eventNamestringFor custom_event: the Apex Spec event name to match (e.g. purchase)
targetUrlstringFor pageview: the URL/path that counts as a completion
selectorstringFor click/form_submit: a CSS selector to match
isPrimarybooleanMake this the primary conversion (only one can be primary)
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", "type": "custom_event", "eventName": "signup", "isPrimary": true }'