---
title: "POST /api/v1/hosting/apps/{app_id}/previews"
method: POST
path: "/api/v1/hosting/apps/{app_id}/previews"
tags: ["hosting"]
---

# POST /api/v1/hosting/apps/{app_id}/previews

`POST /api/v1/hosting/apps/{app_id}/previews`

## Request

- Base URL: `https://composal.com` (the document declares no server; this is the origin it was published from)
- URL: `https://composal.com/api/v1/hosting/apps/{app_id}/previews`
- Auth: HTTP bearer

## Path parameters

- `app_id` string, required

## Request body

- object
  - `name` string, required
  - `slug` string, required
  - `app_preview_profile_id` string, required
  - `source_ref` string
  - `change_number` string: Organization Change number, optionally prefixed with #; mutually exclusive with source_ref. Home reviews resolve the app's physical component.
  - `expected_patchset` integer: Optional public Change patchset fence; stale selections return 409.

## Response `201`

Created preview

- object
  - `preview` PreviewEnvironmentRecord, required
    - `id` string, required
    - `hosted_app_id` string, required
    - `app_environment_id` string, required
    - `app_preview_profile_id` string, required
    - `vcs_change_id` string, nullable
    - `created_by_user_id` union
      - string
      - integer
    - `source_revision` string, required
    - `snapshot_version` integer, required
    - `generation` integer, required
    - `access` 'org_members' | 'public', required
    - `retained` boolean, required
    - `expires_at` string, required
    - `created_at` string
    - `updated_at` string
    - `status` string, required
    - `name` string, required
    - `slug` string, required
    - `profile_name` string, required
    - `resource_overrides` PreviewResourceOverrides: Service public IDs mapped to resource overrides. Omitted fields inherit; an empty map removes all local overrides. Null reservations select platform defaults.
    - `urls` object[], required
      - `hostname` string, required
      - `dns_status` string, required
      - `tls_status` string, required

## Other responses

- `401`: Authentication required
- `403`: Organization administrator required
- `404`: App or source not found
- `409`: Source cannot be captured
- `422`: Invalid preview configuration
- `502`: Hosting dependency unavailable

---

[API](https://skmtc.dev/composal/apis/vex-api.md) - [All operations](https://skmtc.dev/composal/apis/vex-api/llms.txt) - [OpenAPI document](https://skmtc.dev/composal/apis/vex-api/revisions/74298a24e040?raw)
