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

# Deploy an App

> Queue a build+deploy for an App, creating a new version.

**Full deploy workflow:**
1. `POST /{app_id}/deploy/upload-url` → get a presigned S3 PUT URL
2. Upload your built dist/ zip to that URL
3. Call this endpoint with the returned `bundle_s3_key`
4. Optionally include `source_files` (path→content map) for version diffing
5. Poll `GET /{app_id}/deploys/{deploy_id}` until status is `complete`

**Edit-and-redeploy workflow:**
1. `GET /{app_id}/versions/{version}/download` → download the bundle zip
2. Edit files locally
3. Re-zip and upload via upload-url → deploy (creates a new version)
4. `GET /{app_id}/versions/{old}/diff/{new}` to review changes

Each deploy creates an immutable version record. Use `POST /{app_id}/versions/{n}/restore`
for instant rollback to any previous version.



## OpenAPI

````yaml post /v1/apps/{app_id}/deploy
openapi: 3.1.0
info:
  title: Mixpeek API
  description: >-
    This is the Mixpeek API, providing access to various endpoints for data
    processing and retrieval.
  termsOfService: https://mixpeek.com/terms
  contact:
    name: Mixpeek Support
    url: https://mixpeek.com/contact
    email: info@mixpeek.com
  version: '0.82'
servers:
  - url: https://api.mixpeek.com
    description: Production
security: []
paths:
  /v1/apps/{app_id}/deploy:
    post:
      tags:
        - Apps
      summary: Deploy an App
      description: >-
        Queue a build+deploy for an App, creating a new version.


        **Full deploy workflow:**

        1. `POST /{app_id}/deploy/upload-url` → get a presigned S3 PUT URL

        2. Upload your built dist/ zip to that URL

        3. Call this endpoint with the returned `bundle_s3_key`

        4. Optionally include `source_files` (path→content map) for version
        diffing

        5. Poll `GET /{app_id}/deploys/{deploy_id}` until status is `complete`


        **Edit-and-redeploy workflow:**

        1. `GET /{app_id}/versions/{version}/download` → download the bundle zip

        2. Edit files locally

        3. Re-zip and upload via upload-url → deploy (creates a new version)

        4. `GET /{app_id}/versions/{old}/diff/{new}` to review changes


        Each deploy creates an immutable version record. Use `POST
        /{app_id}/versions/{n}/restore`

        for instant rollback to any previous version.
      operationId: deploy_app_v1_apps__app_id__deploy_post
      parameters:
        - name: app_id
          in: path
          required: true
          schema:
            type: string
            title: App Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeployRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeployResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    DeployRequest:
      properties:
        environment:
          type: string
          enum:
            - staging
            - production
          title: Environment
          description: Target environment for this deploy
          default: production
        message:
          type: string
          title: Message
          description: >-
            Deploy message describing what changed (required, like a git commit
            message)
        source:
          type: string
          enum:
            - cli_upload
            - git
          title: Source
          description: >-
            Deploy source. 'cli_upload' = zip already uploaded to S3. 'git' =
            Phase 3b.
          default: cli_upload
        bundle_s3_key:
          anyOf:
            - type: string
            - type: 'null'
          title: Bundle S3 Key
          description: S3 key of the uploaded source zip (required for source='cli_upload')
        source_files:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Source Files
          description: Map of relative path → file content for source-level version diffs
        git_commit_sha:
          anyOf:
            - type: string
            - type: 'null'
          title: Git Commit Sha
          description: Git commit SHA associated with this deploy
        git_commit_message:
          anyOf:
            - type: string
            - type: 'null'
          title: Git Commit Message
          description: Git commit message associated with this deploy
        git_author:
          anyOf:
            - type: string
            - type: 'null'
          title: Git Author
          description: Git commit author (name <email>)
      type: object
      required:
        - message
      title: DeployRequest
      description: Deploy a pre-built bundle (CLI path) or trigger a Git-based build.
    DeployResponse:
      properties:
        app_id:
          type: string
          title: App Id
        deploy_id:
          type: string
          title: Deploy Id
        status:
          type: string
          enum:
            - queued
            - building
            - complete
            - failed
          title: Status
        environment:
          type: string
          title: Environment
        message:
          anyOf:
            - type: string
            - type: 'null'
          title: Message
      type: object
      required:
        - app_id
        - deploy_id
        - status
        - environment
      title: DeployResponse
    ErrorResponse:
      properties:
        success:
          type: boolean
          title: Success
          description: Always false for error responses
          default: false
        status:
          type: integer
          title: Status
          description: HTTP status code for this error
        error:
          $ref: '#/components/schemas/ErrorDetail'
          description: Error details payload
      type: object
      required:
        - status
        - error
      title: ErrorResponse
      description: Error response model.
      examples:
        - error:
            details:
              id: ns_123
              resource: namespace
            message: Namespace not found
            type: NotFoundError
          status: 404
          success: false
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ErrorDetail:
      properties:
        message:
          type: string
          title: Message
          description: Human-readable error message
        type:
          type: string
          title: Type
          description: Stable error type identifier (machine-readable)
        code:
          anyOf:
            - type: string
            - type: 'null'
          title: Code
          description: >-
            Fine-grained error code for programmatic handling (e.g.,
            namespace_name_taken, feature_extractor_not_found). Present only
            when consumers may need to branch on a specific error condition.
        details:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Details
          description: >-
            Optional structured details to help debugging (validation errors,
            IDs, etc.)
      type: object
      required:
        - message
        - type
      title: ErrorDetail
      description: Error detail model.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````