Merran documentation API & integrations
Apply a replacement to selected planned meals
const url = 'http://localhost:3000/api/list/items/0199e8b0-5a10-7a01-8b00-00000000001d/substitutions';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"recipeId":"0199e8b0-5a10-7a01-8b00-000000000006","ingredientId":"0199e8b0-5a10-7a01-8b00-000000000011","state":"example-state","targets":[{"mealId":"0199e8b0-5a10-7a01-8b00-00000000001b","revision":"2026-10-15T18:30:00.000Z"}],"lines":["2 tbsp butter"],"steps":[],"saveToLibrary":false}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:3000/api/list/items/0199e8b0-5a10-7a01-8b00-00000000001d/substitutions \ --header 'Content-Type: application/json' \ --data '{ "recipeId": "0199e8b0-5a10-7a01-8b00-000000000006", "ingredientId": "0199e8b0-5a10-7a01-8b00-000000000011", "state": "example-state", "targets": [ { "mealId": "0199e8b0-5a10-7a01-8b00-00000000001b", "revision": "2026-10-15T18:30:00.000Z" } ], "lines": [ "2 tbsp butter" ], "steps": [], "saveToLibrary": false }'Signed-in household members only. Atomically saves meal-specific recipe snapshots and recalculates changed shopping foods with pantry deductions, preserving purchases and manual remainders. Library changes require saveToLibrary. Returns conditional Undo data.
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Example
0199e8b0-5a10-7a01-8b00-00000000001dRequest Bodyrequired
Section titled “Request Bodyrequired”Select linked planned meals. Each target may supply its own recipe, ingredient, state, lines and steps to replace a shared food across different recipes atomically. Without replacement, the top-level fields apply. With no targets, replace one manually added item using one ingredient line. Amounts are for each recipe as written. Saving to the library is explicit and restricted to a single recipe context.
object
object
The step, rewritten.
object
object
object
The step, rewritten.
Example
{ "ingredientId": "0199e8b0-5a10-7a01-8b00-000000000012", "lines": [ "1 tbsp butter" ], "steps": []}Example
{ "recipeId": "0199e8b0-5a10-7a01-8b00-000000000006", "ingredientId": "0199e8b0-5a10-7a01-8b00-000000000011", "state": "example-state", "targets": [ { "mealId": "0199e8b0-5a10-7a01-8b00-00000000001b", "revision": "2026-10-15T18:30:00.000Z" } ], "lines": [ "2 tbsp butter" ], "steps": [], "saveToLibrary": false}Responses
Section titled “Responses”Replacement applied.
object
object
object
Ingredients and instructions saved for one planned meal; the library recipe stays separate. Nutrition must be recalculated for substitutions.
object
object
The line as written.
What it is to the dish, as tidy up marked it: needed, swappable or optional. A dislike is left out of lines that aren’t needed. None until marked.
object
object
object
An item as it was, to put it back (Undo).
object
How it got on the list: from the plan, typed in, every week, a usual buy, or the assistant.
object
What checking it off put in the pantry, so unchecking takes it back out.
object
The pantry item it went into; null for household things and staples.
It made that pantry item, rather than joining one already there.
It gave an amount to a pantry item that was there with none, so taking it back leaves that item with none again.
object
The purchase it recorded.
Example
{ "undo": { "listId": "0199e8b0-5a10-7a01-8b00-00000000001c", "meals": [ { "mealId": "0199e8b0-5a10-7a01-8b00-00000000001b", "expected": "2026-10-15T18:30:00.000Z", "variants": [] } ], "library": null, "manual": null }}Invalid replacement.
object
object
object
Example
{ "error": { "code": "not_found", "message": "There's nothing here.", "fields": { "name": "Give it a name." } }}Not signed in.
object
object
object
Example
{ "error": { "code": "not_found", "message": "There's nothing here.", "fields": { "name": "Give it a name." } }}Not allowed.
object
object
object
Example
{ "error": { "code": "not_found", "message": "There's nothing here.", "fields": { "name": "Give it a name." } }}Item or meal not found.
object
object
object
Example
{ "error": { "code": "not_found", "message": "There's nothing here.", "fields": { "name": "Give it a name." } }}The list, meal or recipe changed; review again.
object
object
object
Example
{ "error": { "code": "not_found", "message": "There's nothing here.", "fields": { "name": "Give it a name." } }}© 2026 Kyle Johnson. Documentation: CC BY 4.0. Merran: AGPL-3.0-or-later.