projects
Creates, updates, deletes, gets or lists a projects resource.
Overview
| Name | projects |
| Type | Resource |
| Id | cloudflare.pages.projects |
Fields
The following fields are returned by SELECT queries:
- get
- list
Get project response.
| Name | Datatype | Description |
|---|---|---|
id | string | ID of the project. (example: 7b162ea7-7367-4d67-bcde-1160995d5) |
name | string | Name of the project. (example: this-is-my-project-01) |
preview_script_name | string | Name of the preview script. (example: pages-worker--1234567-preview) |
production_script_name | string | Name of the production script. (example: pages-worker--1234567-production) |
build_config | object | Configs for the project build process. |
canonical_deployment | object | Most recent production deployment of the project. |
created_on | string (date-time) | When the project was created. (example: 2017-01-01T00:00:00Z) |
deployment_configs | object | Configs for deployments in a project. |
domains | array | A list of associated custom domains for the project. |
framework | string | Framework the project is using. |
framework_version | string | Version of the framework the project is using. |
latest_deployment | object | Most recent deployment of the project. |
production_branch | string | Production branch of the project. Used to identify production deployments. (example: main) |
source | object | Configs for the project source control. |
subdomain | string | The Cloudflare subdomain associated with the project. (example: helloworld.pages.dev) |
uses_functions | boolean | Whether the project uses functions. |
Get projects response.
| Name | Datatype | Description |
|---|---|---|
id | string | ID of the project. (example: 7b162ea7-7367-4d67-bcde-1160995d5) |
name | string | Name of the project. (example: this-is-my-project-01) |
preview_script_name | string | Name of the preview script. (example: pages-worker--1234567-preview) |
production_script_name | string | Name of the production script. (example: pages-worker--1234567-production) |
build_config | object | Configs for the project build process. |
canonical_deployment | object | Most recent production deployment of the project. |
created_on | string (date-time) | When the project was created. (example: 2017-01-01T00:00:00Z) |
deployment_configs | object | Configs for deployments in a project. |
domains | array | A list of associated custom domains for the project. |
framework | string | Framework the project is using. |
framework_version | string | Version of the framework the project is using. |
latest_deployment | object | Most recent deployment of the project. |
production_branch | string | Production branch of the project. Used to identify production deployments. (example: main) |
source | object | Configs for the project source control. |
subdomain | string | The Cloudflare subdomain associated with the project. (example: helloworld.pages.dev) |
uses_functions | boolean | Whether the project uses functions. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | project_name, account_id | Fetch a project by name. | |
list | select | account_id | page, per_page | Fetch a list of all user projects. |
create | insert | account_id, name, production_branch | Create a new project. | |
edit | update | project_name, account_id | Set new attributes for an existing project. Modify environment variables. To delete an environment variable, set the key to null. | |
delete | delete | project_name, account_id | Delete a project by name. | |
purge_build_cache | exec | project_name, account_id | Purge all cached build artifacts for a Pages project |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
account_id | string | The Cloudflare account ID. |
project_name | string | The Pages project name. |
page | integer | |
per_page | integer |
SELECT examples
- get
- list
Fetch a project by name.
SELECT
id,
name,
preview_script_name,
production_script_name,
build_config,
canonical_deployment,
created_on,
deployment_configs,
domains,
framework,
framework_version,
latest_deployment,
production_branch,
source,
subdomain,
uses_functions
FROM cloudflare.pages.projects
WHERE project_name = '{{ project_name }}' -- required
AND account_id = '{{ account_id }}' -- required
;
Fetch a list of all user projects.
SELECT
id,
name,
preview_script_name,
production_script_name,
build_config,
canonical_deployment,
created_on,
deployment_configs,
domains,
framework,
framework_version,
latest_deployment,
production_branch,
source,
subdomain,
uses_functions
FROM cloudflare.pages.projects
WHERE account_id = '{{ account_id }}' -- required
AND page = '{{ page }}'
AND per_page = '{{ per_page }}'
;
INSERT examples
- create
- Manifest
Create a new project.
INSERT INTO cloudflare.pages.projects (
build_config,
deployment_configs,
name,
production_branch,
source,
account_id
)
SELECT
'{{ build_config }}',
'{{ deployment_configs }}',
'{{ name }}' /* required */,
'{{ production_branch }}' /* required */,
'{{ source }}',
'{{ account_id }}'
RETURNING
errors,
messages,
result,
success
;
# Description fields are for documentation purposes
- name: projects
props:
- name: account_id
value: "{{ account_id }}"
description: Required parameter for the projects resource.
- name: build_config
description: |
Configs for the project build process.
value:
build_caching: {{ build_caching }}
build_command: "{{ build_command }}"
destination_dir: "{{ destination_dir }}"
root_dir: "{{ root_dir }}"
web_analytics_tag: "{{ web_analytics_tag }}"
web_analytics_token: "{{ web_analytics_token }}"
- name: deployment_configs
description: |
Configs for deployments in a project.
value:
preview:
ai_bindings: "{{ ai_bindings }}"
always_use_latest_compatibility_date: {{ always_use_latest_compatibility_date }}
analytics_engine_datasets: "{{ analytics_engine_datasets }}"
browsers: "{{ browsers }}"
build_image_major_version: {{ build_image_major_version }}
compatibility_date: "{{ compatibility_date }}"
compatibility_flags:
- "{{ compatibility_flags }}"
d1_databases: "{{ d1_databases }}"
durable_object_namespaces: "{{ durable_object_namespaces }}"
env_vars: "{{ env_vars }}"
fail_open: {{ fail_open }}
hyperdrive_bindings: "{{ hyperdrive_bindings }}"
kv_namespaces: "{{ kv_namespaces }}"
limits:
cpu_ms: {{ cpu_ms }}
mtls_certificates: "{{ mtls_certificates }}"
placement:
mode: "{{ mode }}"
queue_producers: "{{ queue_producers }}"
r2_buckets: "{{ r2_buckets }}"
services: "{{ services }}"
usage_model: "{{ usage_model }}"
vectorize_bindings: "{{ vectorize_bindings }}"
wrangler_config_hash: "{{ wrangler_config_hash }}"
production:
ai_bindings: "{{ ai_bindings }}"
always_use_latest_compatibility_date: {{ always_use_latest_compatibility_date }}
analytics_engine_datasets: "{{ analytics_engine_datasets }}"
browsers: "{{ browsers }}"
build_image_major_version: {{ build_image_major_version }}
compatibility_date: "{{ compatibility_date }}"
compatibility_flags:
- "{{ compatibility_flags }}"
d1_databases: "{{ d1_databases }}"
durable_object_namespaces: "{{ durable_object_namespaces }}"
env_vars: "{{ env_vars }}"
fail_open: {{ fail_open }}
hyperdrive_bindings: "{{ hyperdrive_bindings }}"
kv_namespaces: "{{ kv_namespaces }}"
limits:
cpu_ms: {{ cpu_ms }}
mtls_certificates: "{{ mtls_certificates }}"
placement:
mode: "{{ mode }}"
queue_producers: "{{ queue_producers }}"
r2_buckets: "{{ r2_buckets }}"
services: "{{ services }}"
usage_model: "{{ usage_model }}"
vectorize_bindings: "{{ vectorize_bindings }}"
wrangler_config_hash: "{{ wrangler_config_hash }}"
- name: name
value: "{{ name }}"
description: |
Name of the project.
- name: production_branch
value: "{{ production_branch }}"
description: |
Production branch of the project. Used to identify production deployments.
- name: source
description: |
Configs for the project source control.
value:
config:
deployments_enabled: {{ deployments_enabled }}
owner: "{{ owner }}"
owner_id: "{{ owner_id }}"
path_excludes:
- "{{ path_excludes }}"
path_includes:
- "{{ path_includes }}"
pr_comments_enabled: {{ pr_comments_enabled }}
preview_branch_excludes:
- "{{ preview_branch_excludes }}"
preview_branch_includes:
- "{{ preview_branch_includes }}"
preview_deployment_setting: "{{ preview_deployment_setting }}"
production_branch: "{{ production_branch }}"
production_deployments_enabled: {{ production_deployments_enabled }}
repo_id: "{{ repo_id }}"
repo_name: "{{ repo_name }}"
type: "{{ type }}"
UPDATE examples
- edit
Set new attributes for an existing project. Modify environment variables. To delete an environment variable, set the key to null.
UPDATE cloudflare.pages.projects
SET
build_config = '{{ build_config }}',
deployment_configs = '{{ deployment_configs }}',
name = '{{ name }}',
production_branch = '{{ production_branch }}',
source = '{{ source }}'
WHERE
project_name = '{{ project_name }}' --required
AND account_id = '{{ account_id }}' --required
RETURNING
errors,
messages,
result,
success;
DELETE examples
- delete
Delete a project by name.
DELETE FROM cloudflare.pages.projects
WHERE project_name = '{{ project_name }}' --required
AND account_id = '{{ account_id }}' --required
;
Lifecycle Methods
- purge_build_cache
Purge all cached build artifacts for a Pages project
EXEC cloudflare.pages.projects.purge_build_cache
@project_name='{{ project_name }}' --required,
@account_id='{{ account_id }}' --required
;