Create alert
POST https://datafa.st/api/v1/admin/websites/{websiteId}/alertsCreate an email alert that fires when a visitor completes a goal. The email goes to the website owner's address unless you customize the template.
Goal names are saved lowercase and trimmed.
Related: Alerts announcement · Custom goals
Request
Path parameters
websiteIdstring
Body parameters
namestring
required
Alert label in the dashboard. Example:
"New sale". Max 100 chars.trigger.goalNamestring
required
Goal that fires the alert. Example:
"purchase". Lowercased when saved. Pick from List tracked goals.template.messagestring
required
Plain-text email body. Min 10, max 2000 characters. Example:
"Someone just signed up on your site."template.subjectstring
Optional custom subject. Example:
"New signup on example.com". Defaults to a standard alert subject when omitted.isEnabledboolean
true (default) sends emails; false creates a disabled alert.Example request body
{
"name": "New signup alert",
"trigger": { "goalName": "signup" },
"template": {
"subject": "New signup!",
"message": "A visitor just completed the signup goal."
},
"isEnabled": true
}
Response
Returns a JSON object with
status: "success" and endpoint-specific fields in data.Response fields
data[].idstring
Alert ObjectId.
data[].websiteIdstring
Website ObjectId used by account tokens to choose which website to query or manage.
data[].namestring
Human-readable name for the resource or event. The exact meaning depends on the endpoint.
data[].trigger.typestring
Trigger type. Currently
goal.data[].trigger.goalNamestring
Goal watched by the alert.
data[].destination.typestring
Destination type. Currently
email.data[].template.subjectstring (optional)
Custom subject when configured; omitted otherwise.
data[].template.messagestring
Human-readable confirmation or status message for the operation.
data[].isEnabledboolean
Whether the alert is enabled.
data[].triggerCountnumber
All-time successful trigger count.
data[].monthlyCountnumber
Current billing-cycle trigger count.
data[].monthlyCountResetAtstring
Timestamp used to reset the monthly counter.
data[].dailyCountnumber
Current UTC-day trigger count.
data[].dailyCountResetAtstring
Timestamp used to reset the daily counter.
data[].lastTriggeredAtstring|null (optional)
Latest successful trigger timestamp, when available; omitted before the first trigger.
data[].lastErrorstring|null (optional)
Latest delivery error, when available; omitted before an error is recorded.
data[].recentLogsobject[]
Recent trigger logs.
data[].createdAtstring
Creation timestamp.
data[].updatedAtstring
Last update timestamp.
Authentication
Use a
dft_ account token with alerts:write.A
df_ website API key for the same website can also call this route when the path websiteId matches the key's website. Write access with a df_ key is capped at member level — owner-only actions such as team management require a dft_ token and owner role.Errors
400 — Invalid alert data (name 1–100 chars, message 10–2000 chars, invalid goal name) or alert limit reached (max 25 per website).
See API errors for the standard error envelope, auth failures, validation errors, permission errors, and rate limits.