---
title: "Update an instance"
method: PUT
path: "/recipes/{recipe_id}/instances/{dataset_id}"
tags: ["Private"]
---

# Update an instance

`PUT /recipes/{recipe_id}/instances/{dataset_id}`

## Request

- The document declares no server URL.
- Auth: API key in header `service-token`

Update an instance of recipe by getting the specific instance and recipe by id and update in mongo

## Path parameters

- `recipe_id` string, required
- `dataset_id` string, required

## Request body

- UpdateInstance: An instance represents a single dataset
  - `dataset_id` string: A unique id for a dataset
  - `editions` string[]: Types of editions within the dataset
  - `title` string: The title for the dataset
  - `code_lists` CodeList[]: A list of all code lists within this instance
    - `id` string: A unique id for a single code list
    - `name` string: The name of the codelist
    - `href` string: A URL to the code list
    - `is_hierarchy` boolean: A bool to inform if there is hierarchy for codelist

## Response `200`

Specific recipe updated successfully with given instance updates

## Other responses

- `400`: An incomplete/invalid instance entered in request to be updated to mongo
- `401`: Unauthorisation request as invalid auth token given
- `404`: Recipe not found
- `500`: Failed to process the request due to an internal error

---

[API](https://skmtc.dev/office-of-national-statistics/apis/recipe-api.md) - [All operations](https://skmtc.dev/office-of-national-statistics/apis/recipe-api/llms.txt) - [OpenAPI document](https://skmtc.dev/office-of-national-statistics/apis/recipe-api/revisions/51dcd3258b3d?raw)
