> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qa.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# Exporting Test Cases

> Export your test case definitions, including steps, via the API or CLI

Export all test case definitions from your project, including names, goals, expected results, and step-by-step instructions. This is useful for migrating to another test management tool (for example Jira with Xray or Zephyr), keeping external backups, or building custom reports.

## What Gets Exported

The [List Test Cases](/api-reference/test-cases/list-test-cases) endpoint returns published test cases. Each test case includes its name, goal, expected result, labels, enabled state, classification, and the most recent run status. When you pass `includeSteps=true`, each test case also includes a `steps` array with step-by-step instructions.

See the [List Test Cases reference](/api-reference/test-cases/list-test-cases) for the full response schema.

<Note>
  Steps are opt-in via the `includeSteps` query parameter to keep default
  responses small. Test cases that are defined by a goal only (without a step
  breakdown) return an empty `steps` array.
</Note>

## Export via the API

Pass `includeSteps=true` to include the full step definitions:

```bash theme={null}
curl "https://api.qa.tech/v1/test-cases?includeSteps=true&limit=1000" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
```

The endpoint returns up to 1000 test cases per request. If your project has more, page through the results with `offset`:

```bash theme={null}
curl "https://api.qa.tech/v1/test-cases?includeSteps=true&limit=1000&offset=1000" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
```

See the [API Introduction](/api-reference/introduction#authentication) for how to create an API token. With an organization-scoped key, also pass `projectShortId` as a query parameter.

## Export via the CLI

The [qatech CLI](/cli/overview) wraps the same endpoint:

```bash theme={null}
qatech test-cases --include-steps --json > test-cases.json
```

See [qatech test-cases](/cli/commands/test-cases) for all options.

## Converting to CSV

Many test management importers expect one row per step. This `jq` one-liner converts the JSON export into that shape:

```bash theme={null}
qatech test-cases --include-steps --json | jq -r '
  ["Test Case ID", "Test Case Name", "Step Number", "Step Instruction", "Step Expected Result"],
  (.testCases[] | . as $tc | .steps // [] | to_entries[] |
    [$tc.id, $tc.name, (.key + 1), .value.instruction, (.value.expectedResult // "")])
  | @csv' > test-case-steps.csv
```

For a one-row-per-test-case shape with numbered steps in a single column:

```bash theme={null}
qatech test-cases --include-steps --json | jq -r '
  ["Test Case ID", "Name", "Goal", "Expected Result", "Steps"],
  (.testCases[] |
    [.id, .name, (.goal // ""), (.expectedResult // ""),
     ([.steps // [] | to_entries[] | "\(.key + 1). \(.value.instruction)"] | join("\n"))])
  | @csv' > test-cases.csv
```

## Related

* [List Test Cases](/api-reference/test-cases/list-test-cases) - Full endpoint reference
* [qatech test-cases](/cli/commands/test-cases) - CLI command reference
* [API Introduction](/api-reference/introduction) - Authentication and ID reference
