Skip to main content

Create a Test Case Type (API)

Create a Test Case type in a Jira space and use its identifier when adding Test Cases through the API.

Create a Test Case type, such as Regression or Unit, in a Jira space. Save the returned identifier so your integration can assign that type when creating or updating Test Cases.

Before you begin

  • Create a Vansah API token and use the Vansah URL supplied for your workspace.

  • The token account must be a Jira administrator or a space administrator for the destination Jira space.

  • Choose a name not already used by another active Test Case type in that space.

The examples use Bash and cURL. Set VANSAH_URL to your Vansah base URL without a trailing slash and VANSAH_TOKEN to your API token. Replace DEMO and the type name with values from your own Jira space. Keep the token private.

Endpoint and headers

POST /api/v2/category/caseType

Header

Value

Authorization

Your Vansah API token, without a Bearer prefix.

Content-Type

application/json

Accept

application/json

1. Prepare the request

Body field

What to send

name

Required string. Use a plain-text name of 1–55 characters, such as Regression.

project.key

The Jira space key, such as DEMO. Include it to identify the destination space.

The API field name remains project.key. You can also supply the space context using the projectKey query parameter. Both refer to the Jira space key.

A Jira space can have up to 100 active Test Case types.

{
"name": "Regression",
"project": {
"key": "DEMO"
}
}

2. Create the Test Case type

curl --request POST \
--url "$VANSAH_URL/api/v2/category/caseType" \
--header "Authorization: $VANSAH_TOKEN" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data '{"name":"Regression","project":{"key":"DEMO"}}'

Example successful response:

{
"success": true,
"message": "Created successfully",
"data": {
"identifier": "0ae0b3be-f331-11ef-baf9-5a0ced9d1480",
"name": "Regression"
}
}

Response field

Meaning

success

true when the type is created.

message

A summary of the outcome.

data.identifier

The new Test Case type’s UUID. Use it in requests that require caseType.identifier.

data.name

The saved type name.

3. Confirm and use the type

List the Test Case types in the same Jira space:

curl --request GET --get \
--url "$VANSAH_URL/api/v2/category/caseTypes" \
--header "Authorization: $VANSAH_TOKEN" \
--header "Accept: application/json" \
--data-urlencode "projectKey=DEMO" \
--data-urlencode "startAt=0" \
--data-urlencode "limit=100"

Find the saved name and identifier in the response’s data array. See List Test Case Types for pagination and response details.

When creating a Test Case, include the returned UUID in caseType.identifier:

{
"caseType": {
"identifier": "0ae0b3be-f331-11ef-baf9-5a0ced9d1480"
}
}

This is a fragment to add to your Test Case request, rather than a complete create request. To rename an existing type, use Update a Test Case Type.

Common errors

Problem

What to do

Duplicate Case Type

Use the existing type’s identifier, or choose a different name. A duplicate response has success: false and errorCode: 1390.

Name is invalid or too long

Send a nonempty plain-text string of no more than 55 characters.

Cannot create more than 100 Case Types per space

Reuse an existing type or review the types configured in the Jira space before creating another. The limit check runs before the duplicate-name check.

Please provide space information

Include a valid project.key or projectKey and check access to that Jira space.

Authentication or permission error

Check the token, workspace URL, and the token account’s Jira or space administrator permissions.

If a request times out, list the types before retrying to see whether the type was already created.

Try it in Postman

Open Add Test Case Type in the Vansah API collection and enter your workspace URL, token, Jira space key, and type name.

Did this answer your question?