Skip to main content

Overview

Cloudflare Pages is a JAMstack platform for frontend developers to collaborate and deploy websites. Use the Pages API to manage projects, deployments, and domains programmatically.

Initialize the client

Projects

Manage Pages projects.

Create a project

Create a new Pages project.
string
required
Account identifier
string
required
Project name
string
required
The Git branch that will be used for production deployments
object
Build configuration settings
object
Deployment configuration for production and preview environments
string
Project identifier
string
Project name
string
The project’s *.pages.dev subdomain
string
When the project was created

List projects

Fetch all projects in an account.
string
required
Account identifier

Get a project

Fetch a specific project by name.

Update a project

Set new attributes for an existing project, including environment variables.
string
The Git branch for production deployments
object
Environment-specific deployment configuration

Delete a project

Delete a project by name.

Purge build cache

Purge the build cache for a project.

Deployments

Manage Pages deployments for a project.
Available methods:

Create deployment

Create a new deployment.

List deployments

List all deployments for a project.

Get deployment

Get details of a specific deployment.

Delete deployment

Delete a deployment.

Retry deployment

Retry a failed deployment.

Rollback deployment

Rollback to a previous deployment.

Domains

Manage custom domains for a project.
Available methods:
  • create() - Add a custom domain
  • list() - List all custom domains
  • get() - Get domain details
  • delete() - Remove a custom domain

Types

Project

string
Project identifier
string
Project name
string
The *.pages.dev subdomain
string
Git branch for production
string
Creation timestamp

Deployment

string
Deployment identifier
string
Deployment URL
string
Deployment environment (production or preview)
string
When the deployment was created

Stage

Deployment stage information.
string
Stage name
string
Stage status