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

# Get preview URL

> <Info>This API is in beta. Endpoints, fields, and behavior may still change, so avoid depending on it in production.</Info>

Returns a URL that serves the app as it currently stands in the app editor, including changes that haven't been published yet. Use it to look at your work in progress. Use [Deploy an app](/api-reference/deploy-an-app) to put it in front of your users.

The preview is served by a sandbox that shuts down when it goes unused. If none is running, this starts one, so the first call after a quiet period takes noticeably longer than later ones. The `sandbox_info.cold_start` field tells you which happened.

A `409` usually means the app's code doesn't currently build. The response body says what failed, so send that to the AI with [Send chat message](/api-reference/send-chat-message) and ask for the preview again.

Set `branch_id` to preview a [branch](/developers/references/app-management/get-started/concepts#branches) instead of main. Each branch has its own sandbox, so the first call for a branch is a cold start too. A merged branch has no preview, and asking for one returns a 409. On an app imported from GitHub, a merged branch can still return a preview, so don't rely on it there.



## OpenAPI

````yaml /developers/references/app-management/app-management-openapi.json get /api/apps/{app_id}/sandbox/preview-url
openapi: 3.1.0
info:
  title: Base44 App Management API
  version: 1.0.0
servers:
  - url: https://app.base44.com
security:
  - PersonalAccessTokenAuth: []
paths:
  /api/apps/{app_id}/sandbox/preview-url:
    get:
      summary: Get preview URL
      description: >-
        <Info>This API is in beta. Endpoints, fields, and behavior may still
        change, so avoid depending on it in production.</Info>


        Returns a URL that serves the app as it currently stands in the app
        editor, including changes that haven't been published yet. Use it to
        look at your work in progress. Use [Deploy an
        app](/api-reference/deploy-an-app) to put it in front of your users.


        The preview is served by a sandbox that shuts down when it goes unused.
        If none is running, this starts one, so the first call after a quiet
        period takes noticeably longer than later ones. The
        `sandbox_info.cold_start` field tells you which happened.


        A `409` usually means the app's code doesn't currently build. The
        response body says what failed, so send that to the AI with [Send chat
        message](/api-reference/send-chat-message) and ask for the preview
        again.


        Set `branch_id` to preview a
        [branch](/developers/references/app-management/get-started/concepts#branches)
        instead of main. Each branch has its own sandbox, so the first call for
        a branch is a cold start too. A merged branch has no preview, and asking
        for one returns a 409. On an app imported from GitHub, a merged branch
        can still return a preview, so don't rely on it there.
      operationId: get_preview_url_api_apps__app_id__sandbox_preview_url_get
      parameters:
        - name: app_id
          in: path
          required: true
          schema:
            type: string
            title: App Id
        - name: branch_id
          in: query
          required: false
          schema:
            type: string
            description: >-
              ID of the branch to work on, as returned by [List
              branches](/api-reference/list-branches). Omit it to work on the
              app's main branch.
            title: Branch Id
          description: >-
            ID of the branch to work on, as returned by [List
            branches](/api-reference/list-branches). Omit it to work on the
            app's main branch.
          example: 68f1a2b3c4d5e6f708192a3b
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PreviewUrlResponse'
        '401':
          description: Missing or invalid credentials.
        '403':
          description: You don't have access to this app.
        '404':
          description: App not found, or no branch you can see has this `branch_id`.
        '409':
          description: >-
            The app's development server couldn't start, usually because its
            code doesn't build, or the branch in `branch_id` was merged
            (`extra_data.reason` is `branch_not_active`).
        '503':
          description: >-
            The sandbox is temporarily unavailable. The app's sandbox lock timed
            out, the sandbox went away mid-request, or the development server
            did not start for a reason that is not the app's code. The `detail`
            is `Preview dev server failed to start, please retry` for the
            development server and `Sandbox temporarily unavailable, please
            retry` otherwise. Retry after the number of seconds in the
            `Retry-After` header.
          headers:
            Retry-After:
              description: Seconds to wait before retrying.
              schema:
                type: integer
                example: 5
          content:
            application/json:
              example:
                error_type: HTTPException
                message: Sandbox temporarily unavailable, please retry
                detail: Sandbox temporarily unavailable, please retry
                traceback: ''
                request_id: 0f9c2a1e-6b3d-4c8e-9a7f-1d2e3f4a5b6c
      security:
        - PersonalAccessTokenAuth:
            - read_only
        - WorkspaceApiKeyAuth:
            - read_only
        - WorkspaceApiKeyBearerAuth:
            - read_only
components:
  schemas:
    PreviewUrlResponse:
      properties:
        preview_url:
          type: string
          title: Preview Url
          description: >-
            Where the app is served as it currently stands in the app editor,
            including changes that haven't been published. Usually a host with
            no scheme, so add `https://` before you open it in a browser or an
            iframe. For some imported apps it's already a full URL with its own
            query parameters, so add the scheme only when it's missing and keep
            the query.
          example: preview-6820f3a4e7b91d003c45a1f2.base44.app
        preview_token:
          anyOf:
            - type: string
            - type: 'null'
          title: Preview Token
          description: >-
            Single-use token that signs one browser into the preview. Add it to
            the preview URL's query as `_preview_token`, with the leading
            underscore (a `preview_token` parameter is ignored), and open the
            URL within 5 minutes. The first load exchanges it for a session in
            that browser, so a new browser, headless session or reload after the
            session is gone needs a new token: call this endpoint again each
            time instead of reusing a URL. Treat it as a credential and don't
            share it, because anyone holding it can load the app before it is
            published.
          example: FH-j7wHS7IR_fC1tUh4wCd_fNV1XGC479cuqNSYi9mA
        sandbox_info:
          $ref: '#/components/schemas/SandboxInfo'
          description: >-
            Details of the sandbox serving this preview, including whether it
            had to be started for this request.
        bridge_injected:
          type: boolean
          title: Bridge Injected
          description: >-
            Whether the preview host injects the builder bridge. False when the
            platform proxy is disabled and the preview falls back to the
            sandbox's own host, so the editor knows the bridge's mount/paint
            signals will never arrive and must not wait for them.
          default: true
      type: object
      required:
        - preview_url
        - sandbox_info
      title: PreviewUrlResponse
      description: A preview URL for an app, and the sandbox serving it.
    SandboxInfo:
      properties:
        cold_start:
          type: boolean
          title: Cold Start
          description: >-
            Whether a new sandbox was started for this request. A value of
            `false` means an already running one was reused, which is why a
            repeat call is much faster.
          example: false
        restored_from_snapshot:
          type: boolean
          title: Restored From Snapshot
          description: >-
            Whether the new sandbox was restored from a snapshot rather than
            built from scratch. Always `false` when `cold_start` is `false`.
          example: false
        timeout_timestamp:
          anyOf:
            - type: string
            - type: 'null'
          title: Timeout Timestamp
          description: >-
            When the sandbox shuts down if nothing touches it, as an ISO 8601
            timestamp, or `null` when the sandbox already existed, because
            reusing it does not change its timeout.
          example: '2026-08-02T15:30:00'
      type: object
      required:
        - cold_start
        - restored_from_snapshot
      title: SandboxInfo
      description: Metadata about the sandbox serving this preview URL.
  securitySchemes:
    PersonalAccessTokenAuth:
      type: http
      scheme: bearer
      description: >-
        Personal access token, sent as `Authorization: Bearer <token>`. Each
        operation lists the permission it needs: `read_only` or `full_access`. A
        full-access token can call every operation. A read-only token can call
        only the operations that list `read_only`; anything else returns 403
        `read_only_credential_route_not_allowed`.
    WorkspaceApiKeyAuth:
      type: apiKey
      in: header
      name: api_key
      description: >-
        Workspace API key, sent as `api_key: <key>`. Each operation that accepts
        one lists what the key needs: a permission, `read_only` or
        `full_access`, like a personal access token, or a scope. A key without
        the scope gets 403 `workspace_api_key_scope_required`.
    WorkspaceApiKeyBearerAuth:
      type: http
      scheme: bearer
      description: >-
        Workspace API key, sent as `Authorization: Bearer <key>`. Accepted
        wherever `api_key` is, with the same permission.

````

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