API ReferenceGoals
DELETE Goal
Delete custom goal events by visitor, name, or time range.
DELETE Goal
DELETE https://api.faurya.com/api/v1/goals
Delete custom goal events for the authenticated site. Requires Bearer Token authentication.
Request body
Send at least one filter field. Filters can be combined.
faurya_visitor_id(string): Delete goals for a specific visitor.name(string): Delete goals with this name. The API trims, lowercases, and converts spaces to underscores before matching.startAtorstartDate(string): Start of the deletion range.endAtorendDate(string): End of the deletion range.
If only one side of the time range is provided, the API uses the site creation time as the missing start or the current time as the missing end.
Response
200 OK: Matching goal events deleted.400 Bad Request: No filter was provided or the time range is invalid.401 Unauthorized: Missing or invalid API key.404 Not Found: Site, visitor, or matching goal events not found.
Example request
const response = await fetch("https://api.faurya.com/api/v1/goals", {
method: "DELETE",
headers: {
Authorization: `Bearer ${process.env.FAURYA_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
faurya_visitor_id: "visitor_123",
name: "newsletter_signup",
startAt: "2026-06-01T00:00:00.000Z",
endAt: "2026-06-29T23:59:59.999Z",
}),
});
const result = await response.json();Success response
{
"status": "success",
"message": "2 goal event(s) deleted",
"deleted": 2,
"faurya_visitor_id": "visitor_123",
"name": "newsletter_signup",
"timeRange": {
"start": "2026-06-01T00:00:00.000Z",
"end": "2026-06-29T23:59:59.999Z"
}
}