deploy.hosting.create-bundle

Start a deployment of a pooled app from a build: returns an upload URL for the bundle

POST /deploy/api/apps/{id}/bundlesIAM deploy:DeployAppChanges stateDestructive

The bundle is a tar.gz of .next/standalone, .next/static, .next/server, .next/ews-outputs.json and public/ (the starter template workflow makes it). PUT it to uploadUrl within an hour, then call complete-bundle. A commit on the app branch (default main) becomes production; any other branch a preview at its own URL.

Request syntax

POST /deploy/api/apps/{id}/bundles
{
  "commitSha": "string",
  "branch": "string",
  "sha256": "string",
  "sizeBytes": "number"
}

Path parameters

  • idRequired

    string

    Constraints: uuid

Request body

  • commitShaRequired

    string

    The commit the bundle was built from; also names its preview URL

    Constraints: 4-64 chars, /^[0-9A-Za-z._-]+$/

  • branchOptional

    string

    The branch the commit was pushed to: the app’s branch (default main) makes it production, any other a preview; omitted or null counts as production

    Constraints: 1-255 chars

    May be null.

  • sha256Required

    string

    SHA-256 of the tar.gz, in hex; checked again after download

    Constraints: /^[0-9a-f]{64}$/

  • sizeBytesRequired

    number

    Exact size of the tar.gz in bytes; completing fails if the upload differs

    Constraints: integer, 1-1073741824

Response

201 with `data`: deploymentId, preview (whether it becomes a preview rather than production), uploadUrl (a presigned PUT URL for the tar.gz) and expiresInSeconds (3600).

A JSON response is wrapped as { "success": true, "data": … }; the CLI prints the whole body with --json.

Fields of data

  • deploymentIdAlways

    string

    The deployment started for the bundle
  • previewAlways

    boolean

    Whether it becomes a preview rather than production
  • uploadUrlAlways

    string

    Presigned URL to PUT the tar.gz to
  • expiresInSecondsAlways

    number

    Seconds the upload URL is valid (3600)

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:DeployApp 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 hosting create-bundle id --commit-sha example --sha256 example --size-bytes 1

Generated from the API description, the same one the API checks requests against and the CLI is built from. MCP tool: dcloud_deploy_hosting_create-bundle.