Skip to content
Skip to Content
Docs
Studio

Restore Recipe to Version

Roll back a live recipe to the content state it had at a prior version.

This is a full point-in-time restore — every sub-entity of the recipe (ingredients, servings, nutrition, label configuration, summary, metadata) snaps back to exactly the state recorded in target_version_id. Any sub-entities added or modified after that version — including servings added later — are removed in the restored commit. This matches the semantics of git checkout <tag>: the entire tree reverts, not just the fields that changed between the target and the current HEAD.

This is a version rollback, not an un-delete. The recipe must be ACTIVE or ARCHIVED — a deleted recipe returns 404 (recipe_not_found), the same as any other read. To check whether a recipe is deleted, call getRecipe first; deleted recipes are fully hidden from all endpoints.

Creates a new commit whose content matches target_version_id; the existing history is never rewritten. The new version_id is returned in the response body and ETag header — pass it as If-Match on subsequent mutations. Returns 404 if the recipe does not exist (or is deleted), or if the target version does not exist; 412 on If-Match mismatch.

POST
/studio/recipes/{recipe_id}/restore

Path Parameters

recipe_id*Recipe Id

Header Parameters

If-Match*string

The recipe's current version_id: the one the last change to this recipe returned, or the one reading the recipe returns (get_recipe). A stale value is refused with the current version_id; read the recipe again and retry.

Request Body

application/json
  1. body

Request body for POST /recipes/{recipe_id}/restore.

A flat, single-field body — no nesting needed for a rollback operation that requires only the target version identifier.

target_version_id*Target Version Id

The version_id to restore. Full point-in-time restore — all sub-entities (ingredients, servings, nutrition, label configuration, summary, metadata) revert to exactly the state recorded at this version. Sub-entities added or modified after this version are removed in the restored commit. Earlier versions are kept; the restored state is saved as a new version.

Match^[0-9A-HJKMNP-TV-Z]{26}$

Response Body

Successful Response

application/json
  1. response

Recipe state reconstructed at a specific version.

Returns the recipe exactly as it existed at the requested version. The response envelope is identical to GET /recipes/{id} so clients can reuse rendering logic — only the URL differs.

data*

Recipe state as it existed at the requested version. Field shape matches the live GET /recipes/{id} response; values reflect the historical snapshot rather than the current head.

meta*

Standard response metadata (API version, request id, timestamp).

version_id?|

Version committed by this mutation; pass on the next request as If-Match for optimistic concurrency. Present only on restore responses (where a new version is committed); absent on point-in-time read responses.

Example Request
curl -X POST 'https://api.bettermenu.live/studio/recipes/string/restore' \  -H 'If-Match: string' \  -H 'Content-Type: application/json' \  -d '{  "target_version_id": "01ARZ3NDEKTSV4RRFFQ69G5FAV"}'
Example Response
{  "data": {    "id": "string",    "name": "string",    "country": "US",    "regulatory_authority": "US_FDA",    "demographic": "adults_and_children_over_4",    "status": "active",    "created_at": "string",    "updated_at": "string"  },  "meta": {    "version": "string",    "request_id": "string",    "timestamp": "string"  },  "version_id": "string"}

Recipe in, FDA-format Nutrition Facts out, with every version kept.

Start freeNo card needed.