> ## 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.

# Set environment build

> Set the mobile build an environment launches by default, as Settings → Applications & Envs does.

GitHub App runs, scheduled runs, chats, and runs without a build override use this build. Call it after `create_application_build` on merges to your default branch so the environment tracks the latest merged code. Mobile applications only.



## OpenAPI

````yaml /api-reference/api.json patch /v1/applications/{applicationShortId}/environments/{environmentShortId}
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: Issues
  - name: Todos
  - name: Automations
paths:
  /v1/applications/{applicationShortId}/environments/{environmentShortId}:
    patch:
      tags:
        - Applications
      summary: Set environment build
      description: >-
        Set the mobile build an environment launches by default, as Settings →
        Applications & Envs does.


        GitHub App runs, scheduled runs, chats, and runs without a build
        override use this build. Call it after `create_application_build` on
        merges to your default branch so the environment tracks the latest
        merged code. Mobile applications only.
      operationId: UpdateApplicationEnvironment
      parameters:
        - name: applicationShortId
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/ApplicationShortId'
        - name: environmentShortId
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/EnvironmentShortId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateApplicationEnvironmentRequest'
      responses:
        '200':
          description: The request has succeeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateApplicationEnvironmentResponse'
components:
  schemas:
    ApplicationShortId:
      type: string
      pattern: ^app(-.+_.+|_.+)$
    EnvironmentShortId:
      type: string
      pattern: ^env(-.+_.+|_.+)$
    UpdateApplicationEnvironmentRequest:
      type: object
      required:
        - applicationBuildShortId
      properties:
        applicationBuildShortId:
          allOf:
            - $ref: '#/components/schemas/ApplicationBuildShortId'
          description: >-
            Build to launch by default, from `create_application_build` or `GET
            /applications/{applicationShortId}/builds`. It must belong to the
            same application and use the environment's platform.
        otherApplicationBuildShortIds:
          type: array
          items:
            $ref: '#/components/schemas/ApplicationBuildShortId'
          description: >-
            Companion apps installed next to the primary build, replacing the
            current list. Omit to keep the current list; pass `[]` to clear it.
            Every build must belong to the same application, use the same
            platform, and have a distinct bundle ID. At most 3.
        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.
      description: Set the mobile build a mobile environment launches by default.
    UpdateApplicationEnvironmentResponse:
      type: object
      required:
        - environment
      properties:
        environment:
          $ref: '#/components/schemas/EnvironmentItem'
    ApplicationBuildShortId:
      type: string
      pattern: ^build(-.+_.+|_.+)$
    ProjectShortId:
      type: string
      pattern: ^proj(-.+_.+|_.+)$
    EnvironmentItem:
      type: object
      required:
        - shortId
        - name
        - url
        - isProduction
      properties:
        shortId:
          $ref: '#/components/schemas/EnvironmentShortId'
        name:
          type: string
        url:
          type: string
          nullable: true
        isProduction:
          type: boolean
        applicationBuildShortId:
          allOf:
            - $ref: '#/components/schemas/ApplicationBuildShortId'
          description: >-
            Mobile build the environment launches by default: GitHub App runs,
            scheduled runs, chats and runs without a build override use it.
            Omitted for web and API environments and mobile environments with no
            build.
        otherApplicationBuildShortIds:
          type: array
          items:
            $ref: '#/components/schemas/ApplicationBuildShortId'
          description: Companion mobile apps installed next to the primary build.
        customHeaders:
          type: array
          items:
            $ref: '#/components/schemas/EnvironmentCustomHeaderRule'
          description: >-
            Custom headers applied to matching hosts when tests run against this
            environment.
        basicAuth:
          type: array
          items:
            $ref: '#/components/schemas/EnvironmentBasicAuthRuleSummary'
          description: >-
            Basic auth rules sent to matching hosts when tests run against this
            environment. Passwords are write-only and never returned.
    EnvironmentCustomHeaderRule:
      type: object
      required:
        - domains
        - headers
      properties:
        domains:
          type: array
          items:
            type: string
          description: >-
            Host patterns that receive these headers. `*.preview.example.com`
            matches the apex and any subdomain.
        headers:
          type: object
          additionalProperties:
            type: string
          description: >-
            Header name to value. Applied by the platform on matching requests;
            generated test code cannot read the values.
      description: >-
        Host patterns (`*.preview.example.com` or an exact host) and the headers
        to attach to matching requests. Used for auth, deployment-protection
        bypass, and similar platform access. When provided on an environment
        override, the rules are persisted on the environment.
    EnvironmentBasicAuthRuleSummary:
      type: object
      required:
        - domains
        - username
      properties:
        domains:
          type: array
          items:
            type: string
          description: Host patterns that receive these credentials.
        username:
          type: string
          description: Basic auth username.
      description: >-
        Basic auth rule as returned on reads. The password is write-only and
        never returned.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: Bearer

````

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