> For the complete documentation index, see [llms.txt](https://docs.january.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.january.ai/rest-api/food-logs.md).

# Food logs

Create and query an end user's food diary. A food log's `id` can be used to fetch, update, or delete that entry.

Each operation acts on one end user ([End-user identity](/rest-api/api-overview.md#end-user-identity)). Client-token scopes: `food_logs:write` to create, update, or delete; `food_logs:read` to list, summarize, or get.

## Timestamps and ranges

* `created_at` is when the meal was eaten ([Days and timezones](/rest-api/api-overview.md#days-and-timezones)). Omit it on create to log the meal now, or on update to leave it unchanged.
* Log a food by sending the food `id` and serving `id` from a search or food-analysis result as `food_id` and `serving_id`. Pass them back exactly as returned ([Identifiers](/rest-api/api-overview.md#identifiers)).
* An update (`PATCH`) replaces any subset of `foods`, `created_at`, and `name`, and must set at least one of them.
* The list and the summary take inclusive local calendar dates in an IANA `timezone`. The list spans at most 60 days and the summary at most 366, grouped by day or by week; a longer range fails with `400 date_range_too_large`.
* Creating a log is not idempotent: check with the list or get operation before you retry a create that timed out. Deleting is idempotent, and an unknown or already-deleted log also returns `204`.

Each operation's description states what it costs — see [Credits and pricing](/rest-api/credits-and-pricing.md).

{% openapi src="<https://partners.january.ai/v1.2/openapi.json>" path="/v1.2/food-logs" method="post" %}
<https://partners.january.ai/v1.2/openapi.json>
{% endopenapi %}

{% openapi src="<https://partners.january.ai/v1.2/openapi.json>" path="/v1.2/food-logs" method="get" %}
<https://partners.january.ai/v1.2/openapi.json>
{% endopenapi %}

{% openapi src="<https://partners.january.ai/v1.2/openapi.json>" path="/v1.2/food-logs/summary" method="get" %}
<https://partners.january.ai/v1.2/openapi.json>
{% endopenapi %}

{% openapi src="<https://partners.january.ai/v1.2/openapi.json>" path="/v1.2/food-logs/{log\_id}" method="get" %}
<https://partners.january.ai/v1.2/openapi.json>
{% endopenapi %}

{% openapi src="<https://partners.january.ai/v1.2/openapi.json>" path="/v1.2/food-logs/{log\_id}" method="patch" %}
<https://partners.january.ai/v1.2/openapi.json>
{% endopenapi %}

{% openapi src="<https://partners.january.ai/v1.2/openapi.json>" path="/v1.2/food-logs/{log\_id}" method="delete" %}
<https://partners.january.ai/v1.2/openapi.json>
{% endopenapi %}
