deploy.previews.configureSet up, change or turn off an app's preview environments
A preview is an app of its own on one small machine, at https://<branch>.<app>.<org>.apps.<root>. With trigger pull_request, a pull request into the app’s branch gets one when it opens and loses it when it merges or closes; with branch, every pushed branch other than the app’s gets one and loses it when the branch is deleted. A push to the branch redeploys it. It is deleted idleDays after the last push unless kept. Its env: the app’s plain variables, the secrets named in sharedSecretKeys, then envOverrides. With databaseBranch, a Postgres branch of the app’s bound database (pr-<n> for a pull request); without it, no database. Each step is the commit status `ews/preview`; the pull request gets one comment with the URL and the cost when it first serves. Previews are made as the person who pushed or opened the pull request, who needs deploy:CreatePreview on the app; at most maxPreviews at once.
Request syntax
PUT /deploy/api/apps/{id}/previews
{
"enabled": "boolean",
"trigger": "enum",
"envOverrides": "map of string",
"sharedSecretKeys": "array of string",
"databaseBranch": "boolean",
"idleDays": "number",
"maxPreviews": "number",
"instanceType": "string"
}Path parameters
idRequiredstring
Constraints: uuid
Request body
enabledRequiredboolean
Whether pull requests (or branches) get preview environments
triggerOptionalenum
pull_request: a preview per open pull request into the app’s branch; branch: one per pushed branch
One of:
pull_request,branchDefault:
"pull_request"envOverridesOptionalmap of string
Plain variables set in every preview on top of the app’s (a key here wins)
Constraints: key=value
Default:
{}sharedSecretKeysOptionalarray of string
Secret-bound variables of the app that previews get too; every other secret is withheld (plain values are copied)
Constraints: max 128 chars, /^[A-Za-z_][A-Za-z0-9_]*$/
Default:
[]databaseBranchOptionalboolean
Give each preview a Postgres branch of the app’s bound database; off: previews get no database binding
Default:
falseidleDaysOptionalnumber
Delete a preview this many days after the last push to its branch, unless kept
Constraints: integer, 1-90
Default:
7maxPreviewsOptionalnumber
At most this many previews at once; the next one is refused with a commit status
Constraints: integer, 1-20
Default:
10instanceTypeOptionalstring
Machine type of a preview; null: the smallest the region offers
Constraints: 1-32 chars
Default:
nullMay be null.
Response
200 with `data` as list. 409 when enabled on a pooled app, an app without a repository, or a preview. Turned off, open previews are deleted within the hour.
A JSON response is wrapped as { "success": true, "data": … }; the CLI prints the whole body with --json.
Fields of data
settingsAlwaysobject, may be null
null: previews are not set upsettings.enabledAlwaysboolean
Whether pull requests (or branches) get preview environmentssettings.triggerWhen presentone of pull_request, branch
pull_request: a preview per open pull request into the app’s branch; branch: one per pushed branchsettings.envOverridesWhen presentmap
Plain variables set in every preview on top of the app’s (a key here wins)settings.sharedSecretKeysWhen presentarray of string
Secret-bound variables of the app that previews get too; every other secret is withheld (plain values are copied)settings.databaseBranchWhen presentboolean
Give each preview a Postgres branch of the app’s bound database; off: previews get no database bindingsettings.idleDaysWhen presentnumber
Delete a preview this many days after the last push to its branch, unless keptsettings.maxPreviewsWhen presentnumber
At most this many previews at once; the next one is refused with a commit statussettings.instanceTypeWhen presentstring, may be null
Machine type of a preview; null: the smallest the region offersrepositoryAlwaysobject, may be null
The repository the app builds from; previews need onerepository.idAlwaysstring
The repositoryrepository.nameAlwaysstring
Its namepreviewsAlwaysarray of object
Open previews, oldest firstpreviews[].idAlwaysstring
The preview’s own app idpreviews[].nameAlwaysstring
Its name: the app’s, with the pull request or branchpreviews[].branchAlwaysstring
The branch it deployspreviews[].prNumberAlwaysnumber, may be null
Its pull request; null for a branch previewpreviews[].urlAlwaysstring
Where it answerspreviews[].statusAlwaysstring
The app status: created, deploying, active, failed, deletingpreviews[].instanceTypeAlwaysstring
Its machine typepreviews[].eurPerHourAlwaysnumber, may be null
What its machine costs per hour, netpreviews[].costSoFarAlwaysnumber, may be null
Started hours since it was created × the hourly pricepreviews[].createdAtAlwaysstring
When it was createdpreviews[].lastPushAtAlwaysstring, may be null
The last push to its branchpreviews[].keepAlwaysboolean
Kept: never deleted for being idlepreviews[].idleDeleteAtAlwaysstring, may be null
When it is deleted if nobody pushes before; null when kept or previews are offpreviews[].lastDeploymentAlwaysobject, may be null
Its newest deploymentpreviews[].lastDeployment.idAlwaysstring
The deploymentpreviews[].lastDeployment.statusAlwaysstring
Its statuspreviews[].lastDeployment.commitAlwaysstring, may be null
The commit it deployspreviews[].databaseAlwaysstring, may be null
The database branch it is bound to, in words; null: nonetotalsAlwaysobject
What the open previews costtotals.eurPerHourAlwaysnumber
All open previews, per hourtotals.costSoFarAlwaysnumber
All open previews, since each was created
Checked against the handlers: every route test validates their answers against this schema.
Errors
- 400The request does not pass the schema above. The body is { "error": …, "issues": […] }, one issue per field.
- 401No credentials, or an access key that is unknown, revoked or expired.
- 403The caller's policies do not allow deploy:UpdatePreviewSettings on this resource. The body names the action and the resource, and the refusal is recorded in the audit log.
- 404The resource does not exist in your organization.
Examples
The required parameters only, with example values. Replace id and the other placeholders with your own.
dcloud deploy previews configure id --enabledcurl -X PUT "https://console.platform.deutschecloud.app/deploy/api/apps/id/previews" \
-H "Authorization: EWS-ACCESS-KEY $ACCESS_KEY" \
-H "Content-Type: application/json" \
-d '{"enabled":true}'import { DcloudClient } from '@dcloud/sdk';
const client = new DcloudClient();
const result = await client.deploy.previews.configure({ id: "id", enabled: true });from dcloud import Client
client = Client()
result = client.deploy.previews.configure(id="id", enabled=True)Generated from the API description, the same one the API checks requests against and the CLI is built from. MCP tool: dcloud_deploy_previews_configure.