---
title: Create a Pages deployment
---

[Skip to content](#_top)

[API Reference](https://developers.cloudflare.com/api/typescript)

[Pages](https://developers.cloudflare.com/api/typescript/resources/pages)

[Projects](https://developers.cloudflare.com/api/typescript/resources/pages/subresources/projects)

[Deployments](https://developers.cloudflare.com/api/typescript/resources/pages/subresources/projects/subresources/deployments)

Copy Markdown

Open in **Claude**Open in **ChatGPT**Open in **Cursor**

---

**Copy Markdown****View as Markdown**

# Create a Pages deployment

client.pages.projects.deployments.create(stringprojectName, DeploymentCreateParams {account\_id, \_headers, \_redirects, 11 more } params, RequestOptionsoptions?): [Deployment](<https://developers.cloudflare.com/api/typescript/resources/pages#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)>) {id, aliases, build\_config, 15 more }

POST/accounts/{account\_id}/pages/projects/{project\_name}/deployments

Create a Cloudflare Pages deployment from a Git branch or Direct Upload manifest. Git repositories must already be authorized in Cloudflare Pages.

##### Security

<details>

<summary>API Token</summary>



The preferred authorization scheme for interacting with the Cloudflare API. <a href="https://developers.cloudflare.com/fundamentals/api/get-started/create-token/">Create a token</a>.

**Example:**<code>Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY</code>

</details>

<details>

<summary>API Email + API Key</summary>



The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

**Example:**<code>X-Auth-Email: user@example.com</code>

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

**Example:**<code>X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194</code>

</details>

##### Accepted Permissions (at least one required)

`Pages Write`

##### ParametersExpand Collapse

projectName: string

Name of the Pages project. Must begin with a lowercase letter or digit and contain only lowercase letters, digits, and hyphens.

[Link to this property](<#(resource)%20pages.projects.deployments%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20project_name%20%3E%20(schema)>)

<details>

<summary>

params: DeploymentCreateParams {account\_id, \_headers, \_redirects, 11 more }

</summary>

account\_id: string

Path param: Identifier.

maxLength32

<a href="#(resource)%20pages.projects.deployments%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20account_id">Link to this property</a>

\_headers?: <a href="https://developers.cloudflare.com/api/typescript/resources/pages/subresources/projects/subresources/deployments/methods/create#(resource)%20pages.projects.deployments%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20_headers%20%3E%20(schema)">Uploadable</a>

Body param: Headers configuration file for the deployment.

<a href="#(resource)%20pages.projects.deployments%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20_headers">Link to this property</a>

\_redirects?: <a href="https://developers.cloudflare.com/api/typescript/resources/pages/subresources/projects/subresources/deployments/methods/create#(resource)%20pages.projects.deployments%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20_redirects%20%3E%20(schema)">Uploadable</a>

Body param: Redirects configuration file for the deployment.

<a href="#(resource)%20pages.projects.deployments%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20_redirects">Link to this property</a>

\_routesJson?: <a href="https://developers.cloudflare.com/api/typescript/resources/pages/subresources/projects/subresources/deployments/methods/create#(resource)%20pages.projects.deployments%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20_routes.json%20%3E%20(schema)">Uploadable</a>

Body param: Routes configuration file defining routing rules.

<a href="#(resource)%20pages.projects.deployments%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20_routes.json">Link to this property</a>

\_workerBundle?: <a href="https://developers.cloudflare.com/api/typescript/resources/pages/subresources/projects/subresources/deployments/methods/create#(resource)%20pages.projects.deployments%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20_worker.bundle%20%3E%20(schema)">Uploadable</a>

Body param: Worker bundle file in multipart/form-data format. Mutually exclusive with <code>_worker.js</code>. Cannot specify both <code>_worker.js</code> and <code>_worker.bundle</code> in the same request. Maximum size: 25 MiB.

<a href="#(resource)%20pages.projects.deployments%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20_worker.bundle">Link to this property</a>

\_workerJS?: <a href="https://developers.cloudflare.com/api/typescript/resources/pages/subresources/projects/subresources/deployments/methods/create#(resource)%20pages.projects.deployments%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20_worker.js%20%3E%20(schema)">Uploadable</a>

Body param: Worker JavaScript file. Mutually exclusive with <code>_worker.bundle</code>. Cannot specify both <code>_worker.js</code> and <code>_worker.bundle</code> in the same request.

<a href="#(resource)%20pages.projects.deployments%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20_worker.js">Link to this property</a>

branch?: string

Body param: Git branch to deploy. Uses the branch’s <code>HEAD</code>; defaults to the project’s production branch.

<a href="#(resource)%20pages.projects.deployments%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20branch">Link to this property</a>

<details>

<summary>

commit\_dirty?: "true"| "false"

Body param: Whether the associated Git working tree has uncommitted changes. Provide <code>true</code> or <code>false</code>.

</summary>

One of the following:

"true"

<a href="#(resource)%20pages.projects.deployments%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20commit_dirty%20%3E%20(schema)%20%3E%20(member)%200">Link to this property</a>

"false"

<a href="#(resource)%20pages.projects.deployments%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20commit_dirty%20%3E%20(schema)%20%3E%20(member)%201">Link to this property</a>

</details>

<a href="#(resource)%20pages.projects.deployments%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20commit_dirty">Link to this property</a>

commit\_hash?: string

Body param: Git commit SHA associated with the deployment.

<a href="#(resource)%20pages.projects.deployments%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20commit_hash">Link to this property</a>

commit\_message?: string

Body param: Git commit message associated with the deployment.

<a href="#(resource)%20pages.projects.deployments%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20commit_message">Link to this property</a>

functionsFilepathRoutingConfigJson?: <a href="https://developers.cloudflare.com/api/typescript/resources/pages/subresources/projects/subresources/deployments/methods/create#(resource)%20pages.projects.deployments%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20functions-filepath-routing-config.json%20%3E%20(schema)">Uploadable</a>

Body param: Functions routing configuration file.

<a href="#(resource)%20pages.projects.deployments%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20functions-filepath-routing-config.json">Link to this property</a>

manifest?: string

Body param: JSON-encoded object mapping deployment file paths to their uploaded content hashes. Required for Direct Upload deployments. Maximum 20,000 entries.

<a href="#(resource)%20pages.projects.deployments%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20manifest">Link to this property</a>

pages\_build\_output\_dir?: string

Body param: The build output directory path.

<a href="#(resource)%20pages.projects.deployments%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20pages_build_output_dir">Link to this property</a>

wrangler\_config\_hash?: string

Body param: Hash of the Wrangler configuration file used for this deployment.

<a href="#(resource)%20pages.projects.deployments%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20wrangler_config_hash">Link to this property</a>

</details>

[Link to this property](<#(resource)%20pages.projects.deployments%20%3E%20(method)%20create%20%3E%20(params)%20default>)

##### ReturnsExpand Collapse

<details>

<summary>

Deployment {id, aliases, build\_config, 15 more }

</summary>

id: string

Id of the deployment.

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20id">Link to this property</a>

aliases: Array&lt;string&gt;| null

A list of alias URLs pointing to this deployment.

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20aliases">Link to this property</a>

<details>

<summary>

build\_config: BuildConfig {web\_analytics\_tag, web\_analytics\_token, build\_caching, 3 more }

Configs for the project build process.

</summary>

web\_analytics\_tag: string| null

The classifying tag for analytics.

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20build_config%20%3E%20(property)%20web_analytics_tag">Link to this property</a>

web\_analytics\_token: string| null

The auth token for analytics.

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20build_config%20%3E%20(property)%20web_analytics_token">Link to this property</a>

build\_caching?: boolean| null

Enable build caching for the project.

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20build_config%20%3E%20(property)%20build_caching">Link to this property</a>

build\_command?: string| null

Command used to build project.

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20build_config%20%3E%20(property)%20build_command">Link to this property</a>

destination\_dir?: string| null

Assets output directory of the build.

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20build_config%20%3E%20(property)%20destination_dir">Link to this property</a>

root\_dir?: string| null

Directory to run the command.

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20build_config%20%3E%20(property)%20root_dir">Link to this property</a>

</details>

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20build_config">Link to this property</a>

created\_on: string

When the deployment was created.

formatdate-time

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20created_on">Link to this property</a>

<details>

<summary>

deployment\_trigger: DeploymentTrigger {metadata, type }

Info about what caused the deployment.

</summary>

<details>

<summary>

metadata: Metadata {branch, commit\_dirty, commit\_hash, commit\_message }

Additional info about the trigger.

</summary>

branch: string

Where the trigger happened.

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20deployment_trigger%20%3E%20(property)%20metadata%20%3E%20(property)%20branch">Link to this property</a>

commit\_dirty: boolean

Whether the deployment trigger commit was dirty.

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20deployment_trigger%20%3E%20(property)%20metadata%20%3E%20(property)%20commit_dirty">Link to this property</a>

commit\_hash: string

Hash of the deployment trigger commit.

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20deployment_trigger%20%3E%20(property)%20metadata%20%3E%20(property)%20commit_hash">Link to this property</a>

commit\_message: string

Message of the deployment trigger commit.

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20deployment_trigger%20%3E%20(property)%20metadata%20%3E%20(property)%20commit_message">Link to this property</a>

</details>

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20deployment_trigger%20%3E%20(property)%20metadata">Link to this property</a>

<details>

<summary>

type: "github:push"| "ad\_hoc"| "deploy\_hook"

What caused the deployment.

</summary>

One of the following:

"github:push"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20deployment_trigger%20%3E%20(property)%20type%20%3E%20(member)%200">Link to this property</a>

"ad\_hoc"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20deployment_trigger%20%3E%20(property)%20type%20%3E%20(member)%201">Link to this property</a>

"deploy\_hook"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20deployment_trigger%20%3E%20(property)%20type%20%3E%20(member)%202">Link to this property</a>

</details>

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20deployment_trigger%20%3E%20(property)%20type">Link to this property</a>

</details>

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20deployment_trigger">Link to this property</a>

<details>

<summary>

env\_vars: Record&lt;string, PagesPlainTextEnvVar {type, value } | null| PagesSecretTextEnvVar {type, value } | null&gt;| null

Environment variables used for builds and Pages Functions.

</summary>

One of the following:

<details>

<summary>

PagesPlainTextEnvVar {type, value }

A plaintext environment variable.

</summary>

type: "plain\_text"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20env_vars%20%3E%20(items)%20%3E%20(variant)%200%20%3E%20(property)%20type">Link to this property</a>

value: string

Environment variable value.

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20env_vars%20%3E%20(items)%20%3E%20(variant)%200%20%3E%20(property)%20value">Link to this property</a>

</details>

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20env_vars%20%3E%20(items)%20%3E%20(variant)%200">Link to this property</a>

<details>

<summary>

PagesSecretTextEnvVar {type, value }

An encrypted environment variable.

</summary>

type: "secret\_text"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20env_vars%20%3E%20(items)%20%3E%20(variant)%201%20%3E%20(property)%20type">Link to this property</a>

value: string

Secret value.

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20env_vars%20%3E%20(items)%20%3E%20(variant)%201%20%3E%20(property)%20value">Link to this property</a>

</details>

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20env_vars%20%3E%20(items)%20%3E%20(variant)%201">Link to this property</a>

</details>

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20env_vars">Link to this property</a>

<details>

<summary>

environment: "preview"| "production"

Type of deploy.

</summary>

One of the following:

"preview"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20environment%20%3E%20(member)%200">Link to this property</a>

"production"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20environment%20%3E%20(member)%201">Link to this property</a>

</details>

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20environment">Link to this property</a>

is\_skipped: boolean

Whether the deployment was skipped.

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20is_skipped">Link to this property</a>

<details>

<summary>

latest\_stage: <a href="https://developers.cloudflare.com/api/typescript/resources/pages#(resource)%20pages.projects%20%3E%20(model)%20stage%20%3E%20(schema)">Stage</a> {ended\_on, name, started\_on, status }

The status of the deployment.

</summary>

ended\_on: string| null

When the stage ended.

formatdate-time

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20latest_stage%20%2B%20(resource)%20pages.projects%20%3E%20(model)%20stage%20%3E%20(schema)%20%3E%20(property)%20ended_on">Link to this property</a>

<details>

<summary>

name: "queued"| "initialize"| "clone\_repo"| 2 more

The current build stage.

</summary>

One of the following:

"queued"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20latest_stage%20%2B%20(resource)%20pages.projects%20%3E%20(model)%20stage%20%3E%20(schema)%20%3E%20(property)%20name%20%3E%20(member)%200">Link to this property</a>

"initialize"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20latest_stage%20%2B%20(resource)%20pages.projects%20%3E%20(model)%20stage%20%3E%20(schema)%20%3E%20(property)%20name%20%3E%20(member)%201">Link to this property</a>

"clone\_repo"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20latest_stage%20%2B%20(resource)%20pages.projects%20%3E%20(model)%20stage%20%3E%20(schema)%20%3E%20(property)%20name%20%3E%20(member)%202">Link to this property</a>

"build"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20latest_stage%20%2B%20(resource)%20pages.projects%20%3E%20(model)%20stage%20%3E%20(schema)%20%3E%20(property)%20name%20%3E%20(member)%203">Link to this property</a>

"deploy"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20latest_stage%20%2B%20(resource)%20pages.projects%20%3E%20(model)%20stage%20%3E%20(schema)%20%3E%20(property)%20name%20%3E%20(member)%204">Link to this property</a>

</details>

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20latest_stage%20%2B%20(resource)%20pages.projects%20%3E%20(model)%20stage%20%3E%20(schema)%20%3E%20(property)%20name">Link to this property</a>

started\_on: string| null

When the stage started.

formatdate-time

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20latest_stage%20%2B%20(resource)%20pages.projects%20%3E%20(model)%20stage%20%3E%20(schema)%20%3E%20(property)%20started_on">Link to this property</a>

<details>

<summary>

status: "success"| "idle"| "active"| 3 more

State of the current stage.

</summary>

One of the following:

"success"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20latest_stage%20%2B%20(resource)%20pages.projects%20%3E%20(model)%20stage%20%3E%20(schema)%20%3E%20(property)%20status%20%3E%20(member)%200">Link to this property</a>

"idle"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20latest_stage%20%2B%20(resource)%20pages.projects%20%3E%20(model)%20stage%20%3E%20(schema)%20%3E%20(property)%20status%20%3E%20(member)%201">Link to this property</a>

"active"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20latest_stage%20%2B%20(resource)%20pages.projects%20%3E%20(model)%20stage%20%3E%20(schema)%20%3E%20(property)%20status%20%3E%20(member)%202">Link to this property</a>

"failure"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20latest_stage%20%2B%20(resource)%20pages.projects%20%3E%20(model)%20stage%20%3E%20(schema)%20%3E%20(property)%20status%20%3E%20(member)%203">Link to this property</a>

"canceled"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20latest_stage%20%2B%20(resource)%20pages.projects%20%3E%20(model)%20stage%20%3E%20(schema)%20%3E%20(property)%20status%20%3E%20(member)%204">Link to this property</a>

"skipped"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20latest_stage%20%2B%20(resource)%20pages.projects%20%3E%20(model)%20stage%20%3E%20(schema)%20%3E%20(property)%20status%20%3E%20(member)%205">Link to this property</a>

</details>

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20latest_stage%20%2B%20(resource)%20pages.projects%20%3E%20(model)%20stage%20%3E%20(schema)%20%3E%20(property)%20status">Link to this property</a>

</details>

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20latest_stage">Link to this property</a>

modified\_on: string

When the deployment was last modified.

formatdate-time

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20modified_on">Link to this property</a>

project\_id: string

Id of the project.

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20project_id">Link to this property</a>

project\_name: string

Name of the Pages project. Must begin with a lowercase letter or digit and contain only lowercase letters, digits, and hyphens.

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20project_name">Link to this property</a>

short\_id: string

Short Id (8 character) of the deployment.

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20short_id">Link to this property</a>

<details>

<summary>

source: Source {config, type }

Configs for the project source control.

</summary>

<details>

<summary>

config: Config {deployments\_enabled, owner, owner\_id, 10 more }

</summary>

Deprecateddeployments\_enabled: boolean

Use <code>production_deployments_enabled</code> and <code>preview_deployment_setting</code> for more granular control.

Whether to enable automatic deployments when pushing to the source repository. When disabled, no deployments (production or preview) will be triggered automatically.

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20source%20%3E%20(property)%20config%20%3E%20(property)%20deployments_enabled">Link to this property</a>

owner: string

The owner of the repository.

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20source%20%3E%20(property)%20config%20%3E%20(property)%20owner">Link to this property</a>

owner\_id: string

The owner ID of the repository.

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20source%20%3E%20(property)%20config%20%3E%20(property)%20owner_id">Link to this property</a>

path\_excludes: Array&lt;string&gt;

A list of paths that should be excluded from triggering a preview deployment. Wildcard syntax (<code>*</code>) is supported.

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20source%20%3E%20(property)%20config%20%3E%20(property)%20path_excludes">Link to this property</a>

path\_includes: Array&lt;string&gt;

A list of paths that should be watched to trigger a preview deployment. Wildcard syntax (<code>*</code>) is supported.

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20source%20%3E%20(property)%20config%20%3E%20(property)%20path_includes">Link to this property</a>

pr\_comments\_enabled: boolean

Whether to enable PR comments.

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20source%20%3E%20(property)%20config%20%3E%20(property)%20pr_comments_enabled">Link to this property</a>

preview\_branch\_excludes: Array&lt;string&gt;

A list of branches that should not trigger a preview deployment. Wildcard syntax (<code>*</code>) is supported. Must be used with <code>preview_deployment_setting</code> set to <code>custom</code>.

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20source%20%3E%20(property)%20config%20%3E%20(property)%20preview_branch_excludes">Link to this property</a>

preview\_branch\_includes: Array&lt;string&gt;

A list of branches that should trigger a preview deployment. Wildcard syntax (<code>*</code>) is supported. Must be used with <code>preview_deployment_setting</code> set to <code>custom</code>.

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20source%20%3E%20(property)%20config%20%3E%20(property)%20preview_branch_includes">Link to this property</a>

<details>

<summary>

preview\_deployment\_setting: "all"| "none"| "custom"

Controls whether commits to preview branches trigger a preview deployment.

</summary>

One of the following:

"all"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20source%20%3E%20(property)%20config%20%3E%20(property)%20preview_deployment_setting%20%3E%20(member)%200">Link to this property</a>

"none"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20source%20%3E%20(property)%20config%20%3E%20(property)%20preview_deployment_setting%20%3E%20(member)%201">Link to this property</a>

"custom"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20source%20%3E%20(property)%20config%20%3E%20(property)%20preview_deployment_setting%20%3E%20(member)%202">Link to this property</a>

</details>

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20source%20%3E%20(property)%20config%20%3E%20(property)%20preview_deployment_setting">Link to this property</a>

production\_branch: string

The production branch of the repository.

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20source%20%3E%20(property)%20config%20%3E%20(property)%20production_branch">Link to this property</a>

production\_deployments\_enabled: boolean

Whether to trigger a production deployment on commits to the production branch.

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20source%20%3E%20(property)%20config%20%3E%20(property)%20production_deployments_enabled">Link to this property</a>

repo\_id: string

The ID of the repository.

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20source%20%3E%20(property)%20config%20%3E%20(property)%20repo_id">Link to this property</a>

repo\_name: string

The name of the repository.

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20source%20%3E%20(property)%20config%20%3E%20(property)%20repo_name">Link to this property</a>

</details>

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20source%20%3E%20(property)%20config">Link to this property</a>

<details>

<summary>

type: "github"| "gitlab"

The source control management provider.

</summary>

One of the following:

"github"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20source%20%3E%20(property)%20type%20%3E%20(member)%200">Link to this property</a>

"gitlab"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20source%20%3E%20(property)%20type%20%3E%20(member)%201">Link to this property</a>

</details>

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20source%20%3E%20(property)%20type">Link to this property</a>

</details>

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20source">Link to this property</a>

<details>

<summary>

stages: Array&lt;<a href="https://developers.cloudflare.com/api/typescript/resources/pages#(resource)%20pages.projects%20%3E%20(model)%20stage%20%3E%20(schema)">Stage</a> {ended\_on, name, started\_on, status } &gt;

List of past stages.

</summary>

ended\_on: string| null

When the stage ended.

formatdate-time

<a href="#(resource)%20pages.projects%20%3E%20(model)%20stage%20%3E%20(schema)%20%3E%20(property)%20ended_on">Link to this property</a>

<details>

<summary>

name: "queued"| "initialize"| "clone\_repo"| 2 more

The current build stage.

</summary>

One of the following:

"queued"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20stage%20%3E%20(schema)%20%3E%20(property)%20name%20%3E%20(member)%200">Link to this property</a>

"initialize"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20stage%20%3E%20(schema)%20%3E%20(property)%20name%20%3E%20(member)%201">Link to this property</a>

"clone\_repo"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20stage%20%3E%20(schema)%20%3E%20(property)%20name%20%3E%20(member)%202">Link to this property</a>

"build"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20stage%20%3E%20(schema)%20%3E%20(property)%20name%20%3E%20(member)%203">Link to this property</a>

"deploy"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20stage%20%3E%20(schema)%20%3E%20(property)%20name%20%3E%20(member)%204">Link to this property</a>

</details>

<a href="#(resource)%20pages.projects%20%3E%20(model)%20stage%20%3E%20(schema)%20%3E%20(property)%20name">Link to this property</a>

started\_on: string| null

When the stage started.

formatdate-time

<a href="#(resource)%20pages.projects%20%3E%20(model)%20stage%20%3E%20(schema)%20%3E%20(property)%20started_on">Link to this property</a>

<details>

<summary>

status: "success"| "idle"| "active"| 3 more

State of the current stage.

</summary>

One of the following:

"success"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20stage%20%3E%20(schema)%20%3E%20(property)%20status%20%3E%20(member)%200">Link to this property</a>

"idle"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20stage%20%3E%20(schema)%20%3E%20(property)%20status%20%3E%20(member)%201">Link to this property</a>

"active"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20stage%20%3E%20(schema)%20%3E%20(property)%20status%20%3E%20(member)%202">Link to this property</a>

"failure"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20stage%20%3E%20(schema)%20%3E%20(property)%20status%20%3E%20(member)%203">Link to this property</a>

"canceled"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20stage%20%3E%20(schema)%20%3E%20(property)%20status%20%3E%20(member)%204">Link to this property</a>

"skipped"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20stage%20%3E%20(schema)%20%3E%20(property)%20status%20%3E%20(member)%205">Link to this property</a>

</details>

<a href="#(resource)%20pages.projects%20%3E%20(model)%20stage%20%3E%20(schema)%20%3E%20(property)%20status">Link to this property</a>

</details>

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20stages">Link to this property</a>

url: string

The live URL to view this deployment.

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20url">Link to this property</a>

<details>

<summary>

skip\_reason?: "commit\_message"| "preview\_deployments\_disabled"| "production\_deployments\_disabled"| 4 more| null

Why the deployment was skipped.

</summary>

One of the following:

"commit\_message"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20skip_reason%20%3E%20(member)%200">Link to this property</a>

"preview\_deployments\_disabled"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20skip_reason%20%3E%20(member)%201">Link to this property</a>

"production\_deployments\_disabled"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20skip_reason%20%3E%20(member)%202">Link to this property</a>

"path\_config"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20skip_reason%20%3E%20(member)%203">Link to this property</a>

"branch\_config"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20skip_reason%20%3E%20(member)%204">Link to this property</a>

"pages\_to\_workers\_conversion"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20skip_reason%20%3E%20(member)%205">Link to this property</a>

"superseded\_queued\_build"

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20skip_reason%20%3E%20(member)%206">Link to this property</a>

</details>

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20skip_reason">Link to this property</a>

uses\_functions?: boolean| null

Whether the deployment uses functions.

<a href="#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)%20%3E%20(property)%20uses_functions">Link to this property</a>

</details>

[Link to this property](<#(resource)%20pages.projects%20%3E%20(model)%20deployment%20%3E%20(schema)>)

### Create a Pages deployment

TypeScript

HTTPTypeScriptPythonGoTerraform

```
import fs from 'fs';
import Cloudflare from 'cloudflare';

const client = new Cloudflare({
  apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted
});

const deployment = await client.pages.projects.deployments.create('this-is-my-project-01', {
  account_id: '023e105f4ecef8ad9ca31a8372d0c353',
});

console.log(deployment.id);
```

200 example

```
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": {
    "id": "f64788e9-fccd-4d4a-a28a-cb84f88f6",
    "aliases": [
      "https://branchname.projectname.pages.dev"
    ],
    "build_config": {
      "web_analytics_tag": "cee1c73f6e4743d0b5e6bb1a0bcaabcc",
      "web_analytics_token": "021e1057c18547eca7b79f2516f06o7x",
      "build_caching": true,
      "build_command": "npm run build",
      "destination_dir": "build",
      "root_dir": "/"
    },
    "created_on": "2021-03-09T00:55:03.923456Z",
    "deployment_trigger": {
      "metadata": {
        "branch": "main",
        "commit_dirty": false,
        "commit_hash": "ad9ccd918a81025731e10e40267e11273a263421",
        "commit_message": "Update index.html"
      },
      "type": "ad_hoc"
    },
    "env_vars": {
      "foo": {
        "type": "plain_text",
        "value": "hello world"
      }
    },
    "environment": "preview",
    "is_skipped": true,
    "latest_stage": {
      "ended_on": "2021-03-09T00:58:59.045655Z",
      "name": "deploy",
      "started_on": "2021-03-09T00:55:03.923456Z",
      "status": "success"
    },
    "modified_on": "2021-03-09T00:58:59.045655Z",
    "project_id": "7b162ea7-7367-4d67-bcde-1160995d5",
    "project_name": "this-is-my-project-01",
    "short_id": "f64788e9",
    "source": {
      "config": {
        "deployments_enabled": true,
        "owner": "my-org",
        "owner_id": "12345678",
        "path_excludes": [
          "string"
        ],
        "path_includes": [
          "string"
        ],
        "pr_comments_enabled": true,
        "preview_branch_excludes": [
          "string"
        ],
        "preview_branch_includes": [
          "string"
        ],
        "preview_deployment_setting": "all",
        "production_branch": "main",
        "production_deployments_enabled": true,
        "repo_id": "12345678",
        "repo_name": "my-repo"
      },
      "type": "github"
    },
    "stages": [
      {
        "ended_on": "2021-06-03T15:39:03.134378Z",
        "name": "queued",
        "started_on": "2021-06-03T15:38:15.608194Z",
        "status": "active"
      },
      {
        "ended_on": null,
        "name": "initialize",
        "started_on": null,
        "status": "idle"
      },
      {
        "ended_on": null,
        "name": "clone_repo",
        "started_on": null,
        "status": "idle"
      },
      {
        "ended_on": null,
        "name": "build",
        "started_on": null,
        "status": "idle"
      },
      {
        "ended_on": null,
        "name": "deploy",
        "started_on": null,
        "status": "idle"
      }
    ],
    "url": "https://f64788e9.ninjakittens.pages.dev",
    "skip_reason": "commit_message",
    "uses_functions": true
  },
  "success": true
}
```

##### Returns Examples

200 example

```
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": {
    "id": "f64788e9-fccd-4d4a-a28a-cb84f88f6",
    "aliases": [
      "https://branchname.projectname.pages.dev"
    ],
    "build_config": {
      "web_analytics_tag": "cee1c73f6e4743d0b5e6bb1a0bcaabcc",
      "web_analytics_token": "021e1057c18547eca7b79f2516f06o7x",
      "build_caching": true,
      "build_command": "npm run build",
      "destination_dir": "build",
      "root_dir": "/"
    },
    "created_on": "2021-03-09T00:55:03.923456Z",
    "deployment_trigger": {
      "metadata": {
        "branch": "main",
        "commit_dirty": false,
        "commit_hash": "ad9ccd918a81025731e10e40267e11273a263421",
        "commit_message": "Update index.html"
      },
      "type": "ad_hoc"
    },
    "env_vars": {
      "foo": {
        "type": "plain_text",
        "value": "hello world"
      }
    },
    "environment": "preview",
    "is_skipped": true,
    "latest_stage": {
      "ended_on": "2021-03-09T00:58:59.045655Z",
      "name": "deploy",
      "started_on": "2021-03-09T00:55:03.923456Z",
      "status": "success"
    },
    "modified_on": "2021-03-09T00:58:59.045655Z",
    "project_id": "7b162ea7-7367-4d67-bcde-1160995d5",
    "project_name": "this-is-my-project-01",
    "short_id": "f64788e9",
    "source": {
      "config": {
        "deployments_enabled": true,
        "owner": "my-org",
        "owner_id": "12345678",
        "path_excludes": [
          "string"
        ],
        "path_includes": [
          "string"
        ],
        "pr_comments_enabled": true,
        "preview_branch_excludes": [
          "string"
        ],
        "preview_branch_includes": [
          "string"
        ],
        "preview_deployment_setting": "all",
        "production_branch": "main",
        "production_deployments_enabled": true,
        "repo_id": "12345678",
        "repo_name": "my-repo"
      },
      "type": "github"
    },
    "stages": [
      {
        "ended_on": "2021-06-03T15:39:03.134378Z",
        "name": "queued",
        "started_on": "2021-06-03T15:38:15.608194Z",
        "status": "active"
      },
      {
        "ended_on": null,
        "name": "initialize",
        "started_on": null,
        "status": "idle"
      },
      {
        "ended_on": null,
        "name": "clone_repo",
        "started_on": null,
        "status": "idle"
      },
      {
        "ended_on": null,
        "name": "build",
        "started_on": null,
        "status": "idle"
      },
      {
        "ended_on": null,
        "name": "deploy",
        "started_on": null,
        "status": "idle"
      }
    ],
    "url": "https://f64788e9.ninjakittens.pages.dev",
    "skip_reason": "commit_message",
    "uses_functions": true
  },
  "success": true
}
```