openfood API

REST API of openfood. Errors use one envelope {error: {code, message}}. Generated from the running code. openapi.json

GET/.well-known/og-connect-jwks.json

og-connect subject assertion keys

GET/api/docs

API reference (HTML)

GET/api/health

Release health per component

GET/api/revision

Release revision (plain text)

GET/api/v1/admin/agents/status

Aggregate agent keys and calls (admin)

POST/api/v1/admin/community/provision

Start or resume community provisioning

{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "resume": {
      "type": "boolean"
    }
  }
}

POST/api/v1/admin/community/round-trip

Send a test chat message and wait for the AI cook reply

{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "wait_ms": {
      "type": "integer",
      "minimum": 0,
      "maximum": 25000
    }
  }
}

GET/api/v1/admin/community/status

Community provisioning and AI cook verification

GET/api/v1/admin/dashboard/status

Get aggregate dashboard activity

GET/api/v1/admin/foods/coverage

Measured name coverage of the top foods per locale (admin)

GET/api/v1/admin/foods/imports

Nutrition import history (admin)

GET/api/v1/admin/foods/synonyms

Synonym review queue (admin)

POST/api/v1/admin/foods/synonyms/{id}/review

Approve or reject a synonym (admin)

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "status"
  ],
  "properties": {
    "status": {
      "anyOf": [
        {
          "const": "approved",
          "type": "string"
        },
        {
          "const": "rejected",
          "type": "string"
        },
        {
          "const": "pending_review",
          "type": "string"
        }
      ]
    }
  }
}

GET/api/v1/admin/goals/status

Goal estimator settings and aggregate check-in and insight activity

GET/api/v1/admin/ops/insights

Settings, journey metrics, inference usage and product usage counts, 7 days, aggregates only (admin)

GET/api/v1/admin/ops/status

Operational summary: revision, health, job queue and privacy erasure status (admin)

GET/api/v1/admin/quick-log/status

Aggregate quick log and correction activity

PUT/api/v1/admin/scans/quotas

Set daily AI quotas by actor class

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "guest",
    "account",
    "agent"
  ],
  "properties": {
    "guest": {
      "minimum": 0,
      "maximum": 10000,
      "type": "integer"
    },
    "account": {
      "minimum": 0,
      "maximum": 10000,
      "type": "integer"
    },
    "agent": {
      "minimum": 0,
      "maximum": 10000,
      "type": "integer"
    }
  }
}

GET/api/v1/admin/scans/settings

Get scan quotas, certainty thresholds and inference health

GET/api/v1/agent-keys

List your agent keys (person only)

POST/api/v1/agent-keys

Create an agent key; the secret is shown once (person only)

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "name",
    "scopes"
  ],
  "properties": {
    "name": {
      "minLength": 1,
      "maxLength": 60,
      "pattern": "\\S",
      "type": "string"
    },
    "scopes": {
      "minItems": 1,
      "maxItems": 4,
      "uniqueItems": true,
      "type": "array",
      "items": {
        "anyOf": [
          {
            "const": "diary:read",
            "type": "string"
          },
          {
            "const": "diary:write",
            "type": "string"
          },
          {
            "const": "scans:write",
            "type": "string"
          },
          {
            "const": "profile:read",
            "type": "string"
          }
        ]
      }
    },
    "expires_in_days": {
      "anyOf": [
        {
          "const": 7,
          "type": "number"
        },
        {
          "const": 30,
          "type": "number"
        },
        {
          "const": 90,
          "type": "number"
        },
        {
          "const": 365,
          "type": "number"
        },
        {
          "type": "null"
        }
      ]
    }
  }
}

GET/api/v1/agent-keys/activity

What your agents did recently (person only)

DELETE/api/v1/agent-keys/{id}

Revoke an agent key at once (person only)

POST/api/v1/agent-tasks

Preview a multi-step task

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "kind"
  ],
  "properties": {
    "kind": {
      "description": "plan_and_shop: plan empty slots from your own library, then build the shopping list and show what you already have. replace_meal: swap the meal planned at date+slot for the best alternative from your library, then rebuild the shopping list (needs date and slot)",
      "anyOf": [
        {
          "const": "plan_and_shop",
          "type": "string"
        },
        {
          "const": "replace_meal",
          "type": "string"
        }
      ]
    },
    "date": {
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
      "description": "Local date YYYY-MM-DD in the meal timezone",
      "type": "string"
    },
    "slot": {
      "anyOf": [
        {
          "const": "breakfast",
          "type": "string"
        },
        {
          "const": "lunch",
          "type": "string"
        },
        {
          "const": "dinner",
          "type": "string"
        },
        {
          "const": "snack",
          "type": "string"
        }
      ]
    },
    "from": {
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
      "description": "Local date YYYY-MM-DD in the meal timezone",
      "type": "string"
    },
    "days": {
      "minimum": 1,
      "maximum": 14,
      "description": "Days in the window (default 5)",
      "type": "integer"
    },
    "slots": {
      "maxLength": 40,
      "pattern": "^[a-z]+(,[a-z]+){0,3}$",
      "description": "Comma list of breakfast, lunch, dinner, snack (default lunch,dinner)",
      "type": "string"
    },
    "fit": {
      "description": "Scale each planned slot to its energy target (0.5 to 3 servings)",
      "type": "boolean"
    },
    "max_minutes": {
      "minimum": 5,
      "maximum": 600,
      "description": "Only recipes with a stated time of at most this many minutes, e.g. 20",
      "type": "integer"
    },
    "tz": {
      "minLength": 1,
      "maxLength": 64,
      "type": "string"
    }
  }
}

GET/api/v1/agent-tasks

List your recent tasks

GET/api/v1/agent-tasks/{id}

Get a task and its progress

POST/api/v1/agent-tasks/{id}/cancel

Cancel a task

{
  "additionalProperties": false,
  "type": "object",
  "properties": {}
}

POST/api/v1/agent-tasks/{id}/confirm

Confirm and run a previewed task

{
  "additionalProperties": false,
  "type": "object",
  "properties": {}
}

GET/api/v1/ai-connect

Your connected AI (OPEN plan)

GET/api/v1/ai-connect/callback

og-connect authorization callback

POST/api/v1/ai-connect/disconnect

Disconnect your own AI

{
  "additionalProperties": false,
  "type": "object",
  "properties": {}
}

POST/api/v1/ai-connect/start

Start connecting your own AI through og-connect

{
  "additionalProperties": false,
  "type": "object",
  "properties": {}
}

POST/api/v1/ai-connect/webhook

og-connect events (signature-verified)

POST/api/v1/auth/apple/callback

Complete apple sign-in

POST/api/v1/auth/apple/start

Start apple sign-in

{
  "additionalProperties": false,
  "type": "object",
  "properties": {
    "birth_date": {
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
      "type": "string"
    }
  }
}

GET/api/v1/auth/csrf

Get a browser CSRF token

POST/api/v1/auth/email/finish

Redeem an email sign-in link

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "token"
  ],
  "properties": {
    "token": {
      "pattern": "^[A-Za-z0-9_-]{43}$",
      "type": "string"
    }
  }
}

POST/api/v1/auth/email/start

Request an email sign-in link

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "email"
  ],
  "properties": {
    "email": {
      "pattern": "^[^\\s<>@\",;:]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}$",
      "maxLength": 254,
      "type": "string"
    },
    "locale": {
      "anyOf": [
        {
          "const": "en",
          "type": "string"
        },
        {
          "const": "es",
          "type": "string"
        },
        {
          "const": "fr",
          "type": "string"
        },
        {
          "const": "de",
          "type": "string"
        },
        {
          "const": "pt",
          "type": "string"
        },
        {
          "const": "it",
          "type": "string"
        },
        {
          "const": "nl",
          "type": "string"
        },
        {
          "const": "pl",
          "type": "string"
        },
        {
          "const": "he",
          "type": "string"
        },
        {
          "const": "ar",
          "type": "string"
        },
        {
          "const": "zh-CN",
          "type": "string"
        },
        {
          "const": "ja",
          "type": "string"
        },
        {
          "const": "ko",
          "type": "string"
        },
        {
          "const": "ru",
          "type": "string"
        },
        {
          "const": "uk",
          "type": "string"
        },
        {
          "const": "tr",
          "type": "string"
        }
      ]
    },
    "birth_date": {
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
      "type": "string"
    }
  }
}

GET/api/v1/auth/google/callback

Complete google sign-in

POST/api/v1/auth/google/start

Start google sign-in

{
  "additionalProperties": false,
  "type": "object",
  "properties": {
    "birth_date": {
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
      "type": "string"
    }
  }
}

POST/api/v1/auth/guest

Start a guest session

{
  "additionalProperties": false,
  "type": "object",
  "properties": {}
}

POST/api/v1/auth/passkey/register/finish

Verify passkey registration

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "challenge",
    "credential"
  ],
  "properties": {
    "challenge": {
      "pattern": "^[A-Za-z0-9_-]{43}$",
      "type": "string"
    },
    "credential": {
      "additionalProperties": true,
      "type": "object",
      "required": [
        "id",
        "response"
      ],
      "properties": {
        "id": {
          "minLength": 1,
          "maxLength": 1400,
          "type": "string"
        },
        "response": {
          "type": "object",
          "patternProperties": {
            "^(.*)$": {}
          }
        }
      }
    }
  }
}

POST/api/v1/auth/passkey/register/options

Start passkey registration

{
  "additionalProperties": false,
  "type": "object",
  "properties": {
    "birth_date": {
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
      "type": "string"
    }
  }
}

POST/api/v1/auth/passkey/sign-in/finish

Verify passkey assertion

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "challenge",
    "credential"
  ],
  "properties": {
    "challenge": {
      "pattern": "^[A-Za-z0-9_-]{43}$",
      "type": "string"
    },
    "credential": {
      "additionalProperties": true,
      "type": "object",
      "required": [
        "id",
        "response"
      ],
      "properties": {
        "id": {
          "minLength": 1,
          "maxLength": 1400,
          "type": "string"
        },
        "response": {
          "type": "object",
          "patternProperties": {
            "^(.*)$": {}
          }
        }
      }
    }
  }
}

POST/api/v1/auth/passkey/sign-in/options

Start passkey sign-in

{
  "additionalProperties": false,
  "type": "object",
  "properties": {}
}

GET/api/v1/auth/providers

List sign-in providers

POST/api/v1/auth/sign-out

Revoke browser session

{
  "additionalProperties": false,
  "type": "object",
  "properties": {}
}

GET/api/v1/billing

Get plan and AI usage

GET/api/v1/billing/apple/account-token

Your appAccountToken for App Store purchases

