The DataBody REST API powers the iOS app, CLI, MCP server, and every third-party integration. Bearer tokens for first-party clients, OAuth 2.0 with PKCE for everyone else. JSON in, JSON out.
DataBody uses Bearer token authentication. Include your token in the Authorization header:
Authorization: Bearer YOUR_TOKEN
Obtain a token by logging in via POST /api/v1/session or registering via POST /api/v1/registration.
https://databody.app/api/v1
All API requests should be made to this base URL. Requests must include Content-Type: application/json for POST/PATCH requests.
The API returns standard HTTP status codes:
| 200 | Success |
| 201 | Created |
| 401 | Unauthorized — Invalid or missing token |
| 402 | Payment Required — Subscription needed for AI features |
| 404 | Not Found |
| 422 | Unprocessable Entity — Validation errors |
| 429 | Too Many Requests — Token limit exceeded |
{
"error": "Invalid email or password",
"errors": ["Email address can't be blank"]
}
Create a new user account and receive an authentication token.
| Parameter | Type | Required | Description |
|---|---|---|---|
email_address | string | Yes | User's email |
password | string | Yes | Password (min 8 chars) |
password_confirmation | string | Yes | Password confirmation |
height_cm | number | No | Height in centimeters |
sex | string | No | "male" or "female" |
birth_date | string | No | YYYY-MM-DD format |
activity_level | string | No | sedentary, light, moderate, active, very_active |
{
"token": "abc123...",
"user": {
"id": 1,
"email_address": "[email protected]",
"height_cm": 175.5,
"sex": "male",
"activity_level": "moderate"
}
}
Authenticate and receive an access token.
| Parameter | Type | Description |
|---|---|---|
email_address | string | User's email |
password | string | User's password |
{
"token": "abc123...",
"user": {
"id": 1,
"email_address": "[email protected]"
}
}
Invalidate the current access token.
Authenticate using Apple identity token.
| Parameter | Type | Description |
|---|---|---|
identity_token | string | Apple ID token from Sign in with Apple |
user_identifier | string | Apple user identifier |
email | string | User email (first login only) |
full_name | string | User's name (first login only) |
Create a guest account tied to a device. Returns existing guest if device already registered.
| Parameter | Type | Description |
|---|---|---|
device_id | string | Required. Unique device identifier |
timezone | string | Optional. User's timezone (e.g., "America/Los_Angeles") |
Upgrade a guest account to a full account with email/password.
Get the authenticated user's profile.
{
"id": 1,
"email_address": "[email protected]",
"name": "John Doe",
"username": "johndoe",
"height_cm": 180.0,
"sex": "male",
"age": 30,
"activity_level": "moderate",
"activity_multiplier": 1.55,
"timezone": "America/New_York"
}
Update profile fields like height, activity level, etc.
| Parameter | Type | Description |
|---|---|---|
name | string | Display name |
username | string | Unique username |
height_cm | number | Height in cm |
sex | string | "male" or "female" |
birth_date | string | YYYY-MM-DD |
activity_level | string | Activity level |
timezone | string | IANA timezone |
Initiate account deletion. Fails if user has active subscription (must cancel first). Data is scheduled for permanent deletion.
Sync health snapshots and workouts from HealthKit or other sources.
{
"snapshots": [
{
"recorded_at": "2024-01-15",
"weight_kg": 80.5,
"body_fat_percentage": 20.0,
"steps": 8000
}
],
"workouts": [
{
"healthkit_uuid": "uuid-123",
"workout_type": "running",
"started_at": "2024-01-15T10:00:00Z",
"ended_at": "2024-01-15T11:00:00Z",
"duration_minutes": 60,
"calories_burned": 500
}
]
}
Get dashboard data including today's macros, body stats, weight trends, and recent workouts.
{
"today": {
"calories": 1500,
"protein": 120,
"carbs": 150,
"fat": 50
},
"latest_snapshot": {
"weight_kg": 80.5,
"body_fat_percentage": 20.0
},
"weight_trend": [...],
"recent_workouts": [...],
"subscription": {...}
}
Get health snapshots for a date range.
| Parameter | Type |
|---|---|
start_date | YYYY-MM-DD |
end_date | YYYY-MM-DD |
Get today's nutrition logs with totals and remaining macros.
{
"logs": [...],
"totals": {
"calories": 1500,
"protein": 120,
"carbs": 150,
"fat": 50
},
"remaining": {
"calories": 500,
"protein": 30
}
}
Get nutrition logs for a date range. Up to 30 days of history.
| Parameter | Type |
|---|---|
start_date | YYYY-MM-DD |
end_date | YYYY-MM-DD |
Create a new nutrition log with food items.
{
"meal_type": "lunch",
"logged_at": "2024-01-15T12:30:00Z",
"caption": "Healthy lunch!",
"visibility": "meal_public",
"nutrition_items_attributes": [
{
"name": "Chicken Breast",
"calories": 165,
"protein_grams": 31,
"carbs_grams": 0,
"fat_grams": 3.6,
"serving_quantity": 1.5
}
]
}
Add a food item to an existing nutrition log.
| Parameter | Type | Description |
|---|---|---|
name | string | Required |
calories | number | Calories |
protein_grams | number | Protein in grams |
carbs_grams | number | Carbs in grams |
fat_grams | number | Fat in grams |
serving_quantity | number | Number of servings |
Get the user's active fitness goal with macro targets.
{
"id": 1,
"mode": "cut",
"target_body_fat_percentage": 15.0,
"daily_calorie_target": 2000,
"daily_protein_grams": 180,
"daily_carbs_grams": 200,
"daily_fat_grams": 67,
"strategy": "moderate",
"active": true
}
Create a new fitness goal. Supports both cut and bulk modes.
| Parameter | Value |
|---|---|
mode | "cut" |
target_body_fat_percentage | Target body fat % |
strategy | conservative, moderate, aggressive |
| Parameter | Value |
|---|---|
mode | "bulk" |
target_lean_mass_lbs | Target lean mass in pounds |
weekly_weight_gain_percentage | Weekly gain rate (e.g., 0.35) |
Calculate macro targets based on current health data. Returns TDEE, deficit/surplus, and projected timeline.
Get last 7 days of workouts with summary statistics.
{
"workouts": [...],
"summary": {
"total_workouts": 5,
"total_calories": 2500,
"total_duration_minutes": 300
}
}
Log a manual workout. Calories auto-estimated using MET values if not provided.
| Parameter | Type |
|---|---|
workout_type | running, cycling, strength_training, etc. |
started_at | ISO 8601 timestamp |
ended_at | ISO 8601 timestamp |
duration_minutes | Duration in minutes |
calories_burned | Optional. Auto-calculated if omitted |
Search food databases (FatSecret, USDA, OpenFoodFacts) for nutrition data.
| Parameter | Description |
|---|---|
query | Required. Search term (e.g., "chicken breast") |
source | Optional. fatsecret, usda, openfoodfacts |
{
"query": "chicken",
"source": "fatsecret",
"results": [
{
"id": "1641",
"name": "Chicken Breast",
"calories": 165,
"protein": 31,
"carbs": 0,
"fat": 3.6
}
]
}
Look up product by UPC/EAN barcode. Returns 404 if not found.
Get user's saved favorite foods.
Add a food to favorites.
Remove food from favorites.
Send a message to the AI coach. Returns complete response.
| Parameter | Description |
|---|---|
message | Required. User's message |
thread_id | Optional. Chat thread ID for context |
Stream AI response using Server-Sent Events (SSE).
Analyze a food photo and estimate nutrition information.
Send image as base64 or multipart form data.
| Parameter | Description |
|---|---|
image | Required. Base64 encoded image or file upload |
Get AI-generated meal suggestions based on remaining macros and preferences.
{
"remaining_macros": {
"calories": 800,
"protein": 50
},
"suggestions": [
{
"name": "Grilled Salmon with Vegetables",
"calories": 450,
"protein": 35,
"carbs": 20,
"fat": 25
}
]
}
List all chat threads.
Create a new chat thread.
Get thread with all messages.
Get public posts from followed users. Supports cursor-based pagination.
| Parameter | Description |
|---|---|
limit | Number of posts (default 20) |
cursor | Pagination cursor from previous response |
{
"posts": [
{
"id": 1,
"user": {"username": "friend"},
"meal_type": "lunch",
"items": [...],
"photos": [{"url": "..."}],
"reactions": {"heart": 5},
"comments_count": 3
}
],
"next_cursor": "abc123"
}
Get list of users you follow.
Get list of your followers.
Send follow request. Params: user_id or username
Unfollow a user.
Add reaction to a post. Params: emoji
Remove your reaction from a post.
Get all grocery lists. Filter by status (active, completed, archived).
Get the most recent active list with items grouped by category.
Create a new grocery list with optional store and budget.
| Parameter | Description |
|---|---|
name | Required. List name |
store | Optional. Store name |
budget | Optional. Budget amount |
Add item. Auto-categorized by AI (produce, dairy, meat, etc.).
Toggle item completion status.
List all your saved recipes.
[
{
"id": 1,
"name": "Chicken Salad",
"description": "A healthy salad",
"servings": 4,
"calories_per_serving": 250,
"protein_per_serving": 30
}
]
Save a new recipe with nutrition info.
| Parameter | Description |
|---|---|
name | Required. Recipe name |
description | Optional. Description |
servings | Number of servings |
calories_per_serving | Calories per serving |
protein_per_serving | Protein in grams |
carbs_per_serving | Carbs in grams |
fat_per_serving | Fat in grams |
Get current subscription status, plan details, and AI availability.
{
"status": "active",
"plan": "pro_monthly",
"provider": "app_store",
"ai_available": true,
"expires_at": "2024-02-15T00:00:00Z",
"usage": {
"tokens_used": 50000,
"tokens_limit": 100000
}
}
Verify and activate an App Store subscription.
| Parameter | Description |
|---|---|
original_transaction_id | Required. Transaction ID from StoreKit |
product_id | Required. Product identifier |
Restore purchases from App Store.
| Free | 60 req / min · 10k req / day |
| Pro | 600 req / min · unlimited daily |
| AI chat | Gated by subscription token budget |
| 429 | Returned when token limit exceeded |
40+ endpoints. Same auth for iOS, CLI, MCP, and your own integrations.