---
title: "Get a test case"
method: GET
path: "/v1/test-cases/{test_case_id}"
tags: ["test-cases"]
---

# Get a test case

`GET /v1/test-cases/{test_case_id}`

Retrieve a single test case by ID, including version history and category. Pass `version_id` query param to get snapshotted fields from a specific version.

## Path parameters

- `test_case_id` string, required

## Query parameters

- `version_id` string, nullable

## Headers

- `x-api-key` string

## Response `200`

Test case found

- GetTestCaseResponse — Full test case detail
  - `id` string, required
  - `name` string, required
  - `steps` string, required
  - `expected_result` string, required
  - `description` string, nullable
  - `priority` string, nullable
  - `status` string, nullable
  - `created_at` string, nullable
  - `updated_at` string, nullable
  - `category` CategoryReference — Reference to a category
    - `id` string, required — Category ID
    - `name` string, required — Category name
  - `versions` TestCaseVersionItem[]
    - `id` string, required — Version ID
    - `version_number` integer, required — Version number
    - `created_at` string, required — Version creation timestamp
  - `variables` TestCaseVariableOutput[] — Declared variables on this test case. Empty array when none.
    - `name` string, required — Identifier matching /^[a-z][a-z0-9_]*$/, up to 40 chars; unique within the test case
    - `type` string, required — One of "string" or "number"
    - `required` boolean — When true, callers must supply a value at run creation (unless a default is set). The frontend also prompts for this variable in the run form.
    - `default` unknown
    - `description` string, nullable — Optional human-readable description shown in tooltips and the run form.
  - `files` TestCaseFileAttachmentOutput[] — Attached test files with per-association descriptions.
    - `file_id` string, required — Attached test_files.id
    - `description` string, nullable — Per-association attachment description
    - `file_path` string, nullable — Storage path for the attached test file
    - `original_name` string, nullable — Original uploaded filename
    - `file_type` string, nullable — MIME type
    - `file_size` integer, nullable — File size in bytes

## Other responses

- `401` — Invalid or missing API key
- `404` — Test case not found
- `422` — Validation Error
- `500` — Internal server error

---

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