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

# Update automation

> Update an automation's name, description, enabled state, trigger or action. `trigger` and `action` replace the stored value as a whole. Set `isEnabled` to pause or resume it.



## OpenAPI

````yaml /api-reference/api.json patch /v1/automations/{automationId}
openapi: 3.0.0
info:
  title: QA.tech API
  version: 1.0.0
  contact:
    name: QA.tech
    url: https://qa.tech
    email: support@qa.tech
  description: API for triggering and managing AI-powered test runs
servers:
  - url: https://api.qa.tech
    description: Production
    variables: {}
security:
  - BearerAuth: []
tags:
  - name: Runs
  - name: Infrastructure
  - name: Test Cases
  - name: Application Builds
  - name: Status badge
  - name: Remote Tunnels
  - name: Chat
  - name: Applications
  - name: Features
  - name: Metrics
  - name: Projects
  - name: Knowledge
  - name: Rules
  - name: Configs
  - name: Labels
  - name: Issues
  - name: Todos
  - name: Automations
  - name: Test plans
paths:
  /v1/automations/{automationId}:
    patch:
      tags:
        - Automations
      summary: Update automation
      description: >-
        Update an automation's name, description, enabled state, trigger or
        action. `trigger` and `action` replace the stored value as a whole. Set
        `isEnabled` to pause or resume it.
      operationId: UpdateAutomation
      parameters:
        - name: automationId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateAutomationRequest'
      responses:
        '200':
          description: The request has succeeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateAutomationResponse'
