Public REST API for the Habit AI platform. Track meals, nutrition, weight, steps, meditation, journaling, and chat with AI coaches.
Base URL: https://habitapp.ai
All API requests require a Bearer token in the Authorization header.
Authorization: Bearer hab_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxBootstrap your first API key by clicking on 'Sign in' on this page. Then go to the Settings page and click on 'Get API Key'.
The API key is returned once and cannot be retrieved again. Store it securely. Max 5 active keys per user.
/api/v1/profileGet your user profile.
/api/v1/profileUpdate profile fields.
{
"displayName": "string",
"timezone": "America/New_York",
"heightInCm": 175,
"weightInKg": 70,
"gender": "male",
"caloriesGoal": 2000,
"proteinGoal": 150,
"diet": "classic",
"activityLevel": "moderatelyActive"
}/api/v1/mealsList meal scans.
Query Parameters
/api/v1/mealsCreate a meal entry.
{
"mealName": "Grilled Chicken Bowl",
"calories": 500,
"protein": 30,
"carbs": 50,
"fat": 15,
"mealType": "lunch",
"ingredients": [
{ "name": "Chicken", "amount": 200, "unit": "g", "calories": 330 }
]
}/api/v1/meals/:idGet a specific meal.
/api/v1/meals/:idUpdate a meal.
/api/v1/meals/:idDelete a meal.
/api/v1/nutrition/dailyGet daily consumption summary.
Query Parameters
/api/v1/nutrition/weeklyGet 7-day nutrition summary.
Query Parameters
/api/v1/waterAdd water intake.
{ "amount": 250, "date": "2025-01-15" }/api/v1/stepsGet steps history.
Query Parameters
/api/v1/stepsLog steps for a date.
{ "steps": 8500, "date": "2025-01-15" }/api/v1/weightGet weight history.
Query Parameters
/api/v1/weightLog a weight entry.
{ "weightInKg": 72.5, "date": "2025-01-15" }/api/v1/weight/:idDelete a weight entry.
/api/v1/journalList journal entries.
Query Parameters
/api/v1/journalCreate a journal entry.
{ "content": "Today I felt...", "mood": "happy" }/api/v1/journal/:idDelete a journal entry.
/api/v1/meditationList meditation sessions.
Query Parameters
/api/v1/meditationLog a meditation session.
{ "durationInMinutes": 15, "type": "guided", "notes": "Breathing focus" }/api/v1/meditation/:idDelete a session.
/api/v1/saved-mealsList saved meal templates.
Query Parameters
/api/v1/saved-mealsSave a meal as a template.
{
"name": "Morning Oatmeal",
"calories": 350,
"protein": 12,
"carbs": 55,
"fat": 8
}/api/v1/saved-meals/:idDelete a saved meal.
/api/v1/analyze/food-imageAnalyze a food image with AI.
{ "imageBase64": "<base64_encoded_image>", "mealType": "lunch" }/api/v1/analyze/meal-descriptionAnalyze a text description of a meal.
{ "description": "Grilled chicken with rice and broccoli", "mealType": "dinner" }/api/v1/coaches/eatingChat with the eating coach.
{
"message": "What should I eat for dinner?",
"conversationHistory": [
{ "role": "user", "content": "I had oatmeal for breakfast" },
{ "role": "assistant", "content": "Great start! ..." }
]
}/api/v1/coaches/mindfulnessChat with the mindfulness coach.
{ "message": "I'm feeling stressed today" }/api/v1/coaches/meditationChat with the meditation coach.
{ "message": "Can you guide me through a 5-minute meditation?" }/api/v1/keysCreate a new API key (accepts Firebase ID token or existing API key).
{ "name": "My App Key" }/api/v1/keysList your active API keys.
/api/v1/keys/:idRevoke an API key.
All errors follow a consistent format:
{ "error": "Description of the error" }