---
title: "Deploy an existing build to a frontend"
method: POST
path: "/projects/{id}/frontends/{frontendId}/deployments"
tags: ["Frontends"]
---

# Deploy an existing build to a frontend

`POST /projects/{id}/frontends/{frontendId}/deployments`

## Request

- Base URL: `https://api.volcano.dev`
- URL: `https://api.volcano.dev/projects/{id}/frontends/{frontendId}/deployments`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer

Deploys the build of another frontend's deployment in the same project to this frontend, without
compiling it again. Use it to serve one build from several frontends, such as one per region or
brand. This frontend gets its own copy of the source archive and the build, so later changes to the
source frontend do not reach it, and a later redeploy of this frontend compiles that copied source.

The build-time variables this frontend would build with must equal those the source build read,
compared by name and value. Volcano records a keyed digest of each value, unique to the build, and
never stores the values. A mismatch returns `409` with `code: build_variables_differ` and the differing
names in `error`. The source deployment must be `active` or `degraded`, and both frontends must use
the same framework and app root.

Admission is the redeploy's: the deployment starts with `status: provisioning`, or, while another
deployment is in progress, is exposed through `pending_deployment_id` and supersedes any older
queued deployment. Nothing is compiled: the deployment's build minutes cover publishing the build
alone. The checks run again when a queued deployment starts. A refusal then fails the deployment
without a retry, its `error_message` starting with the refusal's code.

## Path parameters

- `id` string, uuid, required
- `frontendId` string, uuid, required

## Request body

- CreateFrontendDeploymentRequest: Deploys the build of an existing deployment instead of compiling the frontend's source.
  - `source_deployment_id` string, uuid, required: An `active` or `degraded` deployment of another frontend in the same project. Its build is copied to this frontend and published without compiling it again.

## Response `200`

Deployment started or queued

- Frontend
  - `variable_scope` 'all' | 'shared' | 'scoped': All preserves access to all project variables. Shared includes the project frontend shared-variable list. Scoped includes only explicitly declared variables in builds and runtime. Omission preserves the stored selection.
  - `declared_variables` string[]: Names selected when variable_scope is scoped. Missing declared values reject deployment. Omission preserves the stored list; an empty list clears it.
  - `id` string, uuid, required
  - `project_id` string, uuid, required
  - `name` string, required
  - `framework` 'nextjs', required
  - `app_root` string: Optional relative POSIX path from the uploaded archive root to the Next.js app that is deployed.
  - `status` 'provisioning' | 'active' | 'degraded' | 'failed' | 'deleting', required: Frontend lifecycle status. `degraded` means the regional runtime remains available but edge synchronization exhausted its immediate retries; Volcano retries edge recovery without rebuilding the frontend, and stops once a new deployment is queued or the retry budget runs out, leaving the frontend `degraded` until the next redeploy. A redeploy that fails over a serving frontend stays `active` on the previous deployment, so `failed` means no deployment is serving.
  - `provisioning_started_at` string, date-time: Timestamp when the current provisioning phase started
  - `deployed_regions` string[], required
  - `current_deployment_id` string, uuid: Identifier of the latest frontend deployment operation
  - `pending_deployment_id` string, uuid: Newest queued deployment that will run after the current operation
  - `site_url` string
  - `custom_domain` string: Active custom domain hostname when configured
  - `custom_domain_status` 'pending_verification' | 'provisioning' | 'active' | 'detaching' | 'failed' | 'deleted': Current custom domain lifecycle status
  - `function_routes` FrontendFunctionRoute[], required: Paths on this frontend that forward to a public function, ordered from most to least specific. Anyone who can load the frontend can reach the target function at these paths without a credential.
    - `id` string, uuid, required
    - `project_id` string, uuid, required
    - `frontend_id` string, uuid, required
    - `function_id` string, uuid, required
    - `path_prefix` string, required
    - `strip_prefix` boolean, required
    - `created_at` string, date-time, required
    - `updated_at` string, date-time, required
  - `frontend_routes` FrontendRoute[], required: Paths on this frontend served by another frontend in the project, ordered from most to least specific. Function and Frontend routes share one path namespace and the 64-route limit.
    - `id` string, uuid, required
    - `project_id` string, uuid, required
    - `frontend_id` string, uuid, required: The Frontend whose hostnames serve the route
    - `target_frontend_id` string, uuid, required: The mounted Frontend
    - `path_prefix` string, required
    - `created_at` string, date-time, required
    - `updated_at` string, date-time, required
  - `last_deployed_at` string, date-time: Recorded completion time of the most recent deploy or redeploy with status active. Omitted when no such deployment has a recorded completion time. Site traffic, pending deployments, degraded deployments, failed deployments, and deletion do not change this value.
  - `last_invoked_at` string, date-time
  - `created_at` string, date-time, required
  - `updated_at` string, date-time, required

## Other responses

- `400`: Bad request - invalid identifier or body, or `code: source_deployment_same_frontend` when the source deployment belongs to this frontend; redeploy the frontend instead.
- `401`: Unauthorized - invalid or missing token
- `403`: Forbidden - project ownership required
- `404`: Frontend not found, or `code: source_deployment_not_found` when the source deployment is not in this project.
- `409`: Conflict. `code: build_variables_differ` names the build-time variables whose values differ. `code: source_deployment_not_active` refuses a deployment that is not `active` or `degraded`. `code: source_build_unavailable` refuses a deployment made before Volcano kept builds, or whose build is no longer kept; redeploy the source frontend once and deploy from that deployment. `code: frontend_incompatible` refuses a different framework or app root. Without a code, the frontend's deletion is queued or running, or the project's source is managed by Git, where deploys come from a push to the production branch.
- `429`: Monthly build-minutes allowance exceeded
- `500`: Internal server error
- `501`: `code: build_reuse_unavailable` - this server cannot deploy an existing build. Local mode answers this; deploy the frontend from source instead.
- `503`: Service unavailable - frontend workflow configuration missing, or the build-minutes check is temporarily unavailable; retry later.

## Changes

- **2026-10-26** `4b0676e06128`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/kong/apis/volcano-api/changes/projects/:id/frontends/:frontendId/deployments/post.md)

---

[API](https://skmtc.dev/kong/apis/volcano-api.md) - [All operations](https://skmtc.dev/kong/apis/volcano-api/llms.txt) - [OpenAPI document](https://skmtc.dev/kong/apis/volcano-api/revisions/84c4488f91e9?raw)