POST/api/v1/billing/apple/notifications

App Store Server Notifications v2 (signature-verified)

{
  "type": "object",
  "required": [
    "signedPayload"
  ],
  "properties": {
    "signedPayload": {
      "minLength": 20,
      "maxLength": 16384,
      "pattern": "^[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+$",
      "type": "string"
    }
  }
}

POST/api/v1/billing/apple/verify

Verify an App Store signed transaction and unlock Plus

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "signed_transaction"
  ],
  "properties": {
    "signed_transaction": {
      "minLength": 20,
      "maxLength": 16384,
      "pattern": "^[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+$",
      "type": "string"
    },
    "restore": {
      "description": "true from Restore Purchases: moves the subscription to this account",
      "type": "boolean"
    }
  }
}

POST/api/v1/billing/checkout

Start a Stripe Checkout for Plus

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "interval"
  ],
  "properties": {
    "interval": {
      "anyOf": [
        {
          "const": "monthly",
          "type": "string"
        },
        {
          "const": "yearly",
          "type": "string"
        }
      ]
    }
  }
}

POST/api/v1/billing/checkout/confirm

Confirm a completed Stripe Checkout on return

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "session_id"
  ],
  "properties": {
    "session_id": {
      "pattern": "^cs_[A-Za-z0-9_]{3,250}$",
      "type": "string"
    }
  }
}

POST/api/v1/billing/portal

Open the Stripe Customer Portal to manage or cancel

POST/api/v1/billing/stripe/webhook

Stripe webhook (signature-verified)

POST/api/v1/capture/calories

Log manually entered calories

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "tz",
    "meal_type",
    "name",
    "kcal"
  ],
  "properties": {
    "tz": {
      "minLength": 1,
      "maxLength": 64,
      "type": "string"
    },
    "meal_type": {
      "anyOf": [
        {
          "const": "breakfast",
          "type": "string"
        },
        {
          "const": "lunch",
          "type": "string"
        },
        {
          "const": "dinner",
          "type": "string"
        },
        {
          "const": "snack",
          "type": "string"
        },
        {
          "const": "other",
          "type": "string"
        }
      ]
    },
    "consent": {
      "additionalProperties": false,
      "type": "object",
      "required": [
        "version"
      ],
      "properties": {
        "version": {
          "minLength": 1,
          "maxLength": 32,
          "type": "string"
        }
      }
    },
    "name": {
      "minLength": 1,
      "maxLength": 200,
      "pattern": "\\S",
      "type": "string"
    },
    "kcal": {
      "exclusiveMinimum": 0,
      "maximum": 100000,
      "type": "number"
    },
    "locale": {
      "description": "UI locale (16 locales; pt = PT-PT)",
      "anyOf": [
        {
          "const": "en",
          "type": "string"
        },
        {
          "const": "es",
          "type": "string"
        },
        {
          "const": "fr",
          "type": "string"
        },
        {
          "const": "de",
          "type": "string"
        },
        {
          "const": "pt",
          "type": "string"
        },
        {
          "const": "it",
          "type": "string"
        },
        {
          "const": "nl",
          "type": "string"
        },
        {
          "const": "pl",
          "type": "string"
        },
        {
          "const": "he",
          "type": "string"
        },
        {
          "const": "ar",
          "type": "string"
        },
        {
          "const": "zh-CN",
          "type": "string"
        },
        {
          "const": "ja",
          "type": "string"
        },
        {
          "const": "ko",
          "type": "string"
        },
        {
          "const": "ru",
          "type": "string"
        },
        {
          "const": "uk",
          "type": "string"
        },
        {
          "const": "tr",
          "type": "string"
        }
      ]
    },
    "logged_at": {
      "format": "date-time",
      "type": "string"
    }
  }
}

GET/api/v1/checkins

Get check-in

POST/api/v1/checkins

Run check-in

{
  "additionalProperties": false,
  "type": "object",
  "properties": {}
}

PUT/api/v1/checkins/day

Confirm an intake day

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "date",
    "confirmed"
  ],
  "properties": {
    "date": {
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
      "type": "string"
    },
    "confirmed": {
      "type": "boolean"
    }
  }
}

POST/api/v1/checkins/decision

Decide a check-in

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "id",
    "accept"
  ],
  "properties": {
    "id": {
      "format": "uuid",
      "type": "string"
    },
    "accept": {
      "type": "boolean"
    }
  }
}

GET/api/v1/community/chat

Chat with an AI cook

POST/api/v1/community/chat

Message an AI cook

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "cook_id",
    "body"
  ],
  "properties": {
    "cook_id": {
      "format": "uuid",
      "type": "string"
    },
    "body": {
      "minLength": 1,
      "maxLength": 2000,
      "pattern": "\\S",
      "type": "string"
    }
  }
}

GET/api/v1/community/chats

Your chats with AI cooks

POST/api/v1/community/comments

Comment on a community post

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "post_id",
    "body"
  ],
  "properties": {
    "post_id": {
      "format": "uuid",
      "type": "string"
    },
    "body": {
      "minLength": 1,
      "maxLength": 2000,
      "pattern": "\\S",
      "type": "string"
    }
  }
}

GET/api/v1/community/cook

AI cook profile

GET/api/v1/community/cooks

Find AI cooks

GET/api/v1/community/feed

Community feed

POST/api/v1/community/follow

Follow or unfollow an AI cook

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "cook_id",
    "follow"
  ],
  "properties": {
    "cook_id": {
      "format": "uuid",
      "type": "string"
    },
    "follow": {
      "type": "boolean"
    }
  }
}

GET/api/v1/community/media/{file}

Community image (CC0 or public domain)

GET/api/v1/community/post

Community post with comments

POST/api/v1/community/save-recipe

Save a cook's recipe to your library

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "post_id"
  ],
  "properties": {
    "post_id": {
      "format": "uuid",
      "type": "string"
    }
  }
}

GET/api/v1/consents

Read consent status and history

POST/api/v1/consents

Give health-data consent in settings

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "version"
  ],
  "properties": {
    "version": {
      "minLength": 1,
      "maxLength": 32,
      "type": "string"
    }
  }
}

POST/api/v1/consents/withdraw

Withdraw health-data consent

{
  "additionalProperties": false,
  "type": "object",
  "properties": {}
}

GET/api/v1/dashboard/history

Get calendar marks or timeline detail

GET/api/v1/dashboard/nutrients

Get daily averages for logged days

GET/api/v1/dashboard/photos/{id}

Get a private meal thumbnail URL

GET/api/v1/dashboard/today

Get the daily dashboard

GET/api/v1/days

Daily totals in a date range (cursor pagination)

GET/api/v1/days/{date}

One day: meals and totals (unknown stays unknown)

POST/api/v1/events/journey

Record an anonymous journey step (taps, time)

{
  "additionalProperties": false,
  "description": "Anonymous journey metric: no user id, no PII",
  "type": "object",
  "required": [
    "journey",
    "step",
    "taps",
    "duration_ms",
    "client_revision"
  ],
  "properties": {
    "journey": {
      "pattern": "^[a-z][a-z0-9_]{0,39}$",
      "description": "Journey id, e.g. j1_photo_log",
      "type": "string"
    },
    "step": {
      "pattern": "^[a-z][a-z0-9_]{0,39}$",
      "description": "Step name, e.g. start, logged",
      "type": "string"
    },
    "taps": {
      "minimum": 0,
      "maximum": 1000,
      "type": "integer"
    },
    "duration_ms": {
      "minimum": 0,
      "maximum": 3600000,
      "type": "integer"
    },
    "client_revision": {
      "pattern": "^[0-9a-z]{1,40}$",
      "type": "string"
    }
  }
}

POST/api/v1/foods

Create a private food (label scan or manual entry)

{
  "additionalProperties": false,
  "description": "Private food from a label or manual entry",
  "type": "object",
  "required": [
    "name",
    "basis",
    "nutrients"
  ],
  "properties": {
    "name": {
      "minLength": 1,
      "maxLength": 200,
      "type": "string"
    },
    "brand": {
      "maxLength": 120,
      "type": "string"
    },
    "locale": {
      "description": "UI locale (16 locales; pt = PT-PT)",
      "anyOf": [
        {
          "const": "en",
          "type": "string"
        },
        {
          "const": "es",
          "type": "string"
        },
        {
          "const": "fr",
          "type": "string"
        },
        {
          "const": "de",
          "type": "string"
        },
        {
          "const": "pt",
          "type": "string"
        },
        {
          "const": "it",
          "type": "string"
        },
        {
          "const": "nl",
          "type": "string"
        },
        {
          "const": "pl",
          "type": "string"
        },
        {
          "const": "he",
          "type": "string"
        },
        {
          "const": "ar",
          "type": "string"
        },
        {
          "const": "zh-CN",
          "type": "string"
        },
        {
          "const": "ja",
          "type": "string"
        },
        {
          "const": "ko",
          "type": "string"
        },
        {
          "const": "ru",
          "type": "string"
        },
        {
          "const": "uk",
          "type": "string"
        },
        {
          "const": "tr",
          "type": "string"
        }
      ]
    },
    "basis": {
      "default": "per_100g",
      "anyOf": [
        {
          "const": "per_100g",
          "type": "string"
        },
        {
          "const": "per_serving",
          "type": "string"
        }
      ]
    },
    "serving_grams": {
      "exclusiveMinimum": 0,
      "maximum": 5000,
      "type": "number"
    },
    "serving_label": {
      "maxLength": 120,
      "type": "string"
    },
    "nutrients": {
      "type": "object",
      "patternProperties": {
        "^[a-z][a-z0-9_]*$": {
          "minimum": 0,
          "maximum": 100000,
          "type": "number"
        }
      }
    },
    "portions": {
      "maxItems": 16,
      "type": "array",
      "items": {
        "additionalProperties": false,
        "description": "Household measure: `amount` `unit` weighs `grams`",
        "type": "object",
        "required": [
          "unit",
          "amount",
          "grams",
          "label"
        ],
        "properties": {
          "unit": {
            "type": "string"
          },
          "amount": {
            "exclusiveMinimum": 0,
            "type": "number"
          },
          "grams": {
            "exclusiveMinimum": 0,
            "type": "number"
          },
          "label": {
            "maxLength": 120,
            "type": "string"
          }
        }
      }
    },
    "barcode": {
      "pattern": "^[0-9]{8,14}$",
      "type": "string"
    },
    "nova": {
      "minimum": 1,
      "maximum": 4,
      "type": "integer"
    }
  }
}

GET/api/v1/foods/barcode/{code}

Look up a barcode (Open Food Facts, cached 30 days; not_found ⇒ scan the label)

