DataBody databody v2.0
Search docs K
Docs Download · iOS
REST API · v2 · BEARER + OAUTH

Query your body
over HTTPS.

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.

REST · JSON Bearer tokens OAuth 2.0 + PKCE SSE streaming Webhooks 40+ endpoints
api.databody.ai curl
export DB_TOKEN="your_token_here"
curl -sH "Authorization: Bearer $DB_TOKEN" \
https://databody.app/api/v1/health/summary
→ 200 · 18ms
{
"today": {
"calories": 1500,
"protein": 120,
"carbs": 150,
"fat": 50
},
"latest_snapshot": {
"weight_kg": 80.5,
"body_fat_percentage": 20.0
}
}
api.databody.ai · Bearer + OAuth ◉ 99.97% uptime
00CONTENTS

Jump to any endpoint.

40+ endpoints across 13 resource groups. Everything below is versioned under /api/v1.
schema · 2026-04-24
01GETTING STARTED

Auth, base URL, errors

3 topics
AUTHENTICATION

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.

OAuth 2.0 For third-party integrations, DataBody supports OAuth 2.0 with PKCE. See the CLI documentation for details.
BASE URL
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.

ERROR HANDLING

The API returns standard HTTP status codes:

200Success
201Created
401Unauthorized — Invalid or missing token
402Payment Required — Subscription needed for AI features
404Not Found
422Unprocessable Entity — Validation errors
429Too Many Requests — Token limit exceeded
Error Response
{
  "error": "Invalid email or password",
  "errors": ["Email address can't be blank"]
}
02AUTH

Register, login, Apple, guests

6 endpoints
POST /api/v1/registration Register

Create a new user account and receive an authentication token.

Request Body
ParameterTypeRequiredDescription
email_addressstringYesUser's email
passwordstringYesPassword (min 8 chars)
password_confirmationstringYesPassword confirmation
height_cmnumberNoHeight in centimeters
sexstringNo"male" or "female"
birth_datestringNoYYYY-MM-DD format
activity_levelstringNosedentary, light, moderate, active, very_active
Response
{
  "token": "abc123...",
  "user": {
    "id": 1,
    "email_address": "[email protected]",
    "height_cm": 175.5,
    "sex": "male",
    "activity_level": "moderate"
  }
}
POST /api/v1/session Login

Authenticate and receive an access token.

Request Body
ParameterTypeDescription
email_addressstringUser's email
passwordstringUser's password
Response
{
  "token": "abc123...",
  "user": {
    "id": 1,
    "email_address": "[email protected]"
  }
}
DELETE /api/v1/session Logout

Invalidate the current access token.

POST /api/v1/auth/apple Sign in with Apple

Authenticate using Apple identity token.

Request Body
ParameterTypeDescription
identity_tokenstringApple ID token from Sign in with Apple
user_identifierstringApple user identifier
emailstringUser email (first login only)
full_namestringUser's name (first login only)
POST /api/v1/guests Create Guest

Create a guest account tied to a device. Returns existing guest if device already registered.

ParameterTypeDescription
device_idstringRequired. Unique device identifier
timezonestringOptional. User's timezone (e.g., "America/Los_Angeles")
POST /api/v1/guests/upgrade Upgrade Guest

Upgrade a guest account to a full account with email/password.

03USER

Profile · read, update, delete

3 endpoints
GET /api/v1/users/me Get Profile

Get the authenticated user's profile.

Response
{
  "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"
}
PATCH /api/v1/users/me Update Profile

Update profile fields like height, activity level, etc.

Request Body (all fields optional)
ParameterTypeDescription
namestringDisplay name
usernamestringUnique username
height_cmnumberHeight in cm
sexstring"male" or "female"
birth_datestringYYYY-MM-DD
activity_levelstringActivity level
timezonestringIANA timezone
DELETE /api/v1/users/me Delete Account

Initiate account deletion. Fails if user has active subscription (must cancel first). Data is scheduled for permanent deletion.

04HEALTH DATA

Sync, summary, history

3 endpoints
POST /api/v1/health_sync Sync Health Data

Sync health snapshots and workouts from HealthKit or other sources.

