---
title: "Create a new case template"
method: POST
path: "/cases/templates"
tags: ["cases"]
---

# Create a new case template

`POST /cases/templates`

## Headers

- `X-CSRF-Protection` boolean, required

## Request body

- object
  - `case_definition` object, required
    - `inputs` object[], required
      - `choices` string[] — value_type enum only
      - `default_value` string, required — Plain string, except tuple / array which keep the literal text
      - `description` string
      - `label` string, required
      - `max` number
      - `min` number — value_type number only; specify both bounds or neither
      - `unit` string
      - `value_type` 'number' | 'smiles' | 'string' | 'tuple' | 'array' | 'enum', required
      - `variable_name` string, required — Top-level notebook variable the run screen's value is assigned to
    - `outputs` object[], required
      - `cell_index` integer — 0-based cell producing the figure (type image)
      - `description` string
      - `figure_index` integer — Which of that cell's figures; absent means the first (type image)
      - `name` string, required
      - `type` 'number' | 'image', required
      - `unit` string — Physical unit shown after the value (type number)
      - `variable_name` string — Notebook variable the capture cell prints for this output; required for a number output, and unique among the number outputs
    - `validations` object[], required
      - `cell_index` integer — 0-based cell carrying the evidence
      - `method` 'prompt', required — Completing without an exception is checked for every case and is not declared, so a stored validation is always LLM-judged
      - `name` string, required
      - `prompt` string, required
  - `case_template_group` union, required
    - object — Select an existing case template group by ID.
      - `id` string, required
    - object — Create a new case template group inline.
      - `description` string, required — case template group description
      - `title` string, required — case template group title
  - `description` string, required — case template description
  - `notebook_content` object, required — Initial notebook (ipynb JSON); code cell outputs are stripped server-side
  - `steps` string[] — Ordered list of computation steps (array order = display order)
  - `title` string, required — case template title

## Response `201`

Succeeded

- object — A single case template (without notebook content).
  - `data` object, required
    - `case_definition` object, required — Empty arrays when the template declares no definition
      - `inputs` object[], required
        - `choices` string[], required
        - `default_value` string, required
        - `description` string, required
        - `label` string, required
        - `max` number
        - `min` number
        - `unit` string
        - `value_type` 'number' | 'smiles' | 'string' | 'tuple' | 'array' | 'enum', required
        - `variable_name` string, required
      - `outputs` object[], required
        - `cell_index` integer
        - `description` string, required
        - `figure_index` integer
        - `name` string, required
        - `type` 'number' | 'image', required
        - `unit` string
        - `variable_name` string — Notebook variable the capture cell prints (type number; absent on rows stored before it was persisted)
      - `validations` object[], required
        - `cell_index` integer
        - `method` 'prompt', required
        - `name` string, required
        - `prompt` string, required
    - `case_template_group_id` string, required
    - `created_at` string, date-time, required
    - `description` string, required — case template description
    - `id` string, required
    - `is_official` boolean, required
    - `owner` object
      - `id` string, required
      - `name` string, required — User name
    - `steps` string[], required — Ordered list of computation steps (array order = display order)
    - `title` string, required — case template title
    - `updated_at` string, date-time, required

## Other responses

- `400` — Bad request
- `default` — Other error

---

[API](https://skmtc.dev/matlantis/apis/matlantis-web-ui-backend-api.md) · [All operations](https://skmtc.dev/matlantis/apis/matlantis-web-ui-backend-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/matlantis/matlantis-web-ui-backend-api/revisions/b155f3a32673/schema)