GET/api/v1/foods/search

Search foods by name (16 locales; user locale first, then English)

GET/api/v1/foods/{id}

Get a food (nutrients per 100 g, portions, source, licence)

GET/api/v1/goals

Get targets

PUT/api/v1/goals

Set targets

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "goal",
    "sex",
    "age",
    "cm",
    "version"
  ],
  "properties": {
    "goal": {
      "anyOf": [
        {
          "const": "lose025",
          "type": "string"
        },
        {
          "const": "lose05",
          "type": "string"
        },
        {
          "const": "lose075",
          "type": "string"
        },
        {
          "const": "maintain",
          "type": "string"
        },
        {
          "const": "gain025",
          "type": "string"
        }
      ]
    },
    "sex": {
      "anyOf": [
        {
          "const": "female",
          "type": "string"
        },
        {
          "const": "male",
          "type": "string"
        }
      ]
    },
    "age": {
      "minimum": 1,
      "maximum": 130,
      "type": "integer"
    },
    "cm": {
      "minimum": 50,
      "maximum": 300,
      "type": "number"
    },
    "kg": {
      "minimum": 20,
      "maximum": 500,
      "type": "number"
    },
    "timezone": {
      "minLength": 1,
      "maxLength": 64,
      "type": "string"
    },
    "activity": {
      "anyOf": [
        {
          "const": "sedentary",
          "type": "string"
        },
        {
          "const": "light",
          "type": "string"
        },
        {
          "const": "moderate",
          "type": "string"
        },
        {
          "const": "high",
          "type": "string"
        },
        {
          "const": "very_high",
          "type": "string"
        }
      ]
    },
    "mode": {
      "anyOf": [
        {
          "const": "auto",
          "type": "string"
        },
        {
          "const": "ask",
          "type": "string"
        },
        {
          "const": "manual",
          "type": "string"
        }
      ]
    },
    "diet": {
      "anyOf": [
        {
          "const": "balanced",
          "type": "string"
        },
        {
          "const": "highProtein",
          "type": "string"
        },
        {
          "const": "lowCarb",
          "type": "string"
        },
        {
          "const": "keto",
          "type": "string"
        },
        {
          "const": "vegetarian",
          "type": "string"
        },
        {
          "const": "vegan",
          "type": "string"
        }
      ]
    },
    "macros": {
      "anyOf": [
        {
          "anyOf": [
            {
              "additionalProperties": false,
              "type": "object",
              "required": [
                "unit",
                "protein",
                "carbs",
                "fat"
              ],
              "properties": {
                "unit": {
                  "const": "grams",
                  "type": "string"
                },
                "protein": {
                  "minimum": 0,
                  "maximum": 2000,
                  "type": "number"
                },
                "carbs": {
                  "minimum": 0,
                  "maximum": 2000,
                  "type": "number"
                },
                "fat": {
                  "minimum": 0,
                  "maximum": 2000,
                  "type": "number"
                }
              }
            },
            {
              "additionalProperties": false,
              "type": "object",
              "required": [
                "unit",
                "protein",
                "carbs",
                "fat"
              ],
              "properties": {
                "unit": {
                  "const": "percent",
                  "type": "string"
                },
                "protein": {
                  "minimum": 0,
                  "maximum": 100,
                  "type": "number"
                },
                "carbs": {
                  "minimum": 0,
                  "maximum": 100,
                  "type": "number"
                },
                "fat": {
                  "minimum": 0,
                  "maximum": 100,
                  "type": "number"
                }
              }
            }
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "version": {
      "anyOf": [
        {
          "format": "uuid",
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    }
  }
}

PUT/api/v1/goals/day

Set daily macros

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "date",
    "macros"
  ],
  "properties": {
    "date": {
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
      "type": "string"
    },
    "macros": {
      "anyOf": [
        {
          "anyOf": [
            {
              "additionalProperties": false,
              "type": "object",
              "required": [
                "unit",
                "protein",
                "carbs",
                "fat"
              ],
              "properties": {
                "unit": {
                  "const": "grams",
                  "type": "string"
                },
                "protein": {
                  "minimum": 0,
                  "maximum": 2000,
                  "type": "number"
                },
                "carbs": {
                  "minimum": 0,
                  "maximum": 2000,
                  "type": "number"
                },
                "fat": {
                  "minimum": 0,
                  "maximum": 2000,
                  "type": "number"
                }
              }
            },
            {
              "additionalProperties": false,
              "type": "object",
              "required": [
                "unit",
                "protein",
                "carbs",
                "fat"
              ],
              "properties": {
                "unit": {
                  "const": "percent",
                  "type": "string"
                },
                "protein": {
                  "minimum": 0,
                  "maximum": 100,
                  "type": "number"
                },
                "carbs": {
                  "minimum": 0,
                  "maximum": 100,
                  "type": "number"
                },
                "fat": {
                  "minimum": 0,
                  "maximum": 100,
                  "type": "number"
                }
              }
            }
          ]
        },
        {
          "type": "null"
        }
      ]
    }
  }
}

GET/api/v1/insights/week

Get weekly insight

POST/api/v1/insights/week

Request weekly insight

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "locale"
  ],
  "properties": {
    "locale": {
      "anyOf": [
        {
          "const": "en",
          "type": "string"
        },
        {
          "const": "es",
          "type": "string"
        },
        {
          "const": "fr",
          "type": "string"
        },
        {
          "const": "de",
          "type": "string"
        },
        {
          "const": "pt",
          "type": "string"
        },
        {
          "const": "it",
          "type": "string"
        },
        {
          "const": "nl",
          "type": "string"
        },
        {
          "const": "pl",
          "type": "string"
        },
        {
          "const": "he",
          "type": "string"
        },
        {
          "const": "ar",
          "type": "string"
        },
        {
          "const": "zh-CN",
          "type": "string"
        },
        {
          "const": "ja",
          "type": "string"
        },
        {
          "const": "ko",
          "type": "string"
        },
        {
          "const": "ru",
          "type": "string"
        },
        {
          "const": "uk",
          "type": "string"
        },
        {
          "const": "tr",
          "type": "string"
        }
      ]
    }
  }
}

GET/api/v1/insights/week-review

Get your week review

GET/api/v1/library

List your library

GET/api/v1/library/favourites

List your favourites

PUT/api/v1/library/favourites/{kind}/{id}

Star a library item

DELETE/api/v1/library/favourites/{kind}/{id}

Unstar a library item

POST/api/v1/library/foods

Create library foods

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "name",
    "nutrients"
  ],
  "properties": {
    "name": {
      "minLength": 1,
      "maxLength": 200,
      "pattern": "\\S",
      "type": "string"
    },
    "locale": {
      "description": "UI locale (16 locales; pt = PT-PT)",
      "anyOf": [
        {
          "const": "en",
          "type": "string"
        },
        {
          "const": "es",
          "type": "string"
        },
        {
          "const": "fr",
          "type": "string"
        },
        {
          "const": "de",
          "type": "string"
        },
        {
          "const": "pt",
          "type": "string"
        },
        {
          "const": "it",
          "type": "string"
        },
        {
          "const": "nl",
          "type": "string"
        },
        {
          "const": "pl",
          "type": "string"
        },
        {
          "const": "he",
          "type": "string"
        },
        {
          "const": "ar",
          "type": "string"
        },
        {
          "const": "zh-CN",
          "type": "string"
        },
        {
          "const": "ja",
          "type": "string"
        },
        {
          "const": "ko",
          "type": "string"
        },
        {
          "const": "ru",
          "type": "string"
        },
        {
          "const": "uk",
          "type": "string"
        },
        {
          "const": "tr",
          "type": "string"
        }
      ]
    },
    "serving_grams": {
      "exclusiveMinimum": 0,
      "maximum": 5000,
      "type": "number"
    },
    "nutrients": {
      "type": "object",
      "patternProperties": {
        "^[a-z][a-z0-9_]*$": {
          "minimum": 0,
          "maximum": 100000,
          "type": "number"
        }
      }
    }
  }
}

PUT/api/v1/library/foods/{id}

Edit library foods

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "name",
    "nutrients"
  ],
  "properties": {
    "name": {
      "minLength": 1,
      "maxLength": 200,
      "pattern": "\\S",
      "type": "string"
    },
    "locale": {
      "description": "UI locale (16 locales; pt = PT-PT)",
      "anyOf": [
        {
          "const": "en",
          "type": "string"
        },
        {
          "const": "es",
          "type": "string"
        },
        {
          "const": "fr",
          "type": "string"
        },
        {
          "const": "de",
          "type": "string"
        },
        {
          "const": "pt",
          "type": "string"
        },
        {
          "const": "it",
          "type": "string"
        },
        {
          "const": "nl",
          "type": "string"
        },
        {
          "const": "pl",
          "type": "string"
        },
        {
          "const": "he",
          "type": "string"
        },
        {
          "const": "ar",
          "type": "string"
        },
        {
          "const": "zh-CN",
          "type": "string"
        },
        {
          "const": "ja",
          "type": "string"
        },
        {
          "const": "ko",
          "type": "string"
        },
        {
          "const": "ru",
          "type": "string"
        },
        {
          "const": "uk",
          "type": "string"
        },
        {
          "const": "tr",
          "type": "string"
        }
      ]
    },
    "serving_grams": {
      "exclusiveMinimum": 0,
      "maximum": 5000,
      "type": "number"
    },
    "nutrients": {
      "type": "object",
      "patternProperties": {
        "^[a-z][a-z0-9_]*$": {
          "minimum": 0,
          "maximum": 100000,
          "type": "number"
        }
      }
    }
  }
}

POST/api/v1/library/meals

Save a meal to your library

{
  "anyOf": [
    {
      "additionalProperties": false,
      "type": "object",
      "required": [
        "meal_id"
      ],
      "properties": {
        "meal_id": {
          "format": "uuid",
          "type": "string"
        },
        "name": {
          "minLength": 1,
          "maxLength": 200,
          "pattern": "\\S",
          "type": "string"
        }
      }
    },
    {
      "additionalProperties": false,
      "type": "object",
      "required": [
        "name",
        "items"
      ],
      "properties": {
        "name": {
          "minLength": 1,
          "maxLength": 200,
          "pattern": "\\S",
          "type": "string"
        },
        "items": {
          "minItems": 1,
          "maxItems": 50,
          "type": "array",
          "items": {
            "additionalProperties": false,
            "type": "object",
            "required": [
              "food_id",
              "grams"
            ],
            "properties": {
              "food_id": {
                "format": "uuid",
                "type": "string"
              },
              "grams": {
                "exclusiveMinimum": 0,
                "maximum": 5000,
                "type": "number"
              }
            }
          }
        }
      }
    }
  ],
  "type": "object"
}