Request Body
{
  "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 /api/v1/health/summary Health Summary

Get dashboard data including today's macros, body stats, weight trends, and recent workouts.

Response
{
  "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 /api/v1/health/history Health History

Get health snapshots for a date range.

Query Parameters
ParameterType
start_dateYYYY-MM-DD
end_dateYYYY-MM-DD
05NUTRITION

Log meals, query macros

4 endpoints
GET /api/v1/nutrition/today Today's Nutrition

Get today's nutrition logs with totals and remaining macros.

Response
{
  "logs": [...],
  "totals": {
    "calories": 1500,
    "protein": 120,
    "carbs": 150,
    "fat": 50
  },
  "remaining": {
    "calories": 500,
    "protein": 30
  }
}
GET /api/v1/nutrition/history Nutrition History

Get nutrition logs for a date range. Up to 30 days of history.

Query Parameters
ParameterType
start_dateYYYY-MM-DD
end_dateYYYY-MM-DD
POST /api/v1/nutrition Log Meal

Create a new nutrition log with food items.

Request Body
{
  "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
    }
  ]
}
fields meal_type: breakfast, lunch, dinner, snack
logged_at: ISO 8601 timestamp. Supports past dates for backfilling meals (default: now)
visibility: meal_private (default), meal_public
POST /api/v1/nutrition/:id/items Add Item to Meal

Add a food item to an existing nutrition log.

ParameterTypeDescription
namestringRequired
caloriesnumberCalories
protein_gramsnumberProtein in grams
carbs_gramsnumberCarbs in grams
fat_gramsnumberFat in grams
serving_quantitynumberNumber of servings
06GOALS

Cut, bulk, calculated macros

3 endpoints
GET /api/v1/goals/current Current Goal

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
}
POST /api/v1/goals Create Goal

Create a new fitness goal. Supports both cut and bulk modes.

Cut Mode
ParameterValue
mode"cut"
target_body_fat_percentageTarget body fat %
strategyconservative, moderate, aggressive
Bulk Mode
ParameterValue
mode"bulk"
target_lean_mass_lbsTarget lean mass in pounds
weekly_weight_gain_percentageWeekly gain rate (e.g., 0.35)
POST /api/v1/goals/:id/calculate Calculate Macros

Calculate macro targets based on current health data. Returns TDEE, deficit/surplus, and projected timeline.

07WORKOUTS

Recent activity, manual log

2 endpoints
GET /api/v1/workouts/recent Recent Workouts

Get last 7 days of workouts with summary statistics.

Response
{
  "workouts": [...],
  "summary": {
    "total_workouts": 5,
    "total_calories": 2500,
    "total_duration_minutes": 300
  }
}
POST /api/v1/workouts Log Workout

Log a manual workout. Calories auto-estimated using MET values if not provided.

ParameterType
workout_typerunning, cycling, strength_training, etc.
started_atISO 8601 timestamp
ended_atISO 8601 timestamp
duration_minutesDuration in minutes
calories_burnedOptional. Auto-calculated if omitted
08FOOD DATABASE

Search, barcode, favorites

5 endpoints
GET /api/v1/foods/barcode/:barcode Barcode Lookup

Look up product by UPC/EAN barcode. Returns 404 if not found.

GET /api/v1/foods/favorites List Favorites

Get user's saved favorite foods.

POST /api/v1/foods/favorites Add Favorite

Add a food to favorites.

DELETE /api/v1/foods/favorites/:id Remove Favorite

Remove food from favorites.

09AI FEATURES

Chat, photo, suggestions, threads

7 endpoints
402 Subscription Required. AI endpoints require an active subscription or trial period.
POST /api/v1/ai/chat AI Chat

Send a message to the AI coach. Returns complete response.

ParameterDescription
messageRequired. User's message
thread_idOptional. Chat thread ID for context
POST /api/v1/ai/chat_stream AI Chat (SSE)

Stream AI response using Server-Sent Events (SSE).

POST /api/v1/ai/analyze_photo Analyze Photo

Analyze a food photo and estimate nutrition information.

Send image as base64 or multipart form data.

ParameterDescription
imageRequired. Base64 encoded image or file upload
GET /api/v1/ai/suggestions Meal Suggestions

