---
title: "Create a recipe"
method: POST
path: "/recipes"
tags: ["Private"]
---

# Create a recipe

`POST /recipes`

## Request

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

Create a recipe and add to mongo

## Request body

- AddRecipe: An object returned for a recipe
  - `id` string: A unique id for the recipe
  - `alias` string: An alias for the recipe
  - `format` 'v4' | 'cantabular_blob' | 'cantabular_table': The recipe format
  - `files` InputFile[]
    - `description` string, required: The description of the input file
  - `output_instances` Instance[]: A list of all instances created using this recipe
    - `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
  - `cantabular_blob` string: A Cantabular-specific collection of data

## Response `200`

A json object of a recipe which has been created

- Recipe: An object returned for a recipe
  - `id` string: A unique id for the recipe
  - `alias` string: An alias for the recipe
  - `format` 'v4' | 'cantabular_blob' | 'cantabular_table': The recipe format
  - `files` InputFile[]
    - `description` string, required: The description of the input file
  - `output_instances` Instance[]: A list of all instances created using this recipe
    - `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
  - `cantabular_blob` string: A Cantabular-specific collection of data

## Other responses

- `400`: An incomplete/invalid recipe entered in request to be added to mongo
- `401`: Unauthorisation request as invalid auth token given
- `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)
