Skip to main content
DELETE
/
v1
/
goals
/
{goalId}
Delete goal by ID
curl --request DELETE \
  --url https://app.hipp.health/api/v1/goals/{goalId}
{
  "success": true
}

Delete Goal

Delete a goal by goalId. Works for all goal types (frequency_duration, opportunity, rating, or interval).

Path Parameters

  • goalId (required): The goal’s public identifier

Headers

Authorization: Bearer <your-api-key>

Success Response (200)

{
  "success": true
}

Error Responses

400 - Validation Error

{
  "error": "Validation error",
  "details": [
    {
      "code": "invalid_type",
      "message": "Invalid goal ID format",
      "path": ["goalId"]
    }
  ]
}

404 - Not Found

{
  "error": "Resource not found"
}

500 - Internal Server Error

{
  "error": "An unexpected error occurred"
}

Examples

cURL Example

# Delete a goal
curl -X DELETE "https://app.hipp.health/api/v1/goals/goal_123" \
  -H "Authorization: Bearer your-api-key"

JavaScript Example

const deleteGoal = async (goalId) => {
  const response = await fetch(`/api/v1/goals/${goalId}`, {
    method: "DELETE",
    headers: {
      Authorization: "Bearer your-api-key",
    },
  });

  if (!response.ok) {
    const error = await response.json();
    throw new Error(error.error || "Failed to delete goal");
  }

  return true;
};

// Delete a goal
try {
  await deleteGoal("goal_123");
  console.log("Goal deleted successfully");
} catch (error) {
  console.error("Error deleting goal:", error.message);
}

Path Parameters

goalId
string
required

Response

Deleted goal successfully

success
boolean