> ## Documentation Index
> Fetch the complete documentation index at: https://api-docs.nunu.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Test Plan

> Apply a partial update to a test plan.

<Info>
  **Permission Required**: `project:edit-tests`
</Info>

Apply a partial update to a test plan. The `patch` is deep-merged into the
current test plan. Arrays — including `test_items` — are replaced wholesale.

## Path Parameters

<ParamField path="testPlanId" type="string" required>
  The test plan ID (UUID)
</ParamField>

## Request Body

<ParamField body="patch" type="object" required>
  Partial test plan body. Supply only the fields you want to change. Cannot
  change the test plan `id`.
</ParamField>

## Response

Returns the updated test plan (same shape as
[Get Test Plan](/api-reference/test-plans/get-test-plan)).

<RequestExample>
  ```bash cURL (rename) theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
  curl -X PATCH "https://nunu.ai/api/v1/project/your-project-id/test-plans/b3f1a2c4-5d6e-7f8a-9b0c-1d2e3f4a5b6c" \
    -H "X-Api-Key: YOUR_API_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "patch": { "name": "Nightly Smoke v2" }
    }'
  ```

  ```bash cURL (replace test items) theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
  curl -X PATCH "https://nunu.ai/api/v1/project/your-project-id/test-plans/b3f1a2c4-5d6e-7f8a-9b0c-1d2e3f4a5b6c" \
    -H "X-Api-Key: YOUR_API_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "patch": {
        "test_items": [
          { "multiplayer_test_id": "a5060a07-d386-4269-98ce-b33fb894201e", "retries": 2 }
        ]
      }
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
  {
    "id": "b3f1a2c4-5d6e-7f8a-9b0c-1d2e3f4a5b6c",
    "project_id": "test",
    "name": "Nightly Smoke v2",
    "test_items": [ { "...": "..." } ],
    "...": "..."
  }
  ```
</ResponseExample>


## OpenAPI

````yaml PATCH /project/{projectId}/test-plans/{testPlanId}
openapi: 3.1.0
info:
  title: nunu.ai API
  description: >-
    The nunu.ai Public API allows you to programmatically interact with your
    projects, manage test runs, and upload builds.
  version: 1.0.0
servers:
  - url: https://nunu.ai/api/v1
security:
  - apiKeyAuth: []
paths:
  /project/{projectId}/test-plans/{testPlanId}:
    parameters:
      - name: projectId
        in: path
        required: true
        schema:
          type: string
        description: >-
          The project ID. You can copy it from the project settings page or the
          project URL in the dashboard.
    patch:
      tags:
        - Test Plans
      summary: Update Test Plan
      description: Apply a partial update to a test plan.
      operationId: updateTestPlan
      parameters:
        - name: testPlanId
          in: path
          required: true
          description: Test plan ID (UUID)
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateTestPlanRequest'
      responses:
        '200':
          description: Test plan updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TestPlan'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden - missing project:edit-tests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Test plan not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    UpdateTestPlanRequest:
      type: object
      required:
        - patch
      properties:
        patch:
          type: object
          description: >-
            Partial test plan body. Object fields are deep-merged; arrays
            (including test_items) are replaced wholesale.
    TestPlan:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for the test plan
        project_id:
          type: string
          format: uuid
          description: Project the test plan belongs to
        name:
          type: string
          description: Test plan name
        created_at:
          type: string
          format: date-time
          nullable: true
        created_by:
          type: string
          nullable: true
        modified_at:
          type: string
          format: date-time
          nullable: true
        modified_by:
          type: string
          nullable: true
        slots:
          type: array
          items:
            $ref: '#/components/schemas/TestPlanSlot'
          description: >-
            Extra deployment slots of a cross-platform test plan (read-only via
            the API; managed in the test plan editor). Their indices key
            `slot_deployment_configs` when starting the plan; slot 1 is the
            implicit default slot.
        default_slot_name:
          type: string
          nullable: true
          description: >-
            Optional display name of the implicit default slot (slot 1).
            Read-only via the API.
        test_items:
          type: array
          items:
            $ref: '#/components/schemas/TestPlanTestItem'
          description: Ordered list of tests in this plan
    Error:
      type: object
      properties:
        error:
          type: string
        code:
          type: string
        details:
          type: object
    TestPlanSlot:
      type: object
      properties:
        index:
          type: integer
          description: >-
            Slot index (2 or higher; slot 1 is the implicit default slot and is
            not listed)
        name:
          type: string
          nullable: true
          description: >-
            Optional display name. Names are labels only; slots are addressed by
            index
    TestPlanTestItem:
      type: object
      properties:
        multiplayer_test_id:
          type: string
          format: uuid
          description: ID of the test to include in the plan
        retries:
          type: integer
          minimum: 0
          default: 0
          description: Number of retries for this test item
      required:
        - multiplayer_test_id
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key
      description: API key for authentication

````