Create a custom goal
POST https://datafa.st/api/v1/goals
Record a server-side custom goal event for a visitor. This is the recommended way to track signups, feature usage, and other backend-confirmed actions — more reliable than client-side tracking alone. See custom goals for naming conventions and dashboard setup.
Goal names are lowercased and spaces become underscores. The name
identify is reserved.Related: Custom goals · Journey tracking
Request
Query parameters
websiteIddft_ account token on Website API routes. Omit with a df_ website key. Example: ?websiteId=665f0b3c4d2e1a0012345678.Body parameters
datafast_visitor_idrequired
datafast_visitor_id cookie or tracking script. Example: "a3ab2331-989f-4cfa-91c6-2461c9e3c6bd". Alias: visitorId on some endpoints.visitorIddatafast_visitor_id on endpoints that accept both names.namerequired
_. Allowed: a-z, 0-9, _, -, :. Max 64 chars. Reserved: identify. Example: "newsletter_signup". See custom goals.description"Newsletter form submit".metadata^[a-z0-9_-]+$ (max 64); values max 255 chars. Example: {"plan": "pro", "source": "api"}.Example request body
{
"datafast_visitor_id": "a3ab2331-989f-4cfa-91c6-2461c9e3c6bd",
"name": "newsletter_signup",
"metadata": { "plan": "pro" }
}
Response
Returns a JSON object with
status: "success" and endpoint-specific fields in data (and pagination when the endpoint is paginated).Response fields
statussuccess.data[].messagedata[].eventIdAuthentication
df_website API key: The website is inferred from the key. You do not need awebsiteIdquery parameter.dft_account token: Requiresgoals:writepermission and?websiteId=on every request. The token must be allowed to access that website.
Read authentication and scopes for token creation, permission lists, and scoped tokens.
Errors
400 — Missing fields, invalid goal name format, reserved name, invalid metadata, or invalid JSON body.
403 — Tracking suspended for this website.
404 — Visitor has no pageviews on this website.
See API errors for the standard error envelope, auth failures, validation errors, permission errors, and rate limits.