---
title: "Create or update a Test"
method: PUT
path: "/orgs/{orgName}/tests/{testName}"
tags: ["Tests"]
---

# Create or update a Test

`PUT /orgs/{orgName}/tests/{testName}`

## Request

- Base URL: `https://api.signadot.com/api/v2`
- URL: `https://api.signadot.com/api/v2/orgs/{orgName}/tests/{testName}`
- Auth: API key in header `signadot-api-key`

Creates or updates a test with the provided parameters.

## Path parameters

- `orgName` string, required
- `testName` string, required

## Request body

- TestSpec
  - `defaultTimeout` string: DefaultTimeout represents an optional default timeout for the test executions associated with this test, which can override this value. If not supplied, it defaults to "5m". It should be a string representing an unsigned integer in decimal not exceeding 32 bits followed by a units character, which can be one of the following. - 'm' for minutes - 'h' for hours - 'd' for days - 'w' for weeks
  - `script` string
  - `triggers` TestTrigger[]
    - `executionTemplate` TestExecutionTemplate
      - `autoDiff` TestExecutionAutoDiff
        - `enabled` boolean: Enabled = true, requires the definition of a valid routing context
      - `cluster` string
      - `publish` boolean: Publish represents whether the test execution will show up by default in the UI, i.e. to filter out ad-hoc and test the test usage.
      - `timeout` string: Timeout represents an optional timeout for the test execution. If not supplied, it defaults to the DefaultTimeout of the associated test, if that is present. If that is not present, it defaults to "5m". It should be a string representing an unsigned integer not exceeding 32 bits followed by a units character, which can be one of the following. - 'm' for minutes - 'h' for hours - 'd' for days - 'w' for weeks
    - `id` string
    - `sandboxOf` WorkloadWorkload
      - `kind` string, required: Kind of the baseline workload.
      - `name` string, required: Name of the entity within the Kubernetes cluster.
      - `namespace` string, required: Namespace within which the entity lives in the Kubernetes cluster.

## Response `200`

OK

- Test
  - `createdAt` string
  - `name` string
  - `spec` TestSpec
    - `defaultTimeout` string: DefaultTimeout represents an optional default timeout for the test executions associated with this test, which can override this value. If not supplied, it defaults to "5m". It should be a string representing an unsigned integer in decimal not exceeding 32 bits followed by a units character, which can be one of the following. - 'm' for minutes - 'h' for hours - 'd' for days - 'w' for weeks
    - `script` string
    - `triggers` TestTrigger[]
      - `executionTemplate` TestExecutionTemplate
        - `autoDiff` TestExecutionAutoDiff
          - `enabled` boolean: Enabled = true, requires the definition of a valid routing context
        - `cluster` string
        - `publish` boolean: Publish represents whether the test execution will show up by default in the UI, i.e. to filter out ad-hoc and test the test usage.
        - `timeout` string: Timeout represents an optional timeout for the test execution. If not supplied, it defaults to the DefaultTimeout of the associated test, if that is present. If that is not present, it defaults to "5m". It should be a string representing an unsigned integer not exceeding 32 bits followed by a units character, which can be one of the following. - 'm' for minutes - 'h' for hours - 'd' for days - 'w' for weeks
      - `id` string
      - `sandboxOf` WorkloadWorkload
        - `kind` string, required: Kind of the baseline workload.
        - `name` string, required: Name of the entity within the Kubernetes cluster.
        - `namespace` string, required: Namespace within which the entity lives in the Kubernetes cluster.
  - `status` TestStatus
  - `updatedAt` string

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `502`: Bad Gateway

## Changes

- **2024-09-26** `f20f3be8ae04`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/signadot/apis/signadot-api/changes/orgs/:orgName/tests/:testName/put.md)

---

[API](https://skmtc.dev/signadot/apis/signadot-api.md) - [All operations](https://skmtc.dev/signadot/apis/signadot-api/llms.txt) - [OpenAPI document](https://skmtc.dev/signadot/apis/signadot-api/revisions/5e80b0f9c718?raw)
