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

# Create Preview

> Create or refresh isolated preview infrastructure for a branch.



## OpenAPI

````yaml https://api.getfloo.com/openapi.json post /v1/apps/{app_id}/previews
openapi: 3.1.0
info:
  title: floo API
  version: 0.1.0
servers:
  - url: https://api.getfloo.com
security: []
paths:
  /v1/apps/{app_id}/previews:
    post:
      tags:
        - previews
      summary: Create Preview
      description: Create or refresh isolated preview infrastructure for a branch.
      operationId: previews_create_preview
      parameters:
        - name: app_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: App Id
        - $ref: '#/components/parameters/X-Floo-Org-Id'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePreviewRequest'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PreviewResponse'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearerAuth: []
components:
  parameters:
    X-Floo-Org-Id:
      name: X-Floo-Org-Id
      in: header
      required: false
      schema:
        type: string
        format: uuid
      description: Organization to act in; defaults to the one joined most recently.
  schemas:
    CreatePreviewRequest:
      properties:
        branch:
          type: string
          minLength: 1
          title: Branch
        commit_sha:
          anyOf:
            - type: string
            - type: 'null'
          title: Commit Sha
        ref:
          anyOf:
            - type: string
            - type: 'null'
          title: Ref
        runtime:
          anyOf:
            - type: string
            - type: 'null'
          title: Runtime
        framework:
          anyOf:
            - type: string
            - type: 'null'
          title: Framework
        data:
          $ref: '#/components/schemas/PreviewDataRequest'
      type: object
      required:
        - branch
      title: CreatePreviewRequest
      description: Create or redeploy a preview environment.
    PreviewResponse:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        app_id:
          type: string
          format: uuid
          title: App Id
        slug:
          type: string
          title: Slug
        source_branch:
          anyOf:
            - type: string
            - type: 'null'
          title: Source Branch
        pr_number:
          anyOf:
            - type: integer
            - type: 'null'
          title: Pr Number
        url:
          anyOf:
            - type: string
            - type: 'null'
          title: Url
        latest_deploy_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Latest Deploy Id
        latest_deploy_status:
          anyOf:
            - type: string
            - type: 'null'
          title: Latest Deploy Status
        latest_commit_sha:
          anyOf:
            - type: string
            - type: 'null'
          title: Latest Commit Sha
        latest_cloud_run_service_names:
          items:
            type: string
          type: array
          title: Latest Cloud Run Service Names
        ttl_hours:
          anyOf:
            - type: integer
            - type: 'null'
          title: Ttl Hours
        expires_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Expires At
        resources:
          items:
            $ref: '#/components/schemas/PreviewResourceResponse'
          type: array
          title: Resources
        database_branches:
          items:
            $ref: '#/components/schemas/PreviewDatabaseBranchResponse'
          type: array
          title: Database Branches
        managed_resource_branches:
          items:
            $ref: '#/components/schemas/PreviewManagedResourceBranchResponse'
          type: array
          title: Managed Resource Branches
      type: object
      required:
        - id
        - app_id
        - slug
        - source_branch
      title: PreviewResponse
      description: Preview environment detail.
    ErrorResponse:
      properties:
        detail:
          $ref: '#/components/schemas/ErrorDetail'
      type: object
      required:
        - detail
      title: ErrorResponse
      description: Body of every error response except request validation (422).
    PreviewDataRequest:
      properties:
        mode:
          $ref: '#/components/schemas/PreviewHydrationMode'
          default: empty
        seed_command:
          anyOf:
            - type: string
            - type: 'null'
          title: Seed Command
        sanitize_command:
          anyOf:
            - type: string
            - type: 'null'
          title: Sanitize Command
      type: object
      title: PreviewDataRequest
      description: Data hydration settings for an explicitly-created preview.
    PreviewResourceResponse:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        type:
          type: string
          title: Type
        name:
          type: string
          title: Name
        status:
          type: string
          title: Status
        external_resource_id:
          anyOf:
            - type: string
            - type: 'null'
          title: External Resource Id
        expires_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Expires At
      type: object
      required:
        - id
        - type
        - name
        - status
      title: PreviewResourceResponse
      description: A managed resource backing one preview environment.
    PreviewDatabaseBranchResponse:
      properties:
        id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Id
        managed_service_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Managed Service Id
        name:
          type: string
          title: Name
        source_env:
          type: string
          title: Source Env
        preview_slug:
          type: string
          title: Preview Slug
        resource_status:
          type: string
          title: Resource Status
        hydration_mode:
          type: string
          title: Hydration Mode
        schema_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Schema Name
        role_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Role Name
        base_schema_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Base Schema Name
        base_role_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Base Role Name
        created_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Created At
        updated_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Updated At
        expires_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Expires At
        reset_eligible:
          type: boolean
          title: Reset Eligible
        reset_blocked_reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Reset Blocked Reason
      type: object
      required:
        - name
        - source_env
        - preview_slug
        - resource_status
        - hydration_mode
        - reset_eligible
      title: PreviewDatabaseBranchResponse
      description: A managed Postgres branch backing one preview environment.
    PreviewManagedResourceBranchResponse:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        managed_service_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Managed Service Id
        resource_type:
          type: string
          title: Resource Type
        name:
          type: string
          title: Name
        resource_key:
          type: string
          title: Resource Key
        source_env:
          type: string
          title: Source Env
        preview_slug:
          type: string
          title: Preview Slug
        resource_status:
          type: string
          title: Resource Status
        hydration_mode:
          type: string
          title: Hydration Mode
        schema_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Schema Name
        role_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Role Name
        base_schema_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Base Schema Name
        base_role_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Base Role Name
        database_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Database Id
        bucket_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Bucket Name
        created_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Created At
        updated_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Updated At
        expires_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Expires At
        reset_eligible:
          type: boolean
          title: Reset Eligible
        reset_blocked_reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Reset Blocked Reason
        dev_prod_untouched:
          type: boolean
          title: Dev Prod Untouched
          default: true
      type: object
      required:
        - id
        - resource_type
        - name
        - resource_key
        - source_env
        - preview_slug
        - resource_status
        - hydration_mode
        - reset_eligible
      title: PreviewManagedResourceBranchResponse
      description: A preview-owned managed resource branch.
    ErrorDetail:
      properties:
        code:
          type: string
          title: Code
        message:
          type: string
          title: Message
      additionalProperties: true
      type: object
      required:
        - code
        - message
      title: ErrorDetail
      description: Standard error envelope with operation-specific JSON context.
    PreviewHydrationMode:
      type: string
      enum:
        - empty
        - seed
        - clone-dev
        - clone-prod-sanitized
      title: PreviewHydrationMode
      description: Wire-safe data hydration mode.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: A `floo_` API key.

````

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