Get AI-generated meal suggestions based on remaining macros and preferences.

Response
{
  "remaining_macros": {
    "calories": 800,
    "protein": 50
  },
  "suggestions": [
    {
      "name": "Grilled Salmon with Vegetables",
      "calories": 450,
      "protein": 35,
      "carbs": 20,
      "fat": 25
    }
  ]
}
GET /api/v1/chat_threads List Threads

List all chat threads.

POST /api/v1/chat_threads Create Thread

Create a new chat thread.

GET /api/v1/chat_threads/:id Get Thread

Get thread with all messages.

10SOCIAL

Feed, follows, reactions

7 endpoints
GET /api/v1/feed Friend Feed

Get public posts from followed users. Supports cursor-based pagination.

Query Parameters
ParameterDescription
limitNumber of posts (default 20)
cursorPagination cursor from previous response
Response
{
  "posts": [
    {
      "id": 1,
      "user": {"username": "friend"},
      "meal_type": "lunch",
      "items": [...],
      "photos": [{"url": "..."}],
      "reactions": {"heart": 5},
      "comments_count": 3
    }
  ],
  "next_cursor": "abc123"
}
GET /api/v1/follows/following Following

Get list of users you follow.

GET /api/v1/follows/followers Followers

Get list of your followers.

POST /api/v1/follows Follow

Send follow request. Params: user_id or username

DELETE /api/v1/follows/:user_id Unfollow

Unfollow a user.

POST /api/v1/feed/:post_id/reactions Add Reaction

Add reaction to a post. Params: emoji

DELETE /api/v1/feed/:post_id/reactions/:emoji Remove Reaction

Remove your reaction from a post.

11GROCERY LISTS

Lists, items, categorization

5 endpoints
GET /api/v1/grocery_lists List Grocery Lists

Get all grocery lists. Filter by status (active, completed, archived).

GET /api/v1/grocery_lists/current Current List

Get the most recent active list with items grouped by category.

POST /api/v1/grocery_lists Create List

Create a new grocery list with optional store and budget.

ParameterDescription
nameRequired. List name
storeOptional. Store name
budgetOptional. Budget amount
POST /api/v1/grocery_lists/:id/grocery_items Add Item

Add item. Auto-categorized by AI (produce, dairy, meat, etc.).

POST /api/v1/grocery_lists/:list_id/grocery_items/:id/toggle Toggle Item

Toggle item completion status.

12RECIPES

Saved recipes

2 endpoints
GET /api/v1/recipes List Recipes

List all your saved recipes.

Response
[
  {
    "id": 1,
    "name": "Chicken Salad",
    "description": "A healthy salad",
    "servings": 4,
    "calories_per_serving": 250,
    "protein_per_serving": 30
  }
]
POST /api/v1/recipes Create Recipe

Save a new recipe with nutrition info.

ParameterDescription
nameRequired. Recipe name
descriptionOptional. Description
servingsNumber of servings
calories_per_servingCalories per serving
protein_per_servingProtein in grams
carbs_per_servingCarbs in grams
fat_per_servingFat in grams
13SUBSCRIPTIONS

Status, App Store, restore

3 endpoints
GET /api/v1/subscription Subscription Status

Get current subscription status, plan details, and AI availability.

Response
{
  "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
  }
}
POST /api/v1/subscription/verify_app_store Verify App Store

Verify and activate an App Store subscription.

ParameterDescription
original_transaction_idRequired. Transaction ID from StoreKit
product_idRequired. Product identifier
POST /api/v1/subscription/restore Restore Purchases

Restore purchases from App Store.

14RATE LIMITS · FEATURES

Limits, webhooks, streaming

reference
RATE LIMITS
per token
Free60 req / min · 10k req / day
Pro600 req / min · unlimited daily
AI chatGated by subscription token budget
429Returned when token limit exceeded
SURFACE AREA
v2 · 2026-04-24
Bearer tokens OAuth 2.0 + PKCE JSON SSE streaming Webhooks Idempotent POSTs Cursor pagination ISO 8601 timestamps IANA timezones
API v2 · BEARER + OAUTH · 2026-04-24

Build on DataBody.

40+ endpoints. Same auth for iOS, CLI, MCP, and your own integrations.