Skip to main content
PATCH
/
api
/
test-cases
/
v2
/
{id}
Update Test Case Tags
curl --request PATCH \
  --url https://api.example.com/api/test-cases/v2/{id} \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "tags": [
    "<string>"
  ]
}
'
{
  "data": {
    "test_case": {
      "id": "a30a6eba6312f6b87ea5-55e241fbe3f4b8ae61ee",
      "name": "search works",
      "file_path": "search.spec.ts",
      "suites": ["Search"],
      "playwright_project": "chromium",
      "tags": ["smoke", "critical"]
    },
    "source_file_updated": true
  }
}
Updates the tags for a given test case. This updates both the database record and the Playwright test source file on GitHub (by adding/removing the tag property in the test options).

Request

Authorization
string
required
Bearer token for authentication. Format: Bearer <your-api-key>
id
string
required
The Playwright test ID (pw_test_id) — a 41-character hash that uniquely identifies a test case per Playwright project.
tags
string[]
required
The full list of tags to set on this test case. Tags to add or remove are computed by diffing against the current tags in the source file.
{
  "tags": ["smoke", "critical"]
}

Response

data.test_case
object
The updated test case object.
data.source_file_updated
boolean
Whether the source file on GitHub was successfully updated.
error
object
Present when the source file update failed. The database is still updated.
{
  "data": {
    "test_case": {
      "id": "a30a6eba6312f6b87ea5-55e241fbe3f4b8ae61ee",
      "name": "search works",
      "file_path": "search.spec.ts",
      "suites": ["Search"],
      "playwright_project": "chromium",
      "tags": ["smoke", "critical"]
    },
    "source_file_updated": true
  }
}

Example

curl -X PATCH \
  https://dash.empirical.run/api/test-cases/v2/a30a6eba6312f6b87ea5-55e241fbe3f4b8ae61ee \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $EMPIRICALRUN_KEY" \
  -d '{
    "tags": ["smoke", "critical"]
  }'