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

# Deploy Application Demo

> Deploy a throwaway demo of the application onto the organisation's staging cluster. Provide exactly one of branch or a positive pr_number; PR demos additionally require an explicit image_tag. Launch env entries are merged over the application's saved demo defaults (overrides win by name) and database overrides the saved throwaway-database default (null keeps it). A browser session twin is mounted at the same path without the /api/v1 prefix (cookie authentication plus the X-Ankra-CSRF double-submit header).



## OpenAPI

````yaml https://platform.ankra.app/openapi.json post /api/v1/org/applications/{application_id}/demos
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: https://platform.ankra.app
security: []
paths:
  /api/v1/org/applications/{application_id}/demos:
    post:
      tags:
        - Applications API
      summary: Deploy Application Demo
      description: >-
        Deploy a throwaway demo of the application onto the organisation's
        staging cluster. Provide exactly one of branch or a positive pr_number;
        PR demos additionally require an explicit image_tag. Launch env entries
        are merged over the application's saved demo defaults (overrides win by
        name) and database overrides the saved throwaway-database default (null
        keeps it). A browser session twin is mounted at the same path without
        the /api/v1 prefix (cookie authentication plus the X-Ankra-CSRF
        double-submit header).
      operationId: >-
        deploy_application_demo_api_v1_org_applications__application_id__demos_post
      parameters:
        - in: path
          name: application_id
          required: true
          schema:
            title: Application Id
            type: string
        - in: header
          name: authorization
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Authorization
        - in: header
          name: x-ankra-organisation-id
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Ankra-Organisation-Id
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeployApplicationDemoRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeployApplicationDemoResponse'
          description: Successful Response
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DemoDetailError'
          description: >-
            Validation failure: "Provide exactly one of 'branch' or a positive
            'pr_number'.", "An 'image_tag' is required to deploy a PR demo.",
            ttl_hours out of the caller's policy bounds, no staging cluster
            configured or its agent offline, a secret slot the organisation does
            not own, or a broken stack-profile binding
        '401':
          description: Unauthorized
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DemoDetailError'
          description: '"You do not have permission to deploy application demos."'
        '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 deploy itself failed downstream on the staging cluster
components:
  schemas:
    DeployApplicationDemoRequest:
      description: >-
        The deploy-demo body. Provide exactly one of branch or a positive
        pr_number; PR demos additionally require an explicit image_tag.
      properties:
        branch:
          anyOf:
            - type: string
            - type: 'null'
        container_port:
          anyOf:
            - type: integer
            - type: 'null'
          description: Null resolves the application's default demo container port.
        database:
          anyOf:
            - type: boolean
            - type: 'null'
          description: >-
            Overrides the application's saved throwaway-database default; null
            keeps it.
        env:
          description: >-
            Per-launch env overrides, merged over the application's saved demo
            defaults (overrides win by name). Secret values ride as
            ${SECRET_SLOT:<uuid>} sentinels.
          items:
            $ref: '#/components/schemas/DemoEnvironmentEntry'
          type: array
        image_tag:
          anyOf:
            - type: string
            - type: 'null'
          description: Null resolves the branch's built image via the build check.
        pr_number:
          anyOf:
            - type: integer
            - type: 'null'
        ttl_hours:
          anyOf:
            - type: integer
            - type: 'null'
          description: >-
            At least 1 and at most the caller's role-capped maximum; null
            applies the policy default.
        components:
          type: array
          nullable: true
          items:
            $ref: '#/components/schemas/DeployDemoComponentInput'
          description: >-
            Subset of a monorepo's components to deploy with optional
            per-component overrides; omitted deploys every recorded component.
        entry_component:
          type: string
          nullable: true
          description: >-
            Names the component that owns the demo host's root path; omitted
            applies the entry heuristic.
      type: object
    DeployApplicationDemoResponse:
      properties:
        branch:
          anyOf:
            - type: string
            - type: 'null'
        image:
          type: string
        namespace:
          type: string
        pr_number:
          anyOf:
            - type: integer
            - type: 'null'
        preview_url:
          type: string
        service_dns:
          type: string
        status:
          type: string
        ttl_hours:
          type: integer
        workspace_id:
          type: string
        components:
          type: array
          nullable: true
          items:
            $ref: '#/components/schemas/DeployedDemoComponent'
      required:
        - workspace_id
        - namespace
        - image
        - service_dns
        - ttl_hours
        - branch
        - pr_number
        - status
      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
    DemoEnvironmentEntry:
      description: >-
        One demo environment entry. Secret values ride as ${SECRET_SLOT:<uuid>}
        sentinels - the persisted form, safe to echo; resolved secrets never
        ride this surface.
      properties:
        name:
          type: string
        secret:
          type: boolean
        value:
          type: string
      required:
        - name
        - value
        - secret
      type: object
    DeployDemoComponentInput:
      type: object
      description: >-
        Selects one component of a multi-component launch with optional
        per-component overrides.
      properties:
        name:
          type: string
        image_tag:
          type: string
          nullable: true
        container_port:
          type: integer
          nullable: true
        ingress_path:
          type: string
          nullable: true
      required:
        - name
    DeployedDemoComponent:
      type: object
      description: One component of a successful demo deploy answer.
      properties:
        name:
          type: string
        image:
          type: string
        image_tag:
          type: string
        container_port:
          type: integer
        ingress_path:
          type: string
        entry:
          type: boolean
      required:
        - name
        - image
        - image_tag
        - container_port
        - entry
    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

````