Skip to Content
Endpoints

Tags

How to work with test case tags using the public API

Tags help organize and categorize test cases within your project. You can use tags in query plans to filter test cases when creating runs.

List Tags

GET/api/public/v0/project/{project_id}/tag/paginated

/paginated endpoints are transitional. In API v1, the base paths will return paginated responses and the /paginated suffix will be removed.

Returns all tags defined in the project. This endpoint is particularly useful when creating run query plans that filter test cases by tags.

Path Parameters

  • project_id: The project identifier (can be either the project code or UUID)

Query Parameters

ParameterTypeDescriptionDefaultExample
offsetnumberNumber of items to skip.0offset=10
limitnumberMaximum number of items to return. Accepted range: 0–1,000.100limit=20
sortFieldstringField to sort by: created_at or title.titlesortField=title
sortOrderstringSort direction for sortField: asc or desc.ascsortOrder=asc
includestringInclude additional fields omitted by default. Accepted value: tcaseCount.Noneinclude=tcaseCount

Response

Status: 200 OK

{
  total: number          // Number of matching tags across all pages
  offset: number         // Offset applied to this response
  limit: number          // Limit applied to this response
  data: Array<{          // Tags in this page
    id: number           //   Tag ID
    title: string        //   Title of the tag
    tcaseCount?: number  //   Number of test cases using this tag; only with `include=tcaseCount`
  }>
}

Example Request

curl \
  -H "Authorization: ApiKey your.api.key.here" \
  https://your-company.your-region-code.qasphere.com/api/public/v0/project/BD/tag/paginated

Example Response

{
  "total": 3,
  "offset": 0,
  "limit": 100,
  "data": [
    {
      "id": 1,
      "title": "regression"
    },
    {
      "id": 2,
      "title": "api-tests"
    },
    {
      "id": 3,
      "title": "smoke-tests"
    }
  ]
}

Using Tags in Run Query Plans

Tags returned by this endpoint can be used in run query plans to filter test cases. For example:

{
  "title": "API Regression Run",
  "type": "live",
  "queryPlans": [
    {
      "folderIds": [1],
      "tagIds": [2], // Using the tag ID for "api-tests"
      "priorities": ["high"]
    }
  ]
}

Tag IDs are unique within a project but not across projects. Always verify you're using tag IDs from the correct project.

Using Multiple Tags

You can include multiple tag IDs in a query plan to select test cases that have any of the specified tags.

{
  "tagIds": [2, 3] // Selects test cases with either "api-tests" or "smoke-tests" tags
}

Create Tag

POST/api/public/v0/project/{project_id}/tag

Creates a tag. Update Test Case Tags also creates missing tags while adding them to test cases.

Request Body

{
  title: string  // Title of the tag (max 255 characters), unique in the project
}

Response

Status: 201 Created

{
  id: number     // Tag ID
  title: string  // Title of the tag
}

Errors

Status CodeDescription
409A tag with the same title exists

Rename Tag

PATCH/api/public/v0/project/{project_id}/tag/{tag_id}

Renames a tag. Test cases keep the tag under its new title, without a new version.

Request Body

{
  title: string  // New title (max 255 characters), unique in the project
}

A request without title is rejected with 400 Bad Request.

Response

Status: 200 OK

The renamed tag, in the shape Create Tag returns.

Errors

Status CodeDescription
409A tag with the same title exists

Rename Tags

PATCH/api/public/v0/project/{project_id}/tag

Renames several tags at once, like Rename Tag.

Request Body

{
  tags: Array<{    // Tags to rename (1 to 1,000)
    id: number     //   Tag ID
    title: string  //   New title (max 255 characters), unique in the project
  }>
}

Tags are renamed one at a time, in the order listed, so a new title can't be one that another tag holds at that point. A tag can be listed more than once, which lets one request swap two titles through a temporary one. For example, to swap the titles of tags 1 (smoke) and 2 (regression):

{
  "tags": [
    { "id": 1, "title": "smoke-old" },
    { "id": 2, "title": "smoke" },
    { "id": 1, "title": "regression" }
  ]
}

Response

Status: 200 OK

{
  tags: Array<{ id: number; title: string }>  // One entry per renamed tag, with its final title
}

Each tag appears once, in the order it was first listed, so a request that lists a tag more than once gets fewer entries back than it sent. The swap above returns:

{
  "tags": [
    { "id": 1, "title": "regression" },
    { "id": 2, "title": "smoke" }
  ]
}

Errors

Status CodeDescription
409A tag with one of the new titles exists

Delete Tag

DELETE/api/public/v0/project/{project_id}/tag/{tag_id}

Deletes a tag.

Irreversible

  • Deleted tags don't go to the trash and can't be restored. A tag is removed from every test case, in every version.
  • Open live runs whose filter uses the tag are re-evaluated straight away. A live run filtered only by deleted tags stops filtering by tag, so it takes in every test case its other filters match, or the whole project when it has no other filter.

Response

Status: 200 OK

{
  message: string
}

Delete Tags

POST/api/public/v0/project/{project_id}/tag/delete

Deletes several tags, like Delete Tag.

Request Body

{
  tagIds: number[]  // Tags to delete (1 to 1,000)
}

Response

Status: 200 OK

{
  message: string
}

List Tags (Deprecated)

Deprecated

This endpoint is deprecated. Use List Tags (GET /api/public/v0/project/{project_id}/tag/paginated) instead.

GET/api/public/v0/project/{project_id}/tag

Returns all tags defined in the project. This endpoint is particularly useful when creating run query plans that filter test cases by tags.

Path Parameters

  • project_id: The project identifier (can be either the project code or UUID)

Response

Status: 200 OK

{
  tags: Array<{
    id: number     //   Tag ID
    title: string  //   Title of the tag
  }>
}

Example Request

curl \
  -H "Authorization: ApiKey your.api.key.here" \
  https://your-company.your-region-code.qasphere.com/api/public/v0/project/BD/tag

Example Response

{
  "tags": [
    {
      "id": 1,
      "title": "regression"
    },
    {
      "id": 2,
      "title": "api-tests"
    },
    {
      "id": 3,
      "title": "smoke-tests"
    }
  ]
}