---
title: "Update TestDefinition"
method: PATCH
path: "/api/v3/test-definition/{test_definition_id}"
tags: ["Test Definition"]
---

# Update TestDefinition

`PATCH /api/v3/test-definition/{test_definition_id}`

## Request

- Base URL: `https://{tenant_name}.benchling.com`
- URL: `https://{tenant_name}.benchling.com/api/v3/test-definition/{test_definition_id}`
- Auth: HTTP bearer

Update an existing Test Definition.

## Updatable fields

| Field | Description |
| --- | --- |
| `name` | New display name. Names are trimmed and must be unique within the organization. |
| `organizationId` | New owning organization. Use `GET /benchling/organization/items` to find organization IDs. |
| `resultSchemaId` | New result schema. Use `GET /benchling/result-schema/items` to find result schema IDs. |
| `description` | New description. Empty strings are allowed. |
| `archived`, `archiveReason`, `archiveUserId` | Archive or unarchive the test definition. |

## Constraints

- The caller must have read access to the result schema.
- Moving the Test Definition to a different organization requires admin access to the target organization. Re-specifying the current organization only requires read access to it.
- `resultSchemaId` cannot be changed after any Test Orders exist for the Test Definition.
- Archiving fails if the Test Definition has pending, in-progress, or blocked Test Orders.
- Archiving also fails while the Test Definition is associated with an unarchived assay.
- `archiveSubtreeId` and `legacyArchiveRecordId` are legacy archival fields and should normally be omitted.

## Path parameters

- `test_definition_id` string, required

## Headers

- `EARLY-ACCESS` string

## Request body

- UpdateTestDefinitionInput
  - `archiveReason` string: Why it is being archived. Required when `archived` is `true`, and not allowed when unarchiving.
  - `archived` boolean: Set to `true` to archive or `false` to unarchive it. Archiving requires `archiveReason`.
  - `description` string: Updated human-readable description. Empty strings are allowed; values must be at most 255 characters.
  - `name` string: Updated display name. When provided, it is trimmed and must be non-empty and unique within the organization.
  - `organizationId` string: Updated owning organization. Moving to a different organization requires admin access to that organization.
  - `resultSchemaId` string: Updated result schema. Cannot be changed after test orders have been created for this test definition.

## Response `200`

OK

- TestDefinition: A Test Definition is a configuration object that specifies a type of test or assay that can be ordered against samples. Each Test Definition is associated with a `ResultSchema` that defines the structure of measurement data captured when the test is performed. Test Definitions serve as templates—when a test needs to be performed on a sample, a `TestOrder` is created referencing the appropriate Test Definition. Test Definitions are used within clinical and preclinical study workflows (see `StudySampleTestPlan`) and can be linked to `Procedure` assays for execution. Belongs to an `Organization` and can be archived when no longer needed.
  - `__typename` string
  - `archiveReason` string, nullable
  - `archived` boolean
  - `createdAt` string, datetime: Timestamp of when the test definition was created.
  - `creator` PrincipalRef
    - `__typename` string
    - `id` string, api_id
  - `description` string: The description of the test definition. Empty strings are allowed.
  - `id` string: The ID of the test definition.
  - `modifiedAt` string, datetime: Timestamp of when the test definition was last modified.
  - `name` string: The name of the test definition.
  - `organization` OrganizationRef
    - `__typename` string
    - `id` string, api_id
  - `resultSchema` ResultSchemaRef
    - `__typename` string
    - `id` string, api_id

## Other responses

- `400`: Bad Request
- `403`: Forbidden
- `404`: Not Found
- `409`: Conflict
- `429`: Too Many Requests
- `500`: Internal Server Error

---

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