PUT/api/v1/library/meals/{id}

Edit library meals

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "name",
    "items"
  ],
  "properties": {
    "name": {
      "minLength": 1,
      "maxLength": 200,
      "pattern": "\\S",
      "type": "string"
    },
    "items": {
      "minItems": 1,
      "maxItems": 50,
      "type": "array",
      "items": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "food_id",
          "grams"
        ],
        "properties": {
          "food_id": {
            "format": "uuid",
            "type": "string"
          },
          "grams": {
            "exclusiveMinimum": 0,
            "maximum": 5000,
            "type": "number"
          }
        }
      }
    }
  }
}

POST/api/v1/library/recipes

Create library recipes

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "name",
    "servings",
    "ingredients"
  ],
  "properties": {
    "name": {
      "minLength": 1,
      "maxLength": 200,
      "pattern": "\\S",
      "type": "string"
    },
    "locale": {
      "description": "UI locale (16 locales; pt = PT-PT)",
      "anyOf": [
        {
          "const": "en",
          "type": "string"
        },
        {
          "const": "es",
          "type": "string"
        },
        {
          "const": "fr",
          "type": "string"
        },
        {
          "const": "de",
          "type": "string"
        },
        {
          "const": "pt",
          "type": "string"
        },
        {
          "const": "it",
          "type": "string"
        },
        {
          "const": "nl",
          "type": "string"
        },
        {
          "const": "pl",
          "type": "string"
        },
        {
          "const": "he",
          "type": "string"
        },
        {
          "const": "ar",
          "type": "string"
        },
        {
          "const": "zh-CN",
          "type": "string"
        },
        {
          "const": "ja",
          "type": "string"
        },
        {
          "const": "ko",
          "type": "string"
        },
        {
          "const": "ru",
          "type": "string"
        },
        {
          "const": "uk",
          "type": "string"
        },
        {
          "const": "tr",
          "type": "string"
        }
      ]
    },
    "servings": {
      "minimum": 1,
      "maximum": 100,
      "type": "integer"
    },
    "ingredients": {
      "minItems": 1,
      "maxItems": 50,
      "type": "array",
      "items": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "food_id",
          "grams"
        ],
        "properties": {
          "food_id": {
            "format": "uuid",
            "type": "string"
          },
          "grams": {
            "exclusiveMinimum": 0,
            "maximum": 5000,
            "type": "number"
          }
        }
      }
    },
    "prep_minutes": {
      "description": "Omit to keep the stored time; null clears it",
      "anyOf": [
        {
          "minimum": 1,
          "maximum": 600,
          "description": "Total minutes to make it (hands-on plus cooking), as the person states it",
          "type": "integer"
        },
        {
          "type": "null"
        }
      ]
    },
    "source": {
      "description": "Omit to keep the stored source; null clears it",
      "anyOf": [
        {
          "additionalProperties": false,
          "type": "object",
          "required": [
            "url",
            "site",
            "author"
          ],
          "properties": {
            "url": {
              "pattern": "^https://",
              "maxLength": 2000,
              "type": "string"
            },
            "site": {
              "minLength": 1,
              "maxLength": 253,
              "type": "string"
            },
            "author": {
              "anyOf": [
                {
                  "maxLength": 120,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            }
          }
        },
        {
          "type": "null"
        }
      ]
    }
  }
}

POST/api/v1/library/recipes/import

Read a recipe from a link

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "url"
  ],
  "properties": {
    "url": {
      "minLength": 12,
      "maxLength": 2000,
      "pattern": "^https://",
      "description": "One public https:// recipe page",
      "type": "string"
    },
    "locale": {
      "description": "UI locale (16 locales; pt = PT-PT)",
      "anyOf": [
        {
          "const": "en",
          "type": "string"
        },
        {
          "const": "es",
          "type": "string"
        },
        {
          "const": "fr",
          "type": "string"
        },
        {
          "const": "de",
          "type": "string"
        },
        {
          "const": "pt",
          "type": "string"
        },
        {
          "const": "it",
          "type": "string"
        },
        {
          "const": "nl",
          "type": "string"
        },
        {
          "const": "pl",
          "type": "string"
        },
        {
          "const": "he",
          "type": "string"
        },
        {
          "const": "ar",
          "type": "string"
        },
        {
          "const": "zh-CN",
          "type": "string"
        },
        {
          "const": "ja",
          "type": "string"
        },
        {
          "const": "ko",
          "type": "string"
        },
        {
          "const": "ru",
          "type": "string"
        },
        {
          "const": "uk",
          "type": "string"
        },
        {
          "const": "tr",
          "type": "string"
        }
      ]
    }
  }
}

PUT/api/v1/library/recipes/{id}

Edit library recipes

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "name",
    "servings",
    "ingredients"
  ],
  "properties": {
    "name": {
      "minLength": 1,
      "maxLength": 200,
      "pattern": "\\S",
      "type": "string"
    },
    "locale": {
      "description": "UI locale (16 locales; pt = PT-PT)",
      "anyOf": [
        {
          "const": "en",
          "type": "string"
        },
        {
          "const": "es",
          "type": "string"
        },
        {
          "const": "fr",
          "type": "string"
        },
        {
          "const": "de",
          "type": "string"
        },
        {
          "const": "pt",
          "type": "string"
        },
        {
          "const": "it",
          "type": "string"
        },
        {
          "const": "nl",
          "type": "string"
        },
        {
          "const": "pl",
          "type": "string"
        },
        {
          "const": "he",
          "type": "string"
        },
        {
          "const": "ar",
          "type": "string"
        },
        {
          "const": "zh-CN",
          "type": "string"
        },
        {
          "const": "ja",
          "type": "string"
        },
        {
          "const": "ko",
          "type": "string"
        },
        {
          "const": "ru",
          "type": "string"
        },
        {
          "const": "uk",
          "type": "string"
        },
        {
          "const": "tr",
          "type": "string"
        }
      ]
    },
    "servings": {
      "minimum": 1,
      "maximum": 100,
      "type": "integer"
    },
    "ingredients": {
      "minItems": 1,
      "maxItems": 50,
      "type": "array",
      "items": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "food_id",
          "grams"
        ],
        "properties": {
          "food_id": {
            "format": "uuid",
            "type": "string"
          },
          "grams": {
            "exclusiveMinimum": 0,
            "maximum": 5000,
            "type": "number"
          }
        }
      }
    },
    "prep_minutes": {
      "description": "Omit to keep the stored time; null clears it",
      "anyOf": [
        {
          "minimum": 1,
          "maximum": 600,
          "description": "Total minutes to make it (hands-on plus cooking), as the person states it",
          "type": "integer"
        },
        {
          "type": "null"
        }
      ]
    },
    "source": {
      "description": "Omit to keep the stored source; null clears it",
      "anyOf": [
        {
          "additionalProperties": false,
          "type": "object",
          "required": [
            "url",
            "site",
            "author"
          ],
          "properties": {
            "url": {
              "pattern": "^https://",
              "maxLength": 2000,
              "type": "string"
            },
            "site": {
              "minLength": 1,
              "maxLength": 253,
              "type": "string"
            },
            "author": {
              "anyOf": [
                {
                  "maxLength": 120,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            }
          }
        },
        {
          "type": "null"
        }
      ]
    }
  }
}

GET/api/v1/library/search

Search food and saved meals

DELETE/api/v1/library/{kind}/{id}

Delete from your library

POST/api/v1/library/{kind}/{id}/log

Log a library item

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "tz",
    "meal_type"
  ],
  "properties": {
    "tz": {
      "minLength": 1,
      "maxLength": 64,
      "type": "string"
    },
    "meal_type": {
      "anyOf": [
        {
          "const": "breakfast",
          "type": "string"
        },
        {
          "const": "lunch",
          "type": "string"
        },
        {
          "const": "dinner",
          "type": "string"
        },
        {
          "const": "snack",
          "type": "string"
        },
        {
          "const": "other",
          "type": "string"
        }
      ]
    },
    "consent": {
      "additionalProperties": false,
      "type": "object",
      "required": [
        "version"
      ],
      "properties": {
        "version": {
          "minLength": 1,
          "maxLength": 32,
          "type": "string"
        }
      }
    },
    "servings": {
      "exclusiveMinimum": 0,
      "maximum": 100,
      "type": "number"
    }
  }
}

GET/api/v1/me

Get current guest or account

PATCH/api/v1/me

Save profile preferences

