REST API
Base path: /api/v1/. Authentication is Authorization: Bearer <token> (RFC 6750). The older Token <token> scheme is no longer accepted. Every list, recipe, and meal-plan query is limited to the token owner.
Create a token through Django admin or:
uv run --env-file .env python src/manage.py drf_create_token <email>
Swagger UI is public at /api/v1/. The OpenAPI document is at /api/v1/schema/. List and recipe operations stay authenticated.
All business actions listed here have MCP equivalents, including detail reads, root deletion, ordering, collection replacement and batch imports. See MCP server for tool names and input examples. Automated tests check that every registered REST business action maps to an available MCP tool.
Collection search and paging
Collection GET routes return JSON arrays as before, with a bounded page of 50 records by default. Pass limit (1–200) and offset (0–2,147,483,647) for explicit pages. To read all matches, increase offset by the requested limit until a page contains fewer records than the limit. Filtering happens before paging; results retain their normal stable ordering. An offset beyond the results returns [].
Collection |
Additional query parameters |
|---|---|
|
|
|
|
|
|
|
|
|
|
All collections accept q, limit and offset. Search is case-insensitive and requires every whitespace-separated term to match. Omitted boolean filters include both states. Invalid ranges, flags, unknown parameters and limits are rejected; a foreign or missing item-filter list_id returns 404. All searches remain scoped to the authenticated user.
summary=false is the default, preserving the previous full-record shape within each page. Compact recipe/list pages skip loading their child collections; detail GET routes always return the full object. For example, GET /api/v1/recipes/?q=tofu&is_favorite=true&summary=true&limit=10&offset=0 finds ten compact favorite matches. Use the selected ID with GET /api/v1/recipes/{id}/ for ingredients and steps. Reorder operations still require all IDs in the relevant collection; gather all pages before reordering a large collection.
Departments
GET /api/v1/departments/ lists only the token owner’s departments, sorted by their displayed labels. Each entry contains id, the stable code, the stored name, and the translated label.
GET /api/v1/departments/resolve/?query=Obst%20und%20Gem%C3%BCse resolves a code or name without changing anything. An unambiguous match returns the same department metadata. Both GET endpoints are read-only. PATCH /api/v1/departments/{id}/ accepts {"name": "Chilled food"} to rename a department while retaining its stable code, position and all references.
Shopping items accept a department code or name in department; responses always contain its stable code. Exact codes take precedence. Otherwise, saved names and their translations in the configured languages are compared after normalizing case, whitespace, punctuation, conjunctions (&, /, +, and, und), and umlaut spellings such as ü/ue. No aliases are stored. Renaming a department preserves its code and does not retain its former name as an alias.
Omit department to use the saved article default. Send "department": "" to explicitly clear the assignment and update the article default.
An unknown or ambiguous department returns HTTP 400 with code (department_not_found or department_ambiguous), query, message, and candidates. Candidates contain only owned departments, with code, name, and label. Similar names are suggestions, never automatic assignments. Ask the user to choose a candidate and retry with its code. An unresolved request does not create departments or partially save a list, import, or replacement collection.
A resolver error looks like this. For nested shopping items, items is an object keyed by the position (as a string, counting from 0) of each item that failed, so the second item’s error is under items["1"].department; valid items are left out:
{
"department": {
"code": "department_not_found",
"query": "Obst",
"message": "Invalid department. No exact match was found; choose a saved code.",
"candidates": [
{"code": "produce", "name": "Fruit & vegetables", "label": "Fruit & vegetables"}
]
}
}
Shopping lists
Collection:
/api/v1/shopping-lists/The view set creates, reads, updates, and deletes lists with nested items.
POST /api/v1/shopping-lists/{id}/reorder/accepts{"item_ids": [3, 1, 2]}.POST /api/v1/shopping-lists/import_json/accepts{"lists": [...]}or a bare list. See JSON import and export.
Shopping actions and article defaults
Method |
Path |
Input / result |
|---|---|---|
POST |
|
|
DELETE |
|
Deletes one owned entry; returns 204. Missing/foreign IDs return 404. |
POST |
|
No body required. Returns |
POST |
|
Optional |
Adding an item merges compatible quantities into an existing line with the same normalized name and reopens it. It preserves the article default when department is omitted or null; "" clears it. Recipe copying uses the same quantity rules. A recipe-copy list_id must identify an existing owned list; a title finds or creates a named list; omitting both uses or creates today’s list. When both selectors are supplied, the title must match the selected list or the request returns selection_mismatch. Repeating either addition operation adds quantities again. Invalid departments and quantity overflow return 400 and roll back the entire operation, including defaults, previously copied ingredients and a newly created target list.
Both deletion operations retain the shopping list and saved articles. Bulk deletion removes only checked entries on the selected owned list; repeating it on an unchanged list returns zero.
GET /api/v1/shopping-items/ and GET /api/v1/articles/ provide owned IDs. Their detail routes support GET, PUT and PATCH. Item PATCH accepts name, quantity, department and checked; article PATCH accepts name and department. Omitted fields remain unchanged. Item quantity updates replace the amount; article-default updates leave existing shopping entries unchanged.
curl -H "Authorization: Bearer <token>" http://127.0.0.1:8050/api/v1/shopping-lists/
curl -X POST -H "Authorization: Bearer <token>" -H "Content-Type: application/json" \
-d '{"lists":[{"title":"Pasta","date":"2026-10-30","items":[{"name":"Pasta","quantity":"500 g"}]}]}' \
http://127.0.0.1:8050/api/v1/shopping-lists/import_json/
Replacement collections
For shopping-list and recipe updates, omitted items, ingredients, or steps
stay unchanged. A supplied collection replaces the entire corresponding
collection, including during PATCH. Each supplied item/ingredient requires a
name; each supplied step requires text. Incomplete replacement children
return field-specific HTTP 400 errors without changing existing data. An explicit
empty array ([]) intentionally clears that collection.
List/recipe creation and replacement run in transactions, so failed child writes roll back metadata and children together. Accumulated shopping quantities must fit the 100-character limit; overflow returns a validation error rather than truncating data. Automatic addition applies only to simple decimal amounts with compatible units. Fractions, mixed numbers and ranges are preserved as separate quantity expressions, including repeated contributions.
Item/ingredient/step reorder requests must contain every current child ID exactly once. Missing, duplicate and foreign IDs are rejected without changing order.
Recipes
Collection:
/api/v1/recipes/The same token and the same user scope as shopping lists.
POST /api/v1/recipes/{id}/reorder-ingredients/andPOST /api/v1/recipes/{id}/reorder-steps/accept{"line_ids": [3, 1, 2]}.POST /api/v1/recipes/import_json/accepts{"recipes": [...]}or a bare list. An image file is not part of the JSON; sendimage_urlor upload the file in the app.POST /api/v1/recipes/{id}/favorite/accepts{"is_favorite": true}orfalseand returns the recipe. Recipe responses expose the read-onlyis_favoritestate; this action sets it explicitly rather than toggling it.
Meal planner
All planner endpoints use the same authentication and services as the web planner.
Method |
Path |
Input |
Result |
|---|---|---|---|
GET |
|
Optional |
A Monday–Sunday week with seven days; omitted means the current local week. |
PUT |
|
|
Assign or replace that date’s recipe. Repeating the same request leaves one entry. |
DELETE |
|
None |
Clear that date. Returns 204, including when it is already empty. |
POST |
|
|
Copy the week’s ingredients to an existing owned list or a new list, returning the list and its items. |
date and week use ISO calendar dates. Any day in a week selects the Monday on or before it. Week reads include empty days as {"date": "2027-01-02", "recipe": null}; planned days contain a recipe summary with id and title. Full recipe details are available from /api/v1/recipes/{id}/.
For example, GET /api/v1/meal-planner/?week=2027-01-01 returns:
{
"week_start": "2026-12-28",
"week_end": "2027-01-03",
"days": [
{"date": "2026-12-28", "recipe": null},
{"date": "2026-12-29", "recipe": null},
{"date": "2026-12-30", "recipe": null},
{"date": "2026-12-31", "recipe": null},
{"date": "2027-01-01", "recipe": {"id": 12, "title": "Soup"}},
{"date": "2027-01-02", "recipe": null},
{"date": "2027-01-03", "recipe": null}
]
}
To create a shopping list, send {"week": "2027-01-01", "title": "Weekly shop"}. To use an existing list, send {"week": "2027-01-01", "shopping_list_id": 8}. Supplying both targets or neither is a validation error. A week with no planned recipes is rejected without creating a list.
Matching ingredients and compatible quantities are merged using the existing shopping-list rules. Recipes planned on several days contribute once per day. Repeating the POST adds the ingredients again; this operation is not idempotent. Copying never clears the plan. Validation failures return 400; all data stays scoped to the token owner.