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

# Fix a branch's demo build

> Fix a branch whose demo build is missing: apply the deterministic Ankra-side fixes first (publish-readiness auto-fix, failed-run rerun, failed-setup retry) and, when those cannot produce an image, dispatch a one-shot mission agent that investigates the repository and opens a pull request with the fix. Browser session authentication with the X-Ankra-CSRF double-submit header only (no bearer twin).



## OpenAPI

````yaml https://platform.ankra.app/openapi.json post /org/applications/{application_id}/demos/fix-build
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: https://platform.ankra.app
security: []
paths:
  /org/applications/{application_id}/demos/fix-build:
    post:
      tags:
        - Applications API
      summary: Fix a branch's demo build
      description: >-
        Fix a branch whose demo build is missing: apply the deterministic
        Ankra-side fixes first (publish-readiness auto-fix, failed-run rerun,
        failed-setup retry) and, when those cannot produce an image, dispatch a
        one-shot mission agent that investigates the repository and opens a pull
        request with the fix. Browser session authentication with the
        X-Ankra-CSRF double-submit header only (no bearer twin).
      operationId: fix_application_build
      parameters:
        - in: path
          name: application_id
          required: true
          schema:
            title: Application Id
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FixApplicationBuildRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FixApplicationBuildResponse'
          description: Successful Response
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DemoDetailError'
          description: >-
            Validation failure ("A 'branch' is required." or a build-check error
            such as an unknown branch)
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DemoDetailError'
          description: >-
            "You do not have permission to fix application builds." (or a CSRF
            failure)
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DemoDetailError'
          description: Not found ("Application not found")
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
        '502':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DemoDetailError'
          description: The AI agent is unavailable or the dispatch failed
components:
  schemas:
    FixApplicationBuildRequest:
      properties:
        branch:
          description: >-
            The branch whose demo build is missing; required (an empty branch is
            a 400).
          type: string
      required:
        - branch
      type: object
    FixApplicationBuildResponse:
      description: >-
        The fix-build answer: the deterministic actions taken, whether the build
        is already resolved or building, and the dispatched mission agent when
        one was needed.
      properties:
        actions_taken:
          items:
            type: string
          type: array
        agent_task:
          anyOf:
            - $ref: '#/components/schemas/FixBuildAgentTask'
            - type: 'null'
        building:
          type: boolean
        resolved:
          type: boolean
        summary:
          type: string
      required:
        - actions_taken
        - resolved
        - building
        - agent_task
        - summary
      type: object
    DemoDetailError:
      description: >-
        The FastAPI-style detail envelope the demo routes use for
        400/403/404/409/502 responses.
      properties:
        detail:
          type: string
      required:
        - detail
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    FixBuildAgentTask:
      description: >-
        Points the caller at the dispatched mission agent task; the run and
        transcript appear on the agent detail page once the scheduler picks the
        task up.
      properties:
        id:
          type: string
        url:
          type: string
      required:
        - id
        - url
      type: object
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object

````