{
  "additionalProperties": false,
  "minProperties": 1,
  "type": "object",
  "properties": {
    "sex": {
      "anyOf": [
        {
          "anyOf": [
            {
              "const": "female",
              "type": "string"
            },
            {
              "const": "male",
              "type": "string"
            },
            {
              "const": "other",
              "type": "string"
            }
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "height_cm": {
      "anyOf": [
        {
          "minimum": 50,
          "maximum": 300,
          "type": "number"
        },
        {
          "type": "null"
        }
      ]
    },
    "activity": {
      "anyOf": [
        {
          "anyOf": [
            {
              "const": "sedentary",
              "type": "string"
            },
            {
              "const": "light",
              "type": "string"
            },
            {
              "const": "moderate",
              "type": "string"
            },
            {
              "const": "high",
              "type": "string"
            },
            {
              "const": "very_high",
              "type": "string"
            }
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "locale": {
      "anyOf": [
        {
          "anyOf": [
            {
              "const": "en",
              "type": "string"
            },
            {
              "const": "es",
              "type": "string"
            },
            {
              "const": "fr",
              "type": "string"
            },
            {
              "const": "de",
              "type": "string"
            },
            {
              "const": "pt",
              "type": "string"
            },
            {
              "const": "it",
              "type": "string"
            },
            {
              "const": "nl",
              "type": "string"
            },
            {
              "const": "pl",
              "type": "string"
            },
            {
              "const": "he",
              "type": "string"
            },
            {
              "const": "ar",
              "type": "string"
            },
            {
              "const": "zh-CN",
              "type": "string"
            },
            {
              "const": "ja",
              "type": "string"
            },
            {
              "const": "ko",
              "type": "string"
            },
            {
              "const": "ru",
              "type": "string"
            },
            {
              "const": "uk",
              "type": "string"
            },
            {
              "const": "tr",
              "type": "string"
            }
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "timezone": {
      "anyOf": [
        {
          "maxLength": 64,
          "minLength": 1,
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "units": {
      "anyOf": [
        {
          "additionalProperties": false,
          "type": "object",
          "properties": {
            "energy": {
              "anyOf": [
                {
                  "const": "kcal",
                  "type": "string"
                },
                {
                  "const": "kj",
                  "type": "string"
                }
              ]
            },
            "mass": {
              "anyOf": [
                {
                  "const": "g",
                  "type": "string"
                },
                {
                  "const": "oz",
                  "type": "string"
                }
              ]
            },
            "volume": {
              "anyOf": [
                {
                  "const": "ml",
                  "type": "string"
                },
                {
                  "const": "floz",
                  "type": "string"
                },
                {
                  "const": "cup",
                  "type": "string"
                }
              ]
            },
            "length": {
              "anyOf": [
                {
                  "const": "cm",
                  "type": "string"
                },
                {
                  "const": "ftin",
                  "type": "string"
                }
              ]
            },
            "weight": {
              "anyOf": [
                {
                  "const": "kg",
                  "type": "string"
                },
                {
                  "const": "lb",
                  "type": "string"
                },
                {
                  "const": "st",
                  "type": "string"
                }
              ]
            }
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "energy_unit": {
      "anyOf": [
        {
          "anyOf": [
            {
              "const": "kcal",
              "type": "string"
            },
            {
              "const": "kj",
              "type": "string"
            }
          ]
        },
        {
          "type": "null"
        }
      ]
    }
  }
}

POST/api/v1/meals

Log a meal

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "tz",
    "meal_type",
    "source",
    "items"
  ],
  "properties": {
    "logged_at": {
      "format": "date-time",
      "description": "Default: now",
      "type": "string"
    },
    "tz": {
      "minLength": 1,
      "maxLength": 64,
      "description": "IANA timezone of the user when logging (sets the meal day)",
      "type": "string"
    },
    "meal_type": {
      "anyOf": [
        {
          "const": "breakfast",
          "type": "string"
        },
        {
          "const": "lunch",
          "type": "string"
        },
        {
          "const": "dinner",
          "type": "string"
        },
        {
          "const": "snack",
          "type": "string"
        },
        {
          "const": "other",
          "type": "string"
        }
      ]
    },
    "source": {
      "anyOf": [
        {
          "const": "photo",
          "type": "string"
        },
        {
          "const": "barcode",
          "type": "string"
        },
        {
          "const": "label",
          "type": "string"
        },
        {
          "const": "voice",
          "type": "string"
        },
        {
          "const": "text",
          "type": "string"
        },
        {
          "const": "suggestion",
          "type": "string"
        },
        {
          "const": "agent",
          "type": "string"
        },
        {
          "const": "recipe",
          "type": "string"
        }
      ]
    },
    "scan_id": {
      "format": "uuid",
      "type": "string"
    },
    "note": {
      "maxLength": 500,
      "type": "string"
    },
    "consent": {
      "additionalProperties": false,
      "type": "object",
      "required": [
        "version"
      ],
      "properties": {
        "version": {
          "minLength": 1,
          "maxLength": 32,
          "type": "string"
        }
      }
    },
    "items": {
      "minItems": 1,
      "maxItems": 50,
      "type": "array",
      "items": {
        "additionalProperties": false,
        "description": "grams, or quantity + unit (converted through the food portions)",
        "type": "object",
        "required": [
          "food_id"
        ],
        "properties": {
          "food_id": {
            "format": "uuid",
            "type": "string"
          },
          "grams": {
            "minimum": 0,
            "maximum": 5000,
            "type": "number"
          },
          "quantity": {
            "minimum": 0,
            "maximum": 10000,
            "type": "number"
          },
          "unit": {
            "description": "Mass, volume or household unit",
            "anyOf": [
              {
                "const": "g",
                "type": "string"
              },
              {
                "const": "kg",
                "type": "string"
              },
              {
                "const": "mg",
                "type": "string"
              },
              {
                "const": "oz",
                "type": "string"
              },
              {
                "const": "lb",
                "type": "string"
              },
              {
                "const": "ml",
                "type": "string"
              },
              {
                "const": "l",
                "type": "string"
              },
              {
                "const": "tsp",
                "type": "string"
              },
              {
                "const": "tbsp",
                "type": "string"
              },
              {
                "const": "fl_oz",
                "type": "string"
              },
              {
                "const": "cup",
                "type": "string"
              },
              {
                "const": "piece",
                "type": "string"
              },
              {
                "const": "slice",
                "type": "string"
              },
              {
                "const": "small",
                "type": "string"
              },
              {
                "const": "medium",
                "type": "string"
              },
              {
                "const": "large",
                "type": "string"
              },
              {
                "const": "serving",
                "type": "string"
              },
              {
                "const": "container",
                "type": "string"
              },
              {
                "const": "package",
                "type": "string"
              },
              {
                "const": "bar",
                "type": "string"
              },
              {
                "const": "stick",
                "type": "string"
              },
              {
                "const": "leaf",
                "type": "string"
              },
              {
                "const": "clove",
                "type": "string"
              },
              {
                "const": "egg",
                "type": "string"
              },
              {
                "const": "scoop",
                "type": "string"
              },
              {
                "const": "other",
                "type": "string"
              }
            ]
          },
          "portion_label": {
            "maxLength": 120,
            "type": "string"
          },
          "name": {
            "minLength": 1,
            "maxLength": 200,
            "type": "string"
          },
          "model_name": {
            "minLength": 1,
            "maxLength": 200,
            "pattern": "\\S",
            "type": "string"
          }
        }
      }
    }
  }
}

GET/api/v1/meals/{id}

Get a meal

PATCH/api/v1/meals/{id}

Edit a meal (optimistic concurrency with version)

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "version"
  ],
  "properties": {
    "version": {
      "minimum": 1,
      "description": "Version you edited (optimistic concurrency; stale ⇒ 409)",
      "type": "integer"
    },
    "meal_type": {
      "anyOf": [
        {
          "const": "breakfast",
          "type": "string"
        },
        {
          "const": "lunch",
          "type": "string"
        },
        {
          "const": "dinner",
          "type": "string"
        },
        {
          "const": "snack",
          "type": "string"
        },
        {
          "const": "other",
          "type": "string"
        }
      ]
    },
    "note": {
      "anyOf": [
        {
          "maxLength": 500,
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "logged_at": {
      "format": "date-time",
      "type": "string"
    },
    "local_date": {
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
      "description": "Local date YYYY-MM-DD in the meal timezone",
      "type": "string"
    },
    "items": {
      "minItems": 1,
      "maxItems": 50,
      "type": "array",
      "items": {
        "additionalProperties": false,
        "description": "id = keep this item (snapshot) and change its quantity; food_id = add a new item",
        "type": "object",
        "properties": {
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "food_id": {
            "format": "uuid",
            "type": "string"
          },
          "grams": {
            "minimum": 0,
            "maximum": 5000,
            "type": "number"
          },
          "quantity": {
            "minimum": 0,
            "maximum": 10000,
            "type": "number"
          },
          "unit": {
            "description": "Mass, volume or household unit",
            "anyOf": [
              {
                "const": "g",
                "type": "string"
              },
              {
                "const": "kg",
                "type": "string"
              },
              {
                "const": "mg",
                "type": "string"
              },
              {
                "const": "oz",
                "type": "string"
              },
              {
                "const": "lb",
                "type": "string"
              },
              {
                "const": "ml",
                "type": "string"
              },
              {
                "const": "l",
                "type": "string"
              },
              {
                "const": "tsp",
                "type": "string"
              },
              {
                "const": "tbsp",
                "type": "string"
              },
              {
                "const": "fl_oz",
                "type": "string"
              },
              {
                "const": "cup",
                "type": "string"
              },
              {
                "const": "piece",
                "type": "string"
              },
              {
                "const": "slice",
                "type": "string"
              },
              {
                "const": "small",
                "type": "string"
              },
              {
                "const": "medium",
                "type": "string"
              },
              {
                "const": "large",
                "type": "string"
              },
              {
                "const": "serving",
                "type": "string"
              },
              {
                "const": "container",
                "type": "string"
              },
              {
                "const": "package",
                "type": "string"
              },
              {
                "const": "bar",
                "type": "string"
              },
              {
                "const": "stick",
                "type": "string"
              },
              {
                "const": "leaf",
                "type": "string"
              },
              {
                "const": "clove",
                "type": "string"
              },
              {
                "const": "egg",
                "type": "string"
              },
              {
                "const": "scoop",
                "type": "string"
              },
              {
                "const": "other",
                "type": "string"
              }
            ]
          },
          "portion_label": {
            "maxLength": 120,
            "type": "string"
          },
          "name": {
            "minLength": 1,
            "maxLength": 200,
            "type": "string"
          }
        }
      }
    }
  }
}

DELETE/api/v1/meals/{id}

Delete a meal (undo window)

POST/api/v1/meals/{id}/restore

Undo a meal delete

GET/api/v1/pantry

Get your pantry

PUT/api/v1/pantry/item

Update a pantry item

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "id"
  ],
  "properties": {
    "id": {
      "format": "uuid",
      "type": "string"
    },
    "food_id": {
      "format": "uuid",
      "type": "string"
    },
    "name": {
      "minLength": 1,
      "maxLength": 200,
      "pattern": "\\S",
      "type": "string"
    },
    "quantity": {
      "anyOf": [
        {
          "exclusiveMinimum": 0,
          "maximum": 100000,
          "type": "number"
        },
        {
          "type": "null"
        }
      ]
    },
    "unit": {
      "anyOf": [
        {
          "const": "g",
          "type": "string"
        },
        {
          "const": "ml",
          "type": "string"
        },
        {
          "const": "pcs",
          "type": "string"
        }
      ]
    },
    "opened": {
      "type": "boolean"
    },
    "best_before": {
      "anyOf": [
        {
          "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
          "description": "Local date YYYY-MM-DD in the meal timezone",
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "tz": {
      "minLength": 1,
      "maxLength": 64,
      "type": "string"
    }
  }
}

POST/api/v1/pantry/item/remove

Remove a pantry item

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "id"
  ],
  "properties": {
    "id": {
      "format": "uuid",
      "type": "string"
    }
  }
}

POST/api/v1/pantry/items

Add items to your pantry

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "items"
  ],
  "properties": {
    "items": {
      "minItems": 1,
      "maxItems": 50,
      "type": "array",
      "items": {
        "additionalProperties": false,
        "type": "object",
        "properties": {
          "food_id": {
            "format": "uuid",
            "type": "string"
          },
          "name": {
            "minLength": 1,
            "maxLength": 200,
            "pattern": "\\S",
            "type": "string"
          },
          "quantity": {
            "anyOf": [
              {
                "exclusiveMinimum": 0,
                "maximum": 100000,
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "unit": {
            "anyOf": [
              {
                "const": "g",
                "type": "string"
              },
              {
                "const": "ml",
                "type": "string"
              },
              {
                "const": "pcs",
                "type": "string"
              }
            ]
          },
          "opened": {
            "type": "boolean"
          },
          "best_before": {
            "anyOf": [
              {
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "Local date YYYY-MM-DD in the meal timezone",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      }
    },
    "tz": {
      "minLength": 1,
      "maxLength": 64,
      "type": "string"
    }
  }
}

POST/api/v1/pantry/receipt/preview

Read a pasted receipt

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "text"
  ],
  "properties": {
    "text": {
      "minLength": 1,
      "maxLength": 8000,
      "pattern": "\\S",
      "description": "The text of one receipt, pasted or copied from an emailed ticket (up to 8000 characters). Not stored.",
      "type": "string"
    },
    "locale": {
      "description": "UI locale (16 locales; pt = PT-PT)",
      "anyOf": [
        {
          "const": "en",
          "type": "string"
        },
        {
          "const": "es",
          "type": "string"
        },
        {
          "const": "fr",
          "type": "string"
        },
        {
          "const": "de",
          "type": "string"
        },
        {
          "const": "pt",
          "type": "string"
        },
        {
          "const": "it",
          "type": "string"
        },
        {
          "const": "nl",
          "type": "string"
        },
        {
          "const": "pl",
          "type": "string"
        },
        {
          "const": "he",
          "type": "string"
        },
        {
          "const": "ar",
          "type": "string"
        },
        {
          "const": "zh-CN",
          "type": "string"
        },
        {
          "const": "ja",
          "type": "string"
        },
        {
          "const": "ko",
          "type": "string"
        },
        {
          "const": "ru",
          "type": "string"
        },
        {
          "const": "uk",
          "type": "string"
        },
        {
          "const": "tr",
          "type": "string"
        }
      ]
    },
    "tz": {
      "minLength": 1,
      "maxLength": 64,
      "type": "string"
    }
  }
}

GET/api/v1/pantry/use-up

Use up what you have

GET/api/v1/plan/dinner

Plan dinner from your library

GET/api/v1/plan/preferences

Get planning preferences

PUT/api/v1/plan/preferences

Set planning preferences

{
  "additionalProperties": false,
  "type": "object",
  "properties": {
    "excluded_food_ids": {
      "maxItems": 200,
      "type": "array",
      "items": {
        "format": "uuid",
        "type": "string"
      }
    },
    "avoided_refs": {
      "maxItems": 200,
      "type": "array",
      "items": {
        "pattern": "^(meal|recipe):[0-9a-fA-F-]{36}$",
        "type": "string"
      }
    }
  }
}

GET/api/v1/plan/shopping-list

Shopping list for saved meals

GET/api/v1/plan/week

Get your meal plan

POST/api/v1/plan/week/clear

Clear a plan slot

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "date"
  ],
  "properties": {
    "date": {
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
      "description": "Local date YYYY-MM-DD in the meal timezone",
      "type": "string"
    },
    "slot": {
      "anyOf": [
        {
          "const": "breakfast",
          "type": "string"
        },
        {
          "const": "lunch",
          "type": "string"
        },
        {
          "const": "dinner",
          "type": "string"
        },
        {
          "const": "snack",
          "type": "string"
        }
      ]
    }
  }
}

PUT/api/v1/plan/week/entry

Plan a meal in a slot

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "date",
    "slot",
    "kind",
    "id"
  ],
  "properties": {
    "date": {
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
      "description": "Local date YYYY-MM-DD in the meal timezone",
      "type": "string"
    },
    "slot": {
      "anyOf": [
        {
          "const": "breakfast",
          "type": "string"
        },
        {
          "const": "lunch",
          "type": "string"
        },
        {
          "const": "dinner",
          "type": "string"
        },
        {
          "const": "snack",
          "type": "string"
        }
      ]
    },
    "kind": {
      "anyOf": [
        {
          "const": "meal",
          "type": "string"
        },
        {
          "const": "recipe",
          "type": "string"
        }
      ]
    },
    "id": {
      "format": "uuid",
      "type": "string"
    },
    "servings": {
      "exclusiveMinimum": 0,
      "maximum": 20,
      "type": "number"
    },
    "tz": {
      "minLength": 1,
      "maxLength": 64,
      "type": "string"
    },
    "move_from": {
      "additionalProperties": false,
      "type": "object",
      "required": [
        "date",
        "slot"
      ],
      "properties": {
        "date": {
          "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
          "description": "Local date YYYY-MM-DD in the meal timezone",
          "type": "string"
        },
        "slot": {
          "anyOf": [
            {
              "const": "breakfast",
              "type": "string"
            },
            {
              "const": "lunch",
              "type": "string"
            },
            {
              "const": "dinner",
              "type": "string"
            },
            {
              "const": "snack",
              "type": "string"
            }
          ]
        }
      }
    }
  }
}

POST/api/v1/plan/week/fill

Fill empty plan slots

{
  "additionalProperties": false,
  "type": "object",
  "properties": {
    "from": {
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
      "description": "Local date YYYY-MM-DD in the meal timezone",
      "type": "string"
    },
    "days": {
      "minimum": 1,
      "maximum": 14,
      "description": "Number of days in the window (default 7)",
      "type": "integer"
    },
    "tz": {
      "minLength": 1,
      "maxLength": 64,
      "type": "string"
    },
    "slots": {
      "maxLength": 40,
      "pattern": "^[a-z]+(,[a-z]+){0,3}$",
      "description": "Comma list of breakfast, lunch, dinner, snack (default lunch,dinner)",
      "type": "string"
    },
    "max_minutes": {
      "minimum": 5,
      "maximum": 600,
      "description": "Only recipes with a stated time of at most this many minutes (saved meals and recipes without a time are left out)",
      "type": "integer"
    },
    "fit": {
      "description": "Scale each filled slot to its energy target (0.5 to 3 servings, quarter steps)",
      "type": "boolean"
    }
  }
}

GET/api/v1/plan/week/shopping-list

Shopping list for your meal plan

GET/api/v1/plan/week/suggestions

Suggest meals for empty plan slots

POST/api/v1/privacy/delete

Request permanent erasure of your account and its data

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "confirm",
    "account_id"
  ],
  "properties": {
    "confirm": {
      "const": true,
      "type": "boolean"
    },
    "account_id": {
      "format": "uuid",
      "type": "string"
    }
  }
}

GET/api/v1/privacy/export

Download a ZIP of your openfood data

GET/api/v1/profile

Get profile

PATCH/api/v1/profile

Save profile preferences

{
  "additionalProperties": false,
  "minProperties": 1,
  "type": "object",
  "properties": {
    "sex": {
      "anyOf": [
        {
          "anyOf": [
            {
              "const": "female",
              "type": "string"
            },
            {
              "const": "male",
              "type": "string"
            },
            {
              "const": "other",
              "type": "string"
            }
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "height_cm": {
      "anyOf": [
        {
          "minimum": 50,
          "maximum": 300,
          "type": "number"
        },
        {
          "type": "null"
        }
      ]
    },
    "activity": {
      "anyOf": [
        {
          "anyOf": [
            {
              "const": "sedentary",
              "type": "string"
            },
            {
              "const": "light",
              "type": "string"
            },
            {
              "const": "moderate",
              "type": "string"
            },
            {
              "const": "high",
              "type": "string"
            },
            {
              "const": "very_high",
              "type": "string"
            }
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "locale": {
      "anyOf": [
        {
          "anyOf": [
            {
              "const": "en",
              "type": "string"
            },
            {
              "const": "es",
              "type": "string"
            },
            {
              "const": "fr",
              "type": "string"
            },
            {
              "const": "de",
              "type": "string"
            },
            {
              "const": "pt",
              "type": "string"
            },
            {
              "const": "it",
              "type": "string"
            },
            {
              "const": "nl",
              "type": "string"
            },
            {
              "const": "pl",
              "type": "string"
            },
            {
              "const": "he",
              "type": "string"
            },
            {
              "const": "ar",
              "type": "string"
            },
            {
              "const": "zh-CN",
              "type": "string"
            },
            {
              "const": "ja",
              "type": "string"
            },
            {
              "const": "ko",
              "type": "string"
            },
            {
              "const": "ru",
              "type": "string"
            },
            {
              "const": "uk",
              "type": "string"
            },
            {
              "const": "tr",
              "type": "string"
            }
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "timezone": {
      "anyOf": [
        {
          "maxLength": 64,
          "minLength": 1,
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "units": {
      "anyOf": [
        {
          "additionalProperties": false,
          "type": "object",
          "properties": {
            "energy": {
              "anyOf": [
                {
                  "const": "kcal",
                  "type": "string"
                },
                {
                  "const": "kj",
                  "type": "string"
                }
              ]
            },
            "mass": {
              "anyOf": [
                {
                  "const": "g",
                  "type": "string"
                },
                {
                  "const": "oz",
                  "type": "string"
                }
              ]
            },
            "volume": {
              "anyOf": [
                {
                  "const": "ml",
                  "type": "string"
                },
                {
                  "const": "floz",
                  "type": "string"
                },
                {
                  "const": "cup",
                  "type": "string"
                }
              ]
            },
            "length": {
              "anyOf": [
                {
                  "const": "cm",
                  "type": "string"
                },
                {
                  "const": "ftin",
                  "type": "string"
                }
              ]
            },
            "weight": {
              "anyOf": [
                {
                  "const": "kg",
                  "type": "string"
                },
                {
                  "const": "lb",
                  "type": "string"
                },
                {
                  "const": "st",
                  "type": "string"
                }
              ]
            }
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "energy_unit": {
      "anyOf": [
        {
          "anyOf": [
            {
              "const": "kcal",
              "type": "string"
            },
            {
              "const": "kj",
              "type": "string"
            }
          ]
        },
        {
          "type": "null"
        }
      ]
    }
  }
}

POST/api/v1/quick-log/corrections/preview

Preview draft correction

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "text",
    "tz",
    "items"
  ],
  "properties": {
    "text": {
      "minLength": 1,
      "maxLength": 500,
      "pattern": "\\S",
      "type": "string"
    },
    "locale": {
      "description": "UI locale (16 locales; pt = PT-PT)",
      "anyOf": [
        {
          "const": "en",
          "type": "string"
        },
        {
          "const": "es",
          "type": "string"
        },
        {
          "const": "fr",
          "type": "string"
        },
        {
          "const": "de",
          "type": "string"
        },
        {
          "const": "pt",
          "type": "string"
        },
        {
          "const": "it",
          "type": "string"
        },
        {
          "const": "nl",
          "type": "string"
        },
        {
          "const": "pl",
          "type": "string"
        },
        {
          "const": "he",
          "type": "string"
        },
        {
          "const": "ar",
          "type": "string"
        },
        {
          "const": "zh-CN",
          "type": "string"
        },
        {
          "const": "ja",
          "type": "string"
        },
        {
          "const": "ko",
          "type": "string"
        },
        {
          "const": "ru",
          "type": "string"
        },
        {
          "const": "uk",
          "type": "string"
        },
        {
          "const": "tr",
          "type": "string"
        }
      ]
    },
    "item_index": {
      "minimum": 0,
      "maximum": 49,
      "type": "integer"
    },
    "tz": {
      "minLength": 1,
      "maxLength": 64,
      "type": "string"
    },
    "items": {
      "minItems": 1,
      "maxItems": 50,
      "type": "array",
      "items": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "food_id",
          "grams"
        ],
        "properties": {
          "food_id": {
            "format": "uuid",
            "type": "string"
          },
          "grams": {
            "minimum": 0,
            "maximum": 5000,
            "type": "number"
          },
          "model_name": {
            "minLength": 1,
            "maxLength": 200,
            "pattern": "\\S",
            "type": "string"
          }
        }
      }
    }
  }
}

POST/api/v1/quick-log/estimate

Estimate a meal from text

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "text"
  ],
  "properties": {
    "text": {
      "minLength": 1,
      "maxLength": 500,
      "pattern": "\\S",
      "type": "string"
    },
    "locale": {
      "description": "UI locale (16 locales; pt = PT-PT)",
      "anyOf": [
        {
          "const": "en",
          "type": "string"
        },
        {
          "const": "es",
          "type": "string"
        },
        {
          "const": "fr",
          "type": "string"
        },
        {
          "const": "de",
          "type": "string"
        },
        {
          "const": "pt",
          "type": "string"
        },
        {
          "const": "it",
          "type": "string"
        },
        {
          "const": "nl",
          "type": "string"
        },
        {
          "const": "pl",
          "type": "string"
        },
        {
          "const": "he",
          "type": "string"
        },
        {
          "const": "ar",
          "type": "string"
        },
        {
          "const": "zh-CN",
          "type": "string"
        },
        {
          "const": "ja",
          "type": "string"
        },
        {
          "const": "ko",
          "type": "string"
        },
        {
          "const": "ru",
          "type": "string"
        },
        {
          "const": "uk",
          "type": "string"
        },
        {
          "const": "tr",
          "type": "string"
        }
      ]
    }
  }
}

POST/api/v1/quick-log/meals

Log corrected draft

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "tz",
    "meal_type",
    "source",
    "items",
    "ops"
  ],
  "properties": {
    "tz": {
      "minLength": 1,
      "maxLength": 64,
      "type": "string"
    },
    "locale": {
      "description": "UI locale (16 locales; pt = PT-PT)",
      "anyOf": [
        {
          "const": "en",
          "type": "string"
        },
        {
          "const": "es",
          "type": "string"
        },
        {
          "const": "fr",
          "type": "string"
        },
        {
          "const": "de",
          "type": "string"
        },
        {
          "const": "pt",
          "type": "string"
        },
        {
          "const": "it",
          "type": "string"
        },
        {
          "const": "nl",
          "type": "string"
        },
        {
          "const": "pl",
          "type": "string"
        },
        {
          "const": "he",
          "type": "string"
        },
        {
          "const": "ar",
          "type": "string"
        },
        {
          "const": "zh-CN",
          "type": "string"
        },
        {
          "const": "ja",
          "type": "string"
        },
        {
          "const": "ko",
          "type": "string"
        },
        {
          "const": "ru",
          "type": "string"
        },
        {
          "const": "uk",
          "type": "string"
        },
        {
          "const": "tr",
          "type": "string"
        }
      ]
    },
    "meal_type": {
      "anyOf": [
        {
          "const": "breakfast",
          "type": "string"
        },
        {
          "const": "lunch",
          "type": "string"
        },
        {
          "const": "dinner",
          "type": "string"
        },
        {
          "const": "snack",
          "type": "string"
        },
        {
          "const": "other",
          "type": "string"
        }
      ]
    },
    "source": {
      "anyOf": [
        {
          "const": "text",
          "type": "string"
        },
        {
          "const": "voice",
          "type": "string"
        }
      ]
    },
    "consent": {
      "additionalProperties": false,
      "type": "object",
      "required": [
        "version"
      ],
      "properties": {
        "version": {
          "minLength": 1,
          "maxLength": 32,
          "type": "string"
        }
      }
    },
    "items": {
      "minItems": 1,
      "maxItems": 50,
      "type": "array",
      "items": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "food_id",
          "grams"
        ],
        "properties": {
          "food_id": {
            "format": "uuid",
            "type": "string"
          },
          "grams": {
            "minimum": 0,
            "maximum": 5000,
            "type": "number"
          },
          "model_name": {
            "minLength": 1,
            "maxLength": 200,
            "pattern": "\\S",
            "type": "string"
          }
        }
      }
    },
    "ops": {
      "minItems": 1,
      "maxItems": 8,
      "type": "array",
      "items": {
        "anyOf": [
          {
            "additionalProperties": false,
            "type": "object",
            "required": [
              "op",
              "target"
            ],
            "properties": {
              "op": {
                "const": "remove",
                "type": "string"
              },
              "target": {
                "anyOf": [
                  {
                    "minimum": 0,
                    "maximum": 49,
                    "type": "integer"
                  },
                  {
                    "pattern": "^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$",
                    "type": "string"
                  }
                ]
              }
            }
          },
          {
            "additionalProperties": false,
            "type": "object",
            "required": [
              "op",
              "target",
              "value"
            ],
            "properties": {
              "op": {
                "const": "scale",
                "type": "string"
              },
              "target": {
                "anyOf": [
                  {
                    "minimum": 0,
                    "maximum": 49,
                    "type": "integer"
                  },
                  {
                    "pattern": "^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$",
                    "type": "string"
                  }
                ]
              },
              "value": {
                "anyOf": [
                  {
                    "exclusiveMinimum": 0,
                    "maximum": 10,
                    "type": "number"
                  },
                  {
                    "additionalProperties": false,
                    "type": "object",
                    "required": [
                      "grams"
                    ],
                    "properties": {
                      "grams": {
                        "exclusiveMinimum": 0,
                        "maximum": 5000,
                        "type": "number"
                      }
                    }
                  }
                ]
              }
            }
          },
          {
            "additionalProperties": false,
            "type": "object",
            "required": [
              "op",
              "target",
              "value"
            ],
            "properties": {
              "op": {
                "const": "replace",
                "type": "string"
              },
              "target": {
                "anyOf": [
                  {
                    "minimum": 0,
                    "maximum": 49,
                    "type": "integer"
                  },
                  {
                    "pattern": "^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$",
                    "type": "string"
                  }
                ]
              },
              "value": {
                "additionalProperties": false,
                "type": "object",
                "required": [
                  "food_id"
                ],
                "properties": {
                  "food_id": {
                    "format": "uuid",
                    "type": "string"
                  },
                  "grams": {
                    "exclusiveMinimum": 0,
                    "maximum": 5000,
                    "type": "number"
                  }
                }
              }
            }
          },
          {
            "additionalProperties": false,
            "type": "object",
            "required": [
              "op",
              "target",
              "value"
            ],
            "properties": {
              "op": {
                "const": "add",
                "type": "string"
              },
              "target": {
                "type": "null"
              },
              "value": {
                "additionalProperties": false,
                "type": "object",
                "required": [
                  "food_id"
                ],
                "properties": {
                  "food_id": {
                    "format": "uuid",
                    "type": "string"
                  },
                  "grams": {
                    "exclusiveMinimum": 0,
                    "maximum": 5000,
                    "type": "number"
                  }
                }
              }
            }
          },
          {
            "additionalProperties": false,
            "type": "object",
            "required": [
              "op",
              "target",
              "value"
            ],
            "properties": {
              "op": {
                "const": "move_date",
                "type": "string"
              },
              "target": {
                "type": "null"
              },
              "value": {
                "anyOf": [
                  {
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                    "description": "Local date YYYY-MM-DD in the meal timezone",
                    "type": "string"
                  },
                  {
                    "const": "yesterday",
                    "type": "string"
                  },
                  {
                    "const": "today",
                    "type": "string"
                  }
                ]
              }
            }
          }
        ]
      }
    }
  }
}

POST/api/v1/quick-log/meals/{id}/corrections

Confirm meal correction

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "version",
    "ops"
  ],
  "properties": {
    "version": {
      "minimum": 1,
      "type": "integer"
    },
    "ops": {
      "minItems": 1,
      "maxItems": 8,
      "type": "array",
      "items": {
        "anyOf": [
          {
            "additionalProperties": false,
            "type": "object",
            "required": [
              "op",
              "target"
            ],
            "properties": {
              "op": {
                "const": "remove",
                "type": "string"
              },
              "target": {
                "anyOf": [
                  {
                    "minimum": 0,
                    "maximum": 49,
                    "type": "integer"
                  },
                  {
                    "pattern": "^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$",
                    "type": "string"
                  }
                ]
              }
            }
          },
          {
            "additionalProperties": false,
            "type": "object",
            "required": [
              "op",
              "target",
              "value"
            ],
            "properties": {
              "op": {
                "const": "scale",
                "type": "string"
              },
              "target": {
                "anyOf": [
                  {
                    "minimum": 0,
                    "maximum": 49,
                    "type": "integer"
                  },
                  {
                    "pattern": "^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$",
                    "type": "string"
                  }
                ]
              },
              "value": {
                "anyOf": [
                  {
                    "exclusiveMinimum": 0,
                    "maximum": 10,
                    "type": "number"
                  },
                  {
                    "additionalProperties": false,
                    "type": "object",
                    "required": [
                      "grams"
                    ],
                    "properties": {
                      "grams": {
                        "exclusiveMinimum": 0,
                        "maximum": 5000,
                        "type": "number"
                      }
                    }
                  }
                ]
              }
            }
          },
          {
            "additionalProperties": false,
            "type": "object",
            "required": [
              "op",
              "target",
              "value"
            ],
            "properties": {
              "op": {
                "const": "replace",
                "type": "string"
              },
              "target": {
                "anyOf": [
                  {
                    "minimum": 0,
                    "maximum": 49,
                    "type": "integer"
                  },
                  {
                    "pattern": "^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$",
                    "type": "string"
                  }
                ]
              },
              "value": {
                "additionalProperties": false,
                "type": "object",
                "required": [
                  "food_id"
                ],
                "properties": {
                  "food_id": {
                    "format": "uuid",
                    "type": "string"
                  },
                  "grams": {
                    "exclusiveMinimum": 0,
                    "maximum": 5000,
                    "type": "number"
                  }
                }
              }
            }
          },
          {
            "additionalProperties": false,
            "type": "object",
            "required": [
              "op",
              "target",
              "value"
            ],
            "properties": {
              "op": {
                "const": "add",
                "type": "string"
              },
              "target": {
                "type": "null"
              },
              "value": {
                "additionalProperties": false,
                "type": "object",
                "required": [
                  "food_id"
                ],
                "properties": {
                  "food_id": {
                    "format": "uuid",
                    "type": "string"
                  },
                  "grams": {
                    "exclusiveMinimum": 0,
                    "maximum": 5000,
                    "type": "number"
                  }
                }
              }
            }
          },
          {
            "additionalProperties": false,
            "type": "object",
            "required": [
              "op",
              "target",
              "value"
            ],
            "properties": {
              "op": {
                "const": "move_date",
                "type": "string"
              },
              "target": {
                "type": "null"
              },
              "value": {
                "anyOf": [
                  {
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                    "description": "Local date YYYY-MM-DD in the meal timezone",
                    "type": "string"
                  },
                  {
                    "const": "yesterday",
                    "type": "string"
                  },
                  {
                    "const": "today",
                    "type": "string"
                  }
                ]
              }
            }
          }
        ]
      }
    }
  }
}

POST/api/v1/quick-log/meals/{id}/corrections/preview

Preview meal correction

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "text",
    "version"
  ],
  "properties": {
    "text": {
      "minLength": 1,
      "maxLength": 500,
      "pattern": "\\S",
      "type": "string"
    },
    "locale": {
      "description": "UI locale (16 locales; pt = PT-PT)",
      "anyOf": [
        {
          "const": "en",
          "type": "string"
        },
        {
          "const": "es",
          "type": "string"
        },
        {
          "const": "fr",
          "type": "string"
        },
        {
          "const": "de",
          "type": "string"
        },
        {
          "const": "pt",
          "type": "string"
        },
        {
          "const": "it",
          "type": "string"
        },
        {
          "const": "nl",
          "type": "string"
        },
        {
          "const": "pl",
          "type": "string"
        },
        {
          "const": "he",
          "type": "string"
        },
        {
          "const": "ar",
          "type": "string"
        },
        {
          "const": "zh-CN",
          "type": "string"
        },
        {
          "const": "ja",
          "type": "string"
        },
        {
          "const": "ko",
          "type": "string"
        },
        {
          "const": "ru",
          "type": "string"
        },
        {
          "const": "uk",
          "type": "string"
        },
        {
          "const": "tr",
          "type": "string"
        }
      ]
    },
    "item_index": {
      "minimum": 0,
      "maximum": 49,
      "type": "integer"
    },
    "version": {
      "minimum": 1,
      "type": "integer"
    }
  }
}

POST/api/v1/scans

Submit up to four angles of a meal

{}

GET/api/v1/scans/{id}

Poll a private scan result

POST/api/v1/scans/{id}/log

Confirm a reviewed photo or label and log a meal

{
  "anyOf": [
    {
      "additionalProperties": false,
      "type": "object",
      "required": [
        "tz",
        "meal_type",
        "items"
      ],
      "properties": {
        "tz": {
          "minLength": 1,
          "maxLength": 64,
          "type": "string"
        },
        "meal_type": {
          "anyOf": [
            {
              "const": "breakfast",
              "type": "string"
            },
            {
              "const": "lunch",
              "type": "string"
            },
            {
              "const": "dinner",
              "type": "string"
            },
            {
              "const": "snack",
              "type": "string"
            },
            {
              "const": "other",
              "type": "string"
            }
          ]
        },
        "consent": {
          "additionalProperties": false,
          "type": "object",
          "required": [
            "version"
          ],
          "properties": {
            "version": {
              "minLength": 1,
              "maxLength": 32,
              "type": "string"
            }
          }
        },
        "items": {
          "minItems": 1,
          "maxItems": 11,
          "type": "array",
          "items": {
            "additionalProperties": false,
            "type": "object",
            "required": [
              "index",
              "food_id",
              "grams"
            ],
            "properties": {
              "index": {
                "minimum": 0,
                "maximum": 7,
                "type": "integer"
              },
              "hidden": {
                "type": "boolean"
              },
              "food_id": {
                "format": "uuid",
                "type": "string"
              },
              "grams": {
                "exclusiveMinimum": 0,
                "maximum": 5000,
                "type": "number"
              }
            }
          }
        }
      }
    },
    {
      "additionalProperties": false,
      "type": "object",
      "required": [
        "tz",
        "meal_type",
        "label",
        "grams"
      ],
      "properties": {
        "tz": {
          "minLength": 1,
          "maxLength": 64,
          "type": "string"
        },
        "meal_type": {
          "anyOf": [
            {
              "const": "breakfast",
              "type": "string"
            },
            {
              "const": "lunch",
              "type": "string"
            },
            {
              "const": "dinner",
              "type": "string"
            },
            {
              "const": "snack",
              "type": "string"
            },
            {
              "const": "other",
              "type": "string"
            }
          ]
        },
        "consent": {
          "additionalProperties": false,
          "type": "object",
          "required": [
            "version"
          ],
          "properties": {
            "version": {
              "minLength": 1,
              "maxLength": 32,
              "type": "string"
            }
          }
        },
        "label": {
          "additionalProperties": false,
          "type": "object",
          "required": [
            "name",
            "basis",
            "nutrients"
          ],
          "properties": {
            "name": {
              "minLength": 1,
              "maxLength": 200,
              "pattern": "\\S",
              "type": "string"
            },
            "basis": {
              "anyOf": [
                {
                  "const": "per_100g",
                  "type": "string"
                },
                {
                  "const": "per_serving",
                  "type": "string"
                }
              ]
            },
            "serving_grams": {
              "minimum": 0.1,
              "maximum": 5000,
              "type": "number"
            },
            "nutrients": {
              "additionalProperties": false,
              "type": "object",
              "required": [
                "energy_kcal",
                "protein_g",
                "carbs_g",
                "fat_g"
              ],
              "properties": {
                "energy_kcal": {
                  "minimum": 0,
                  "maximum": 100000,
                  "type": "number"
                },
                "protein_g": {
                  "minimum": 0,
                  "maximum": 100000,
                  "type": "number"
                },
                "carbs_g": {
                  "minimum": 0,
                  "maximum": 100000,
                  "type": "number"
                },
                "fat_g": {
                  "minimum": 0,
                  "maximum": 100000,
                  "type": "number"
                },
                "fiber_g": {
                  "minimum": 0,
                  "maximum": 100000,
                  "type": "number"
                },
                "sugars_g": {
                  "minimum": 0,
                  "maximum": 100000,
                  "type": "number"
                },
                "sodium_mg": {
                  "minimum": 0,
                  "maximum": 100000,
                  "type": "number"
                }
              }
            }
          }
        },
        "grams": {
          "exclusiveMinimum": 0,
          "maximum": 5000,
          "type": "number"
        },
        "barcode": {
          "pattern": "^[0-9]{8,14}$",
          "description": "EAN-8, EAN-13, UPC-A or UPC-E digits",
          "type": "string"
        }
      }
    }
  ]
}

GET/api/v1/suggestions

Get personal food suggestions

POST/api/v1/suggestions/log

Log a suggested food

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "food_id",
    "hour"
  ],
  "properties": {
    "food_id": {
      "format": "uuid",
      "type": "string"
    },
    "hour": {
      "minimum": 0,
      "maximum": 23,
      "type": "integer"
    },
    "consent": {
      "additionalProperties": false,
      "type": "object",
      "required": [
        "version"
      ],
      "properties": {
        "version": {
          "minLength": 1,
          "maxLength": 32,
          "type": "string"
        }
      }
    }
  }
}

POST/api/v1/usual-meal/dismiss

Dismiss a usual meal for seven days

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "signature"
  ],
  "properties": {
    "signature": {
      "pattern": "^[a-f0-9]{64}$",
      "type": "string"
    },
    "consent": {
      "additionalProperties": false,
      "type": "object",
      "required": [
        "version"
      ],
      "properties": {
        "version": {
          "minLength": 1,
          "maxLength": 32,
          "type": "string"
        }
      }
    }
  }
}

POST/api/v1/usual-meal/log

Log the proposed usual meal

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "signature"
  ],
  "properties": {
    "signature": {
      "pattern": "^[a-f0-9]{64}$",
      "type": "string"
    },
    "consent": {
      "additionalProperties": false,
      "type": "object",
      "required": [
        "version"
      ],
      "properties": {
        "version": {
          "minLength": 1,
          "maxLength": 32,
          "type": "string"
        }
      }
    }
  }
}

POST/api/v1/water

Log water

{
  "additionalProperties": false,
  "type": "object",
  "properties": {
    "date": {
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
      "description": "Local date YYYY-MM-DD in the meal timezone",
      "type": "string"
    },
    "tz": {
      "minLength": 1,
      "maxLength": 64,
      "type": "string"
    },
    "ml": {
      "minimum": 1,
      "maximum": 5000,
      "type": "integer"
    },
    "consent": {
      "additionalProperties": false,
      "type": "object",
      "required": [
        "version"
      ],
      "properties": {
        "version": {
          "minLength": 1,
          "maxLength": 32,
          "type": "string"
        }
      }
    }
  }
}

GET/api/v1/water/settings

Get water settings

PUT/api/v1/water/settings

Set water preferences

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "glass_ml",
    "goal_ml",
    "reminders"
  ],
  "properties": {
    "glass_ml": {
      "minimum": 1,
      "maximum": 5000,
      "type": "integer"
    },
    "goal_ml": {
      "anyOf": [
        {
          "minimum": 1,
          "maximum": 20000,
          "type": "integer"
        },
        {
          "type": "null"
        }
      ]
    },
    "reminders": {
      "type": "boolean"
    }
  }
}

DELETE/api/v1/water/{id}

Undo a water log

GET/api/v1/weights

Get weight trend

POST/api/v1/weights

Log weight

{
  "additionalProperties": false,
  "type": "object",
  "required": [
    "kg"
  ],
  "properties": {
    "date": {
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
      "type": "string"
    },
    "kg": {
      "minimum": 20,
      "maximum": 500,
      "type": "number"
    }
  }
}

POST/mcp

MCP (Streamable HTTP, stateless JSON-RPC 2.0)

{
  "type": "object"
}

GET/mcp

MCP server info (POST JSON-RPC to this URL)

GET/openapi.json

OpenAPI 3.1 document

hi@openfood.fun