---
title: "Create a test case"
method: POST
path: "/v4/test-cases"
tags: ["TestCases"]
---

# Create a test case

`POST /v4/test-cases`

Create a new test case

## Request body

- CreateTestCase — Test case creation parameters
  - `datasetId` string, uuid, required — Dataset UUID
  - `name` string, required — Test case name
  - `inputs` object, required — Test case inputs as a JSON object
  - `expectedOutputs` object — Optional expected outputs as a JSON object

## Response `200`

Successful response

- TestCase
  - `id` string, uuid, required — Test Case UUID
  - `createdAt` string, required — Creation timestamp (ISO 8601)
  - `updatedAt` string, required — Last update timestamp (ISO 8601)
  - `inputs` object, required — Input data for the test case
  - `expectedOutputs` object, nullable, required — Expected output data for the test case
  - `datasetId` string, required — Associated Dataset UUID
  - `name` string, required — Test Case name
  - `pipelineId` string, uuid, required — Associated Pipeline UUID
  - `archivedAt` string, nullable, required — Archive timestamp (ISO 8601)
  - `deletedAt` string, nullable, required — Deletion timestamp (ISO 8601)

## Other responses

- `400` — Client provided an invalid request for the test case. Please check the request format and parameters.
- `401` — No valid API key provided.
- `404` — The test case resource does not exist.
- `500` — Something went wrong on Gentrace's end.

## Changes

- **2025-04-28** `76bde656b16e` — 5 breaking, 2 info
  - the `archivedAt` response's property type/format changed from `string, null`/`date-time` to `string, null`/`` for status `200`
  - the `createdAt` response's property type/format changed from `string`/`date-time` to `string`/`` for status `200`
  - the `deletedAt` response's property type/format changed from `string, null`/`date-time` to `string, null`/`` for status `200`
  - the `updatedAt` response's property type/format changed from `string`/`date-time` to `string`/`` for status `200`
  - …3 more
- **2025-04-22** `610091298e37` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/gentrace/apis/gentrace-api/changes/v4/test-cases/post.md)

---

[API](https://skmtc.dev/gentrace/apis/gentrace-api.md) · [All operations](https://skmtc.dev/gentrace/apis/gentrace-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/gentrace/gentrace-api/revisions/938ac0c5af7b/schema)
