Overview
Preview deployments allow you to automatically deploy your application for each pull request or branch, making it easy to test changes before merging to production. Each preview deployment has its own isolated environment and URL.Endpoints
List Preview Deployments
Retrieve all preview deployments for a specific application.Query Parameters
The unique identifier of the application to retrieve preview deployments for.
Response
Returns an array of preview deployment objects.Unique identifier for the preview deployment.
Parent application ID.
Git branch name for this preview deployment.
Pull request number (if applicable).
Preview deployment URL.
Current status:
building, running, error, or stopped.ISO 8601 timestamp of creation.
Get Preview Deployment
Retrieve details of a specific preview deployment.Query Parameters
The unique identifier of the preview deployment to retrieve.
Response
Returns the preview deployment object with full details including application information.Preview deployment identifier.
Associated application object including environment and project details.
Git branch name.
Pull request number.
Preview deployment domain.
Associated domain ID.
Current deployment status.
Redeploy Preview
Trigger a rebuild of an existing preview deployment.Request Body
The ID of the preview deployment to rebuild.
Optional title for the deployment log. Defaults to “Rebuild Preview Deployment”.
Optional description for the deployment.
Response
Returnstrue if the redeploy was successfully queued.
The redeploy operation is queued and runs asynchronously. Check the deployment status using the deployments API to monitor progress.
Delete Preview Deployment
Permanently delete a preview deployment and stop its running containers.Request Body
The ID of the preview deployment to delete.
Response
Returnstrue if the preview deployment was successfully deleted.
Preview Deployment Configuration
Preview deployments inherit configuration from their parent application but can have specific overrides:Environment Variables
Applications can have separatepreviewEnv environment variables that are used only for preview deployments.
Build Configuration
Preview deployments support custom build arguments and secrets:previewBuildArgs- Build arguments specific to preview environmentspreviewBuildSecrets- Build secrets for preview deployments
Domain Configuration
Preview deployments automatically generate unique domains based on:previewWildcard- Domain pattern for preview deployments (e.g.,*.preview.example.com)previewPort- Port to expose the preview deployment onpreviewPath- Optional path prefix for the preview deploymentpreviewHttps- Enable HTTPS for preview deploymentspreviewCertificateType- Certificate type:letsencrypt,none, orcustom
Access Control
GitHub Labels
Automatic Preview Deployment
When configured on an application, Dokploy automatically:- Creates a preview deployment when a pull request is opened
- Updates the preview when new commits are pushed
- Adds a comment to the pull request with the preview URL
- Cleans up the preview deployment when the pull request is closed or merged
Preview deployments require the application to be connected to a Git provider (GitHub, GitLab, Bitbucket, or Gitea) with webhook support.