components:
  schemas:
    UpdateAutomationRequest:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 120
        description:
          type: string
          nullable: true
          maxLength: 500
          description: Set to null to clear the description
        isEnabled:
          type: boolean
          description: >-
            Re-enabling a schedule automation restarts it from the next upcoming
            tick.
        trigger:
          allOf:
            - $ref: '#/components/schemas/AutomationTriggerInput'
          description: Replaces the whole trigger
        action:
          allOf:
            - $ref: '#/components/schemas/AutomationAction'
          description: Replaces the whole action
        projectShortId:
          allOf:
            - $ref: '#/components/schemas/ProjectShortId'
          description: >-
            Target a specific project by its prefixed short ID
            (proj-slug_shortId or proj_shortId), as returned by the projects
            API. Required for organization-scoped API keys; project-scoped keys
            may only pass their own project's short ID.
    UpdateAutomationResponse:
      type: object
      required:
        - success
        - automation
      properties:
        success:
          type: boolean
        automation:
          $ref: '#/components/schemas/Automation'
    AutomationTriggerInput:
      anyOf:
        - $ref: '#/components/schemas/AutomationScheduleTrigger'
        - $ref: '#/components/schemas/AutomationApiWebhookTrigger'
        - $ref: '#/components/schemas/AutomationGithubEventTrigger'
      description: >-
        When the automation fires. `schedule` and `api_webhook` automations can
        also be fired on demand through the trigger endpoint.
    AutomationAction:
      anyOf:
        - $ref: '#/components/schemas/AutomationChatAction'
        - $ref: '#/components/schemas/AutomationRunTestPlanAction'
        - $ref: '#/components/schemas/AutomationReviewPullRequestAction'
      description: What the automation does when it fires.
    ProjectShortId:
      type: string
      pattern: ^proj(-.+_.+|_.+)$
    Automation:
      type: object
      required:
        - id
        - name
        - description
        - isEnabled
        - trigger
        - action
        - lastTriggeredAt
        - nextRunAt
        - createdAt
        - updatedAt
      properties:
        id:
          type: string
        name:
          type: string
        description:
          type: string
          nullable: true
        isEnabled:
          type: boolean
          description: >-
            Disabled automations never fire on their schedule and reject API
            triggers.
        trigger:
          $ref: '#/components/schemas/AutomationTrigger'
        action:
          $ref: '#/components/schemas/AutomationAction'
        lastTriggeredAt:
          type: string
          nullable: true
        nextRunAt:
          type: string
          nullable: true
          description: >-
            Next scheduled fire time for enabled schedule automations; null
            otherwise.
        createdAt:
          type: string
        updatedAt:
          type: string
    AutomationScheduleTrigger:
      type: object
      required:
        - type
        - cron
      properties:
        type:
          type: string
          enum:
            - schedule
        cron:
          type: string
          minLength: 1
          description: >-
            Standard 5-field cron expression (minute hour day-of-month month
            day-of-week), evaluated in `timezone`. Example: `0 9 * * 1` for
            Mondays at 09:00.
        timezone:
          type: string
          description: >-
            IANA timezone the cron is evaluated in, such as `Europe/Stockholm`.
            Defaults to `UTC`.
        once:
          type: boolean
          description: >-
            Fire once and then disable the automation. Pin minute, hour, day and
            month in `cron` when set. Defaults to `false`.
      description: Fire on a cron schedule.
    AutomationApiWebhookTrigger:
      type: object
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - api_webhook
      description: >-
        Only fire when called through `POST /automations/{automationId}/trigger`
        (CI, deploy hooks, monitoring).
    AutomationGithubEventTrigger:
      type: object
      required:
        - type
        - events
      properties:
        type:
          type: string
          enum:
            - github_event
        events:
          type: array
          items:
            $ref: '#/components/schemas/AutomationGithubEvent'
          minItems: 1
          description: Events that fire the automation.
        labels:
          type: array
          items:
            type: string
          description: >-
            Only fire for pull requests with one of these labels
            (case-insensitive). For `pull_request.labeled`, the label that was
            just added must be one of them.
        baseBranches:
          type: array
          items:
            type: string
          description: >-
            Only fire for pull requests into these base branches. `*` matches
            any characters, e.g. `release/*`.
        repositories:
          type: array
          items:
            type: string
          description: >-
            Only fire for these repositories, as `owner/name`. Defaults to every
            repository connected to the project.
        includeDrafts:
          type: boolean
          description: Also fire for draft pull requests. Defaults to `false`.
      description: >-
        Fire on pull request events in repositories connected to the project.
        Empty filters match everything.
    AutomationChatAction:
      type: object
      required:
        - type
        - prompt
      properties:
        type:
          type: string
          enum:
            - chat
        prompt:
          type: string
          minLength: 1
          description: >-
            Instructions for the assistant. It runs without a user present, so
            describe the full task and the expected outcome.
      description: >-
        Start a chat conversation with the QA.tech assistant that works through
        `prompt` autonomously.
    AutomationRunTestPlanAction:
      type: object
      required:
        - type
        - testPlanShortId
      properties:
        type:
          type: string
          enum:
            - run_test_plan
        testPlanShortId:
          $ref: '#/components/schemas/TestPlanShortId'
      description: Run every test case in a test plan.
    AutomationReviewPullRequestAction:
      type: object
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - review_pull_request
      description: >-
        Run the full QA.tech pull request review on the pull request that fired
        the automation, as if QA.tech was mentioned on it. Needs a
        `github_event` trigger with only open pull request events (not `merged`
        or `closed`).
    AutomationTrigger:
      anyOf:
        - $ref: '#/components/schemas/AutomationScheduleTrigger'
        - $ref: '#/components/schemas/AutomationApiWebhookTrigger'
        - $ref: '#/components/schemas/AutomationGithubEventTrigger'
        - $ref: '#/components/schemas/AutomationReservedTrigger'
    AutomationGithubEvent:
      type: string
      enum:
        - pull_request.opened
        - pull_request.ready_for_review
        - pull_request.synchronize
        - pull_request.labeled
        - pull_request.merged
        - pull_request.closed
      description: >-
        A pull request webhook from a repository connected to the project
        through the QA.tech GitHub app. `merged` and `closed` (closed without
        merging) are both GitHub's `closed` action.
    TestPlanShortId:
      type: string
      pattern: ^pln(-.+_.+|_.+)$
    AutomationReservedTrigger:
      type: object
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - graph_change
      description: Reserved trigger types that are stored but not yet emitted.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: Bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.