# Projects ## Get projects `client.Pages.Projects.List(ctx, params) (*V4PagePaginationArray[Project], error)` **get** `/accounts/{account_id}/pages/projects` Fetch a list of all user projects. ### Parameters - `params ProjectListParams` - `AccountID param.Field[string]` Path param: Identifier. - `Page param.Field[int64]` Query param: Which page of projects to fetch. - `PerPage param.Field[int64]` Query param: How many projects to return per page. ### Returns - `type Project struct{…}` - `ID string` ID of the project. - `CanonicalDeployment Deployment` Most recent production deployment of the project. - `ID string` Id of the deployment. - `Aliases []string` A list of alias URLs pointing to this deployment. - `BuildConfig DeploymentBuildConfig` Configs for the project build process. - `WebAnalyticsTag string` The classifying tag for analytics. - `WebAnalyticsToken string` The auth token for analytics. - `BuildCaching bool` Enable build caching for the project. - `BuildCommand string` Command used to build project. - `DestinationDir string` Assets output directory of the build. - `RootDir string` Directory to run the command. - `CreatedOn Time` When the deployment was created. - `DeploymentTrigger DeploymentDeploymentTrigger` Info about what caused the deployment. - `Metadata DeploymentDeploymentTriggerMetadata` Additional info about the trigger. - `Branch string` Where the trigger happened. - `CommitDirty bool` Whether the deployment trigger commit was dirty. - `CommitHash string` Hash of the deployment trigger commit. - `CommitMessage string` Message of the deployment trigger commit. - `Type DeploymentDeploymentTriggerType` What caused the deployment. - `const DeploymentDeploymentTriggerTypeGitHubPush DeploymentDeploymentTriggerType = "github:push"` - `const DeploymentDeploymentTriggerTypeADHoc DeploymentDeploymentTriggerType = "ad_hoc"` - `const DeploymentDeploymentTriggerTypeDeployHook DeploymentDeploymentTriggerType = "deploy_hook"` - `EnvVars map[string, DeploymentEnvVar]` Environment variables used for builds and Pages Functions. - `type DeploymentEnvVarsPagesPlainTextEnvVar struct{…}` A plaintext environment variable. - `Type DeploymentEnvVarsPagesPlainTextEnvVarType` - `const DeploymentEnvVarsPagesPlainTextEnvVarTypePlainText DeploymentEnvVarsPagesPlainTextEnvVarType = "plain_text"` - `Value string` Environment variable value. - `type DeploymentEnvVarsPagesSecretTextEnvVar struct{…}` An encrypted environment variable. - `Type DeploymentEnvVarsPagesSecretTextEnvVarType` - `const DeploymentEnvVarsPagesSecretTextEnvVarTypeSecretText DeploymentEnvVarsPagesSecretTextEnvVarType = "secret_text"` - `Value string` Secret value. - `Environment DeploymentEnvironment` Type of deploy. - `const DeploymentEnvironmentPreview DeploymentEnvironment = "preview"` - `const DeploymentEnvironmentProduction DeploymentEnvironment = "production"` - `IsSkipped bool` If the deployment has been skipped. - `LatestStage Stage` The status of the deployment. - `EndedOn Time` When the stage ended. - `Name StageName` The current build stage. - `const StageNameQueued StageName = "queued"` - `const StageNameInitialize StageName = "initialize"` - `const StageNameCloneRepo StageName = "clone_repo"` - `const StageNameBuild StageName = "build"` - `const StageNameDeploy StageName = "deploy"` - `StartedOn Time` When the stage started. - `Status StageStatus` State of the current stage. - `const StageStatusSuccess StageStatus = "success"` - `const StageStatusIdle StageStatus = "idle"` - `const StageStatusActive StageStatus = "active"` - `const StageStatusFailure StageStatus = "failure"` - `const StageStatusCanceled StageStatus = "canceled"` - `ModifiedOn Time` When the deployment was last modified. - `ProjectID string` Id of the project. - `ProjectName string` Name of the project. - `ShortID string` Short Id (8 character) of the deployment. - `Source DeploymentSource` Configs for the project source control. - `Config DeploymentSourceConfig` - `DeploymentsEnabled bool` Whether to enable automatic deployments when pushing to the source repository. When disabled, no deployments (production or preview) will be triggered automatically. - `Owner string` The owner of the repository. - `OwnerID string` The owner ID of the repository. - `PathExcludes []string` A list of paths that should be excluded from triggering a preview deployment. Wildcard syntax (`*`) is supported. - `PathIncludes []string` A list of paths that should be watched to trigger a preview deployment. Wildcard syntax (`*`) is supported. - `PrCommentsEnabled bool` Whether to enable PR comments. - `PreviewBranchExcludes []string` A list of branches that should not trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`. - `PreviewBranchIncludes []string` A list of branches that should trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`. - `PreviewDeploymentSetting DeploymentSourceConfigPreviewDeploymentSetting` Controls whether commits to preview branches trigger a preview deployment. - `const DeploymentSourceConfigPreviewDeploymentSettingAll DeploymentSourceConfigPreviewDeploymentSetting = "all"` - `const DeploymentSourceConfigPreviewDeploymentSettingNone DeploymentSourceConfigPreviewDeploymentSetting = "none"` - `const DeploymentSourceConfigPreviewDeploymentSettingCustom DeploymentSourceConfigPreviewDeploymentSetting = "custom"` - `ProductionBranch string` The production branch of the repository. - `ProductionDeploymentsEnabled bool` Whether to trigger a production deployment on commits to the production branch. - `RepoID string` The ID of the repository. - `RepoName string` The name of the repository. - `Type DeploymentSourceType` The source control management provider. - `const DeploymentSourceTypeGitHub DeploymentSourceType = "github"` - `const DeploymentSourceTypeGitlab DeploymentSourceType = "gitlab"` - `Stages []Stage` List of past stages. - `EndedOn Time` When the stage ended. - `Name StageName` The current build stage. - `StartedOn Time` When the stage started. - `Status StageStatus` State of the current stage. - `URL string` The live URL to view this deployment. - `UsesFunctions bool` Whether the deployment uses functions. - `CreatedOn Time` When the project was created. - `DeploymentConfigs ProjectDeploymentConfigs` Configs for deployments in a project. - `Preview ProjectDeploymentConfigsPreview` Configs for preview deploys. - `AlwaysUseLatestCompatibilityDate bool` Whether to always use the latest compatibility date for Pages Functions. - `BuildImageMajorVersion int64` The major version of the build image to use for Pages Functions. - `CompatibilityDate string` Compatibility date used for Pages Functions. - `CompatibilityFlags []string` Compatibility flags used for Pages Functions. - `EnvVars map[string, ProjectDeploymentConfigsPreviewEnvVar]` Environment variables used for builds and Pages Functions. - `type ProjectDeploymentConfigsPreviewEnvVarsPagesPlainTextEnvVar struct{…}` A plaintext environment variable. - `Type ProjectDeploymentConfigsPreviewEnvVarsPagesPlainTextEnvVarType` - `const ProjectDeploymentConfigsPreviewEnvVarsPagesPlainTextEnvVarTypePlainText ProjectDeploymentConfigsPreviewEnvVarsPagesPlainTextEnvVarType = "plain_text"` - `Value string` Environment variable value. - `type ProjectDeploymentConfigsPreviewEnvVarsPagesSecretTextEnvVar struct{…}` An encrypted environment variable. - `Type ProjectDeploymentConfigsPreviewEnvVarsPagesSecretTextEnvVarType` - `const ProjectDeploymentConfigsPreviewEnvVarsPagesSecretTextEnvVarTypeSecretText ProjectDeploymentConfigsPreviewEnvVarsPagesSecretTextEnvVarType = "secret_text"` - `Value string` Secret value. - `FailOpen bool` Whether to fail open when the deployment config cannot be applied. - `UsageModel ProjectDeploymentConfigsPreviewUsageModel` The usage model for Pages Functions. - `const ProjectDeploymentConfigsPreviewUsageModelStandard ProjectDeploymentConfigsPreviewUsageModel = "standard"` - `const ProjectDeploymentConfigsPreviewUsageModelBundled ProjectDeploymentConfigsPreviewUsageModel = "bundled"` - `const ProjectDeploymentConfigsPreviewUsageModelUnbound ProjectDeploymentConfigsPreviewUsageModel = "unbound"` - `AIBindings map[string, ProjectDeploymentConfigsPreviewAIBinding]` Constellation bindings used for Pages Functions. - `ProjectID string` - `AnalyticsEngineDatasets map[string, ProjectDeploymentConfigsPreviewAnalyticsEngineDataset]` Analytics Engine bindings used for Pages Functions. - `Dataset string` Name of the dataset. - `Browsers map[string, ProjectDeploymentConfigsPreviewBrowser]` Browser bindings used for Pages Functions. - `D1Databases map[string, ProjectDeploymentConfigsPreviewD1Database]` D1 databases used for Pages Functions. - `ID string` UUID of the D1 database. - `DurableObjectNamespaces map[string, ProjectDeploymentConfigsPreviewDurableObjectNamespace]` Durable Object namespaces used for Pages Functions. - `NamespaceID string` ID of the Durable Object namespace. - `HyperdriveBindings map[string, ProjectDeploymentConfigsPreviewHyperdriveBinding]` Hyperdrive bindings used for Pages Functions. - `ID string` - `KVNamespaces map[string, ProjectDeploymentConfigsPreviewKVNamespace]` KV namespaces used for Pages Functions. - `NamespaceID string` ID of the KV namespace. - `Limits ProjectDeploymentConfigsPreviewLimits` Limits for Pages Functions. - `CPUMs int64` CPU time limit in milliseconds. - `MTLSCertificates map[string, ProjectDeploymentConfigsPreviewMTLSCertificate]` mTLS bindings used for Pages Functions. - `CertificateID string` - `Placement ProjectDeploymentConfigsPreviewPlacement` Placement setting used for Pages Functions. - `Mode string` Placement mode. - `QueueProducers map[string, ProjectDeploymentConfigsPreviewQueueProducer]` Queue Producer bindings used for Pages Functions. - `Name string` Name of the Queue. - `R2Buckets map[string, ProjectDeploymentConfigsPreviewR2Bucket]` R2 buckets used for Pages Functions. - `Name string` Name of the R2 bucket. - `Jurisdiction string` Jurisdiction of the R2 bucket. - `Services map[string, ProjectDeploymentConfigsPreviewService]` Services used for Pages Functions. - `Environment string` The Service environment. - `Service string` The Service name. - `Entrypoint string` The entrypoint to bind to. - `VectorizeBindings map[string, ProjectDeploymentConfigsPreviewVectorizeBinding]` Vectorize bindings used for Pages Functions. - `IndexName string` - `WranglerConfigHash string` Hash of the Wrangler configuration used for the deployment. - `Production ProjectDeploymentConfigsProduction` Configs for production deploys. - `AlwaysUseLatestCompatibilityDate bool` Whether to always use the latest compatibility date for Pages Functions. - `BuildImageMajorVersion int64` The major version of the build image to use for Pages Functions. - `CompatibilityDate string` Compatibility date used for Pages Functions. - `CompatibilityFlags []string` Compatibility flags used for Pages Functions. - `EnvVars map[string, ProjectDeploymentConfigsProductionEnvVar]` Environment variables used for builds and Pages Functions. - `type ProjectDeploymentConfigsProductionEnvVarsPagesPlainTextEnvVar struct{…}` A plaintext environment variable. - `Type ProjectDeploymentConfigsProductionEnvVarsPagesPlainTextEnvVarType` - `const ProjectDeploymentConfigsProductionEnvVarsPagesPlainTextEnvVarTypePlainText ProjectDeploymentConfigsProductionEnvVarsPagesPlainTextEnvVarType = "plain_text"` - `Value string` Environment variable value. - `type ProjectDeploymentConfigsProductionEnvVarsPagesSecretTextEnvVar struct{…}` An encrypted environment variable. - `Type ProjectDeploymentConfigsProductionEnvVarsPagesSecretTextEnvVarType` - `const ProjectDeploymentConfigsProductionEnvVarsPagesSecretTextEnvVarTypeSecretText ProjectDeploymentConfigsProductionEnvVarsPagesSecretTextEnvVarType = "secret_text"` - `Value string` Secret value. - `FailOpen bool` Whether to fail open when the deployment config cannot be applied. - `UsageModel ProjectDeploymentConfigsProductionUsageModel` The usage model for Pages Functions. - `const ProjectDeploymentConfigsProductionUsageModelStandard ProjectDeploymentConfigsProductionUsageModel = "standard"` - `const ProjectDeploymentConfigsProductionUsageModelBundled ProjectDeploymentConfigsProductionUsageModel = "bundled"` - `const ProjectDeploymentConfigsProductionUsageModelUnbound ProjectDeploymentConfigsProductionUsageModel = "unbound"` - `AIBindings map[string, ProjectDeploymentConfigsProductionAIBinding]` Constellation bindings used for Pages Functions. - `ProjectID string` - `AnalyticsEngineDatasets map[string, ProjectDeploymentConfigsProductionAnalyticsEngineDataset]` Analytics Engine bindings used for Pages Functions. - `Dataset string` Name of the dataset. - `Browsers map[string, ProjectDeploymentConfigsProductionBrowser]` Browser bindings used for Pages Functions. - `D1Databases map[string, ProjectDeploymentConfigsProductionD1Database]` D1 databases used for Pages Functions. - `ID string` UUID of the D1 database. - `DurableObjectNamespaces map[string, ProjectDeploymentConfigsProductionDurableObjectNamespace]` Durable Object namespaces used for Pages Functions. - `NamespaceID string` ID of the Durable Object namespace. - `HyperdriveBindings map[string, ProjectDeploymentConfigsProductionHyperdriveBinding]` Hyperdrive bindings used for Pages Functions. - `ID string` - `KVNamespaces map[string, ProjectDeploymentConfigsProductionKVNamespace]` KV namespaces used for Pages Functions. - `NamespaceID string` ID of the KV namespace. - `Limits ProjectDeploymentConfigsProductionLimits` Limits for Pages Functions. - `CPUMs int64` CPU time limit in milliseconds. - `MTLSCertificates map[string, ProjectDeploymentConfigsProductionMTLSCertificate]` mTLS bindings used for Pages Functions. - `CertificateID string` - `Placement ProjectDeploymentConfigsProductionPlacement` Placement setting used for Pages Functions. - `Mode string` Placement mode. - `QueueProducers map[string, ProjectDeploymentConfigsProductionQueueProducer]` Queue Producer bindings used for Pages Functions. - `Name string` Name of the Queue. - `R2Buckets map[string, ProjectDeploymentConfigsProductionR2Bucket]` R2 buckets used for Pages Functions. - `Name string` Name of the R2 bucket. - `Jurisdiction string` Jurisdiction of the R2 bucket. - `Services map[string, ProjectDeploymentConfigsProductionService]` Services used for Pages Functions. - `Environment string` The Service environment. - `Service string` The Service name. - `Entrypoint string` The entrypoint to bind to. - `VectorizeBindings map[string, ProjectDeploymentConfigsProductionVectorizeBinding]` Vectorize bindings used for Pages Functions. - `IndexName string` - `WranglerConfigHash string` Hash of the Wrangler configuration used for the deployment. - `Framework string` Framework the project is using. - `FrameworkVersion string` Version of the framework the project is using. - `LatestDeployment Deployment` Most recent deployment of the project. - `Name string` Name of the project. - `PreviewScriptName string` Name of the preview script. - `ProductionBranch string` Production branch of the project. Used to identify production deployments. - `ProductionScriptName string` Name of the production script. - `UsesFunctions bool` Whether the project uses functions. - `BuildConfig ProjectBuildConfig` Configs for the project build process. - `WebAnalyticsTag string` The classifying tag for analytics. - `WebAnalyticsToken string` The auth token for analytics. - `BuildCaching bool` Enable build caching for the project. - `BuildCommand string` Command used to build project. - `DestinationDir string` Assets output directory of the build. - `RootDir string` Directory to run the command. - `Domains []string` A list of associated custom domains for the project. - `Source ProjectSource` Configs for the project source control. - `Config ProjectSourceConfig` - `DeploymentsEnabled bool` Whether to enable automatic deployments when pushing to the source repository. When disabled, no deployments (production or preview) will be triggered automatically. - `Owner string` The owner of the repository. - `OwnerID string` The owner ID of the repository. - `PathExcludes []string` A list of paths that should be excluded from triggering a preview deployment. Wildcard syntax (`*`) is supported. - `PathIncludes []string` A list of paths that should be watched to trigger a preview deployment. Wildcard syntax (`*`) is supported. - `PrCommentsEnabled bool` Whether to enable PR comments. - `PreviewBranchExcludes []string` A list of branches that should not trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`. - `PreviewBranchIncludes []string` A list of branches that should trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`. - `PreviewDeploymentSetting ProjectSourceConfigPreviewDeploymentSetting` Controls whether commits to preview branches trigger a preview deployment. - `const ProjectSourceConfigPreviewDeploymentSettingAll ProjectSourceConfigPreviewDeploymentSetting = "all"` - `const ProjectSourceConfigPreviewDeploymentSettingNone ProjectSourceConfigPreviewDeploymentSetting = "none"` - `const ProjectSourceConfigPreviewDeploymentSettingCustom ProjectSourceConfigPreviewDeploymentSetting = "custom"` - `ProductionBranch string` The production branch of the repository. - `ProductionDeploymentsEnabled bool` Whether to trigger a production deployment on commits to the production branch. - `RepoID string` The ID of the repository. - `RepoName string` The name of the repository. - `Type ProjectSourceType` The source control management provider. - `const ProjectSourceTypeGitHub ProjectSourceType = "github"` - `const ProjectSourceTypeGitlab ProjectSourceType = "gitlab"` - `Subdomain string` The Cloudflare subdomain associated with the project. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/pages" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.Pages.Projects.List(context.TODO(), pages.ProjectListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "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": "7b162ea7-7367-4d67-bcde-1160995d5", "canonical_deployment": { "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", "uses_functions": true }, "created_on": "2017-01-01T00:00:00Z", "deployment_configs": { "preview": { "always_use_latest_compatibility_date": false, "build_image_major_version": 3, "compatibility_date": "2025-01-01", "compatibility_flags": [ "url_standard" ], "env_vars": { "foo": { "type": "plain_text", "value": "hello world" } }, "fail_open": true, "usage_model": "standard", "ai_bindings": { "AI_BINDING": { "project_id": "some-project-id" } }, "analytics_engine_datasets": { "ANALYTICS_ENGINE_BINDING": { "dataset": "api_analytics" } }, "browsers": { "BROWSER": {} }, "d1_databases": { "D1_BINDING": { "id": "445e2955-951a-43f8-a35b-a4d0c8138f63" } }, "durable_object_namespaces": { "DO_BINDING": { "namespace_id": "5eb63bbbe01eeed093cb22bb8f5acdc3" } }, "hyperdrive_bindings": { "HYPERDRIVE": { "id": "a76a99bc342644deb02c38d66082262a" } }, "kv_namespaces": { "KV_BINDING": { "namespace_id": "5eb63bbbe01eeed093cb22bb8f5acdc3" } }, "limits": { "cpu_ms": 100 }, "mtls_certificates": { "MTLS": { "certificate_id": "d7cdd17c-916f-4cb7-aabe-585eb382ec4e" } }, "placement": { "mode": "smart" }, "queue_producers": { "QUEUE_PRODUCER_BINDING": { "name": "some-queue" } }, "r2_buckets": { "R2_BINDING": { "name": "some-bucket", "jurisdiction": "eu" } }, "services": { "SERVICE_BINDING": { "environment": "production", "service": "example-worker", "entrypoint": "MyHandler" } }, "vectorize_bindings": { "VECTORIZE": { "index_name": "my_index" } }, "wrangler_config_hash": "abc123def456" }, "production": { "always_use_latest_compatibility_date": false, "build_image_major_version": 3, "compatibility_date": "2025-01-01", "compatibility_flags": [ "url_standard" ], "env_vars": { "foo": { "type": "plain_text", "value": "hello world" } }, "fail_open": true, "usage_model": "standard", "ai_bindings": { "AI_BINDING": { "project_id": "some-project-id" } }, "analytics_engine_datasets": { "ANALYTICS_ENGINE_BINDING": { "dataset": "api_analytics" } }, "browsers": { "BROWSER": {} }, "d1_databases": { "D1_BINDING": { "id": "445e2955-951a-43f8-a35b-a4d0c8138f63" } }, "durable_object_namespaces": { "DO_BINDING": { "namespace_id": "5eb63bbbe01eeed093cb22bb8f5acdc3" } }, "hyperdrive_bindings": { "HYPERDRIVE": { "id": "a76a99bc342644deb02c38d66082262a" } }, "kv_namespaces": { "KV_BINDING": { "namespace_id": "5eb63bbbe01eeed093cb22bb8f5acdc3" } }, "limits": { "cpu_ms": 100 }, "mtls_certificates": { "MTLS": { "certificate_id": "d7cdd17c-916f-4cb7-aabe-585eb382ec4e" } }, "placement": { "mode": "smart" }, "queue_producers": { "QUEUE_PRODUCER_BINDING": { "name": "some-queue" } }, "r2_buckets": { "R2_BINDING": { "name": "some-bucket", "jurisdiction": "eu" } }, "services": { "SERVICE_BINDING": { "environment": "production", "service": "example-worker", "entrypoint": "MyHandler" } }, "vectorize_bindings": { "VECTORIZE": { "index_name": "my_index" } }, "wrangler_config_hash": "abc123def456" } }, "framework": "framework", "framework_version": "framework_version", "latest_deployment": { "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", "uses_functions": true }, "name": "this-is-my-project-01", "preview_script_name": "pages-worker--1234567-preview", "production_branch": "main", "production_script_name": "pages-worker--1234567-production", "uses_functions": true, "build_config": { "web_analytics_tag": "cee1c73f6e4743d0b5e6bb1a0bcaabcc", "web_analytics_token": "021e1057c18547eca7b79f2516f06o7x", "build_caching": true, "build_command": "npm run build", "destination_dir": "build", "root_dir": "/" }, "domains": [ "customdomain.com", "customdomain.org" ], "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" }, "subdomain": "helloworld.pages.dev" } ], "success": true, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` ## Get project `client.Pages.Projects.Get(ctx, projectName, query) (*Project, error)` **get** `/accounts/{account_id}/pages/projects/{project_name}` Fetch a project by name. ### Parameters - `projectName string` Name of the project. - `query ProjectGetParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type Project struct{…}` - `ID string` ID of the project. - `CanonicalDeployment Deployment` Most recent production deployment of the project. - `ID string` Id of the deployment. - `Aliases []string` A list of alias URLs pointing to this deployment. - `BuildConfig DeploymentBuildConfig` Configs for the project build process. - `WebAnalyticsTag string` The classifying tag for analytics. - `WebAnalyticsToken string` The auth token for analytics. - `BuildCaching bool` Enable build caching for the project. - `BuildCommand string` Command used to build project. - `DestinationDir string` Assets output directory of the build. - `RootDir string` Directory to run the command. - `CreatedOn Time` When the deployment was created. - `DeploymentTrigger DeploymentDeploymentTrigger` Info about what caused the deployment. - `Metadata DeploymentDeploymentTriggerMetadata` Additional info about the trigger. - `Branch string` Where the trigger happened. - `CommitDirty bool` Whether the deployment trigger commit was dirty. - `CommitHash string` Hash of the deployment trigger commit. - `CommitMessage string` Message of the deployment trigger commit. - `Type DeploymentDeploymentTriggerType` What caused the deployment. - `const DeploymentDeploymentTriggerTypeGitHubPush DeploymentDeploymentTriggerType = "github:push"` - `const DeploymentDeploymentTriggerTypeADHoc DeploymentDeploymentTriggerType = "ad_hoc"` - `const DeploymentDeploymentTriggerTypeDeployHook DeploymentDeploymentTriggerType = "deploy_hook"` - `EnvVars map[string, DeploymentEnvVar]` Environment variables used for builds and Pages Functions. - `type DeploymentEnvVarsPagesPlainTextEnvVar struct{…}` A plaintext environment variable. - `Type DeploymentEnvVarsPagesPlainTextEnvVarType` - `const DeploymentEnvVarsPagesPlainTextEnvVarTypePlainText DeploymentEnvVarsPagesPlainTextEnvVarType = "plain_text"` - `Value string` Environment variable value. - `type DeploymentEnvVarsPagesSecretTextEnvVar struct{…}` An encrypted environment variable. - `Type DeploymentEnvVarsPagesSecretTextEnvVarType` - `const DeploymentEnvVarsPagesSecretTextEnvVarTypeSecretText DeploymentEnvVarsPagesSecretTextEnvVarType = "secret_text"` - `Value string` Secret value. - `Environment DeploymentEnvironment` Type of deploy. - `const DeploymentEnvironmentPreview DeploymentEnvironment = "preview"` - `const DeploymentEnvironmentProduction DeploymentEnvironment = "production"` - `IsSkipped bool` If the deployment has been skipped. - `LatestStage Stage` The status of the deployment. - `EndedOn Time` When the stage ended. - `Name StageName` The current build stage. - `const StageNameQueued StageName = "queued"` - `const StageNameInitialize StageName = "initialize"` - `const StageNameCloneRepo StageName = "clone_repo"` - `const StageNameBuild StageName = "build"` - `const StageNameDeploy StageName = "deploy"` - `StartedOn Time` When the stage started. - `Status StageStatus` State of the current stage. - `const StageStatusSuccess StageStatus = "success"` - `const StageStatusIdle StageStatus = "idle"` - `const StageStatusActive StageStatus = "active"` - `const StageStatusFailure StageStatus = "failure"` - `const StageStatusCanceled StageStatus = "canceled"` - `ModifiedOn Time` When the deployment was last modified. - `ProjectID string` Id of the project. - `ProjectName string` Name of the project. - `ShortID string` Short Id (8 character) of the deployment. - `Source DeploymentSource` Configs for the project source control. - `Config DeploymentSourceConfig` - `DeploymentsEnabled bool` Whether to enable automatic deployments when pushing to the source repository. When disabled, no deployments (production or preview) will be triggered automatically. - `Owner string` The owner of the repository. - `OwnerID string` The owner ID of the repository. - `PathExcludes []string` A list of paths that should be excluded from triggering a preview deployment. Wildcard syntax (`*`) is supported. - `PathIncludes []string` A list of paths that should be watched to trigger a preview deployment. Wildcard syntax (`*`) is supported. - `PrCommentsEnabled bool` Whether to enable PR comments. - `PreviewBranchExcludes []string` A list of branches that should not trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`. - `PreviewBranchIncludes []string` A list of branches that should trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`. - `PreviewDeploymentSetting DeploymentSourceConfigPreviewDeploymentSetting` Controls whether commits to preview branches trigger a preview deployment. - `const DeploymentSourceConfigPreviewDeploymentSettingAll DeploymentSourceConfigPreviewDeploymentSetting = "all"` - `const DeploymentSourceConfigPreviewDeploymentSettingNone DeploymentSourceConfigPreviewDeploymentSetting = "none"` - `const DeploymentSourceConfigPreviewDeploymentSettingCustom DeploymentSourceConfigPreviewDeploymentSetting = "custom"` - `ProductionBranch string` The production branch of the repository. - `ProductionDeploymentsEnabled bool` Whether to trigger a production deployment on commits to the production branch. - `RepoID string` The ID of the repository. - `RepoName string` The name of the repository. - `Type DeploymentSourceType` The source control management provider. - `const DeploymentSourceTypeGitHub DeploymentSourceType = "github"` - `const DeploymentSourceTypeGitlab DeploymentSourceType = "gitlab"` - `Stages []Stage` List of past stages. - `EndedOn Time` When the stage ended. - `Name StageName` The current build stage. - `StartedOn Time` When the stage started. - `Status StageStatus` State of the current stage. - `URL string` The live URL to view this deployment. - `UsesFunctions bool` Whether the deployment uses functions. - `CreatedOn Time` When the project was created. - `DeploymentConfigs ProjectDeploymentConfigs` Configs for deployments in a project. - `Preview ProjectDeploymentConfigsPreview` Configs for preview deploys. - `AlwaysUseLatestCompatibilityDate bool` Whether to always use the latest compatibility date for Pages Functions. - `BuildImageMajorVersion int64` The major version of the build image to use for Pages Functions. - `CompatibilityDate string` Compatibility date used for Pages Functions. - `CompatibilityFlags []string` Compatibility flags used for Pages Functions. - `EnvVars map[string, ProjectDeploymentConfigsPreviewEnvVar]` Environment variables used for builds and Pages Functions. - `type ProjectDeploymentConfigsPreviewEnvVarsPagesPlainTextEnvVar struct{…}` A plaintext environment variable. - `Type ProjectDeploymentConfigsPreviewEnvVarsPagesPlainTextEnvVarType` - `const ProjectDeploymentConfigsPreviewEnvVarsPagesPlainTextEnvVarTypePlainText ProjectDeploymentConfigsPreviewEnvVarsPagesPlainTextEnvVarType = "plain_text"` - `Value string` Environment variable value. - `type ProjectDeploymentConfigsPreviewEnvVarsPagesSecretTextEnvVar struct{…}` An encrypted environment variable. - `Type ProjectDeploymentConfigsPreviewEnvVarsPagesSecretTextEnvVarType` - `const ProjectDeploymentConfigsPreviewEnvVarsPagesSecretTextEnvVarTypeSecretText ProjectDeploymentConfigsPreviewEnvVarsPagesSecretTextEnvVarType = "secret_text"` - `Value string` Secret value. - `FailOpen bool` Whether to fail open when the deployment config cannot be applied. - `UsageModel ProjectDeploymentConfigsPreviewUsageModel` The usage model for Pages Functions. - `const ProjectDeploymentConfigsPreviewUsageModelStandard ProjectDeploymentConfigsPreviewUsageModel = "standard"` - `const ProjectDeploymentConfigsPreviewUsageModelBundled ProjectDeploymentConfigsPreviewUsageModel = "bundled"` - `const ProjectDeploymentConfigsPreviewUsageModelUnbound ProjectDeploymentConfigsPreviewUsageModel = "unbound"` - `AIBindings map[string, ProjectDeploymentConfigsPreviewAIBinding]` Constellation bindings used for Pages Functions. - `ProjectID string` - `AnalyticsEngineDatasets map[string, ProjectDeploymentConfigsPreviewAnalyticsEngineDataset]` Analytics Engine bindings used for Pages Functions. - `Dataset string` Name of the dataset. - `Browsers map[string, ProjectDeploymentConfigsPreviewBrowser]` Browser bindings used for Pages Functions. - `D1Databases map[string, ProjectDeploymentConfigsPreviewD1Database]` D1 databases used for Pages Functions. - `ID string` UUID of the D1 database. - `DurableObjectNamespaces map[string, ProjectDeploymentConfigsPreviewDurableObjectNamespace]` Durable Object namespaces used for Pages Functions. - `NamespaceID string` ID of the Durable Object namespace. - `HyperdriveBindings map[string, ProjectDeploymentConfigsPreviewHyperdriveBinding]` Hyperdrive bindings used for Pages Functions. - `ID string` - `KVNamespaces map[string, ProjectDeploymentConfigsPreviewKVNamespace]` KV namespaces used for Pages Functions. - `NamespaceID string` ID of the KV namespace. - `Limits ProjectDeploymentConfigsPreviewLimits` Limits for Pages Functions. - `CPUMs int64` CPU time limit in milliseconds. - `MTLSCertificates map[string, ProjectDeploymentConfigsPreviewMTLSCertificate]` mTLS bindings used for Pages Functions. - `CertificateID string` - `Placement ProjectDeploymentConfigsPreviewPlacement` Placement setting used for Pages Functions. - `Mode string` Placement mode. - `QueueProducers map[string, ProjectDeploymentConfigsPreviewQueueProducer]` Queue Producer bindings used for Pages Functions. - `Name string` Name of the Queue. - `R2Buckets map[string, ProjectDeploymentConfigsPreviewR2Bucket]` R2 buckets used for Pages Functions. - `Name string` Name of the R2 bucket. - `Jurisdiction string` Jurisdiction of the R2 bucket. - `Services map[string, ProjectDeploymentConfigsPreviewService]` Services used for Pages Functions. - `Environment string` The Service environment. - `Service string` The Service name. - `Entrypoint string` The entrypoint to bind to. - `VectorizeBindings map[string, ProjectDeploymentConfigsPreviewVectorizeBinding]` Vectorize bindings used for Pages Functions. - `IndexName string` - `WranglerConfigHash string` Hash of the Wrangler configuration used for the deployment. - `Production ProjectDeploymentConfigsProduction` Configs for production deploys. - `AlwaysUseLatestCompatibilityDate bool` Whether to always use the latest compatibility date for Pages Functions. - `BuildImageMajorVersion int64` The major version of the build image to use for Pages Functions. - `CompatibilityDate string` Compatibility date used for Pages Functions. - `CompatibilityFlags []string` Compatibility flags used for Pages Functions. - `EnvVars map[string, ProjectDeploymentConfigsProductionEnvVar]` Environment variables used for builds and Pages Functions. - `type ProjectDeploymentConfigsProductionEnvVarsPagesPlainTextEnvVar struct{…}` A plaintext environment variable. - `Type ProjectDeploymentConfigsProductionEnvVarsPagesPlainTextEnvVarType` - `const ProjectDeploymentConfigsProductionEnvVarsPagesPlainTextEnvVarTypePlainText ProjectDeploymentConfigsProductionEnvVarsPagesPlainTextEnvVarType = "plain_text"` - `Value string` Environment variable value. - `type ProjectDeploymentConfigsProductionEnvVarsPagesSecretTextEnvVar struct{…}` An encrypted environment variable. - `Type ProjectDeploymentConfigsProductionEnvVarsPagesSecretTextEnvVarType` - `const ProjectDeploymentConfigsProductionEnvVarsPagesSecretTextEnvVarTypeSecretText ProjectDeploymentConfigsProductionEnvVarsPagesSecretTextEnvVarType = "secret_text"` - `Value string` Secret value. - `FailOpen bool` Whether to fail open when the deployment config cannot be applied. - `UsageModel ProjectDeploymentConfigsProductionUsageModel` The usage model for Pages Functions. - `const ProjectDeploymentConfigsProductionUsageModelStandard ProjectDeploymentConfigsProductionUsageModel = "standard"` - `const ProjectDeploymentConfigsProductionUsageModelBundled ProjectDeploymentConfigsProductionUsageModel = "bundled"` - `const ProjectDeploymentConfigsProductionUsageModelUnbound ProjectDeploymentConfigsProductionUsageModel = "unbound"` - `AIBindings map[string, ProjectDeploymentConfigsProductionAIBinding]` Constellation bindings used for Pages Functions. - `ProjectID string` - `AnalyticsEngineDatasets map[string, ProjectDeploymentConfigsProductionAnalyticsEngineDataset]` Analytics Engine bindings used for Pages Functions. - `Dataset string` Name of the dataset. - `Browsers map[string, ProjectDeploymentConfigsProductionBrowser]` Browser bindings used for Pages Functions. - `D1Databases map[string, ProjectDeploymentConfigsProductionD1Database]` D1 databases used for Pages Functions. - `ID string` UUID of the D1 database. - `DurableObjectNamespaces map[string, ProjectDeploymentConfigsProductionDurableObjectNamespace]` Durable Object namespaces used for Pages Functions. - `NamespaceID string` ID of the Durable Object namespace. - `HyperdriveBindings map[string, ProjectDeploymentConfigsProductionHyperdriveBinding]` Hyperdrive bindings used for Pages Functions. - `ID string` - `KVNamespaces map[string, ProjectDeploymentConfigsProductionKVNamespace]` KV namespaces used for Pages Functions. - `NamespaceID string` ID of the KV namespace. - `Limits ProjectDeploymentConfigsProductionLimits` Limits for Pages Functions. - `CPUMs int64` CPU time limit in milliseconds. - `MTLSCertificates map[string, ProjectDeploymentConfigsProductionMTLSCertificate]` mTLS bindings used for Pages Functions. - `CertificateID string` - `Placement ProjectDeploymentConfigsProductionPlacement` Placement setting used for Pages Functions. - `Mode string` Placement mode. - `QueueProducers map[string, ProjectDeploymentConfigsProductionQueueProducer]` Queue Producer bindings used for Pages Functions. - `Name string` Name of the Queue. - `R2Buckets map[string, ProjectDeploymentConfigsProductionR2Bucket]` R2 buckets used for Pages Functions. - `Name string` Name of the R2 bucket. - `Jurisdiction string` Jurisdiction of the R2 bucket. - `Services map[string, ProjectDeploymentConfigsProductionService]` Services used for Pages Functions. - `Environment string` The Service environment. - `Service string` The Service name. - `Entrypoint string` The entrypoint to bind to. - `VectorizeBindings map[string, ProjectDeploymentConfigsProductionVectorizeBinding]` Vectorize bindings used for Pages Functions. - `IndexName string` - `WranglerConfigHash string` Hash of the Wrangler configuration used for the deployment. - `Framework string` Framework the project is using. - `FrameworkVersion string` Version of the framework the project is using. - `LatestDeployment Deployment` Most recent deployment of the project. - `Name string` Name of the project. - `PreviewScriptName string` Name of the preview script. - `ProductionBranch string` Production branch of the project. Used to identify production deployments. - `ProductionScriptName string` Name of the production script. - `UsesFunctions bool` Whether the project uses functions. - `BuildConfig ProjectBuildConfig` Configs for the project build process. - `WebAnalyticsTag string` The classifying tag for analytics. - `WebAnalyticsToken string` The auth token for analytics. - `BuildCaching bool` Enable build caching for the project. - `BuildCommand string` Command used to build project. - `DestinationDir string` Assets output directory of the build. - `RootDir string` Directory to run the command. - `Domains []string` A list of associated custom domains for the project. - `Source ProjectSource` Configs for the project source control. - `Config ProjectSourceConfig` - `DeploymentsEnabled bool` Whether to enable automatic deployments when pushing to the source repository. When disabled, no deployments (production or preview) will be triggered automatically. - `Owner string` The owner of the repository. - `OwnerID string` The owner ID of the repository. - `PathExcludes []string` A list of paths that should be excluded from triggering a preview deployment. Wildcard syntax (`*`) is supported. - `PathIncludes []string` A list of paths that should be watched to trigger a preview deployment. Wildcard syntax (`*`) is supported. - `PrCommentsEnabled bool` Whether to enable PR comments. - `PreviewBranchExcludes []string` A list of branches that should not trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`. - `PreviewBranchIncludes []string` A list of branches that should trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`. - `PreviewDeploymentSetting ProjectSourceConfigPreviewDeploymentSetting` Controls whether commits to preview branches trigger a preview deployment. - `const ProjectSourceConfigPreviewDeploymentSettingAll ProjectSourceConfigPreviewDeploymentSetting = "all"` - `const ProjectSourceConfigPreviewDeploymentSettingNone ProjectSourceConfigPreviewDeploymentSetting = "none"` - `const ProjectSourceConfigPreviewDeploymentSettingCustom ProjectSourceConfigPreviewDeploymentSetting = "custom"` - `ProductionBranch string` The production branch of the repository. - `ProductionDeploymentsEnabled bool` Whether to trigger a production deployment on commits to the production branch. - `RepoID string` The ID of the repository. - `RepoName string` The name of the repository. - `Type ProjectSourceType` The source control management provider. - `const ProjectSourceTypeGitHub ProjectSourceType = "github"` - `const ProjectSourceTypeGitlab ProjectSourceType = "gitlab"` - `Subdomain string` The Cloudflare subdomain associated with the project. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/pages" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) project, err := client.Pages.Projects.Get( context.TODO(), "this-is-my-project-01", pages.ProjectGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", project.ID) } ``` #### Response ```json { "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": "7b162ea7-7367-4d67-bcde-1160995d5", "canonical_deployment": { "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", "uses_functions": true }, "created_on": "2017-01-01T00:00:00Z", "deployment_configs": { "preview": { "always_use_latest_compatibility_date": false, "build_image_major_version": 3, "compatibility_date": "2025-01-01", "compatibility_flags": [ "url_standard" ], "env_vars": { "foo": { "type": "plain_text", "value": "hello world" } }, "fail_open": true, "usage_model": "standard", "ai_bindings": { "AI_BINDING": { "project_id": "some-project-id" } }, "analytics_engine_datasets": { "ANALYTICS_ENGINE_BINDING": { "dataset": "api_analytics" } }, "browsers": { "BROWSER": {} }, "d1_databases": { "D1_BINDING": { "id": "445e2955-951a-43f8-a35b-a4d0c8138f63" } }, "durable_object_namespaces": { "DO_BINDING": { "namespace_id": "5eb63bbbe01eeed093cb22bb8f5acdc3" } }, "hyperdrive_bindings": { "HYPERDRIVE": { "id": "a76a99bc342644deb02c38d66082262a" } }, "kv_namespaces": { "KV_BINDING": { "namespace_id": "5eb63bbbe01eeed093cb22bb8f5acdc3" } }, "limits": { "cpu_ms": 100 }, "mtls_certificates": { "MTLS": { "certificate_id": "d7cdd17c-916f-4cb7-aabe-585eb382ec4e" } }, "placement": { "mode": "smart" }, "queue_producers": { "QUEUE_PRODUCER_BINDING": { "name": "some-queue" } }, "r2_buckets": { "R2_BINDING": { "name": "some-bucket", "jurisdiction": "eu" } }, "services": { "SERVICE_BINDING": { "environment": "production", "service": "example-worker", "entrypoint": "MyHandler" } }, "vectorize_bindings": { "VECTORIZE": { "index_name": "my_index" } }, "wrangler_config_hash": "abc123def456" }, "production": { "always_use_latest_compatibility_date": false, "build_image_major_version": 3, "compatibility_date": "2025-01-01", "compatibility_flags": [ "url_standard" ], "env_vars": { "foo": { "type": "plain_text", "value": "hello world" } }, "fail_open": true, "usage_model": "standard", "ai_bindings": { "AI_BINDING": { "project_id": "some-project-id" } }, "analytics_engine_datasets": { "ANALYTICS_ENGINE_BINDING": { "dataset": "api_analytics" } }, "browsers": { "BROWSER": {} }, "d1_databases": { "D1_BINDING": { "id": "445e2955-951a-43f8-a35b-a4d0c8138f63" } }, "durable_object_namespaces": { "DO_BINDING": { "namespace_id": "5eb63bbbe01eeed093cb22bb8f5acdc3" } }, "hyperdrive_bindings": { "HYPERDRIVE": { "id": "a76a99bc342644deb02c38d66082262a" } }, "kv_namespaces": { "KV_BINDING": { "namespace_id": "5eb63bbbe01eeed093cb22bb8f5acdc3" } }, "limits": { "cpu_ms": 100 }, "mtls_certificates": { "MTLS": { "certificate_id": "d7cdd17c-916f-4cb7-aabe-585eb382ec4e" } }, "placement": { "mode": "smart" }, "queue_producers": { "QUEUE_PRODUCER_BINDING": { "name": "some-queue" } }, "r2_buckets": { "R2_BINDING": { "name": "some-bucket", "jurisdiction": "eu" } }, "services": { "SERVICE_BINDING": { "environment": "production", "service": "example-worker", "entrypoint": "MyHandler" } }, "vectorize_bindings": { "VECTORIZE": { "index_name": "my_index" } }, "wrangler_config_hash": "abc123def456" } }, "framework": "framework", "framework_version": "framework_version", "latest_deployment": { "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", "uses_functions": true }, "name": "this-is-my-project-01", "preview_script_name": "pages-worker--1234567-preview", "production_branch": "main", "production_script_name": "pages-worker--1234567-production", "uses_functions": true, "build_config": { "web_analytics_tag": "cee1c73f6e4743d0b5e6bb1a0bcaabcc", "web_analytics_token": "021e1057c18547eca7b79f2516f06o7x", "build_caching": true, "build_command": "npm run build", "destination_dir": "build", "root_dir": "/" }, "domains": [ "customdomain.com", "customdomain.org" ], "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" }, "subdomain": "helloworld.pages.dev" }, "success": true } ``` ## Create project `client.Pages.Projects.New(ctx, params) (*Project, error)` **post** `/accounts/{account_id}/pages/projects` Create a new project. ### Parameters - `params ProjectNewParams` - `AccountID param.Field[string]` Path param: Identifier. - `Name param.Field[string]` Body param: Name of the project. - `ProductionBranch param.Field[string]` Body param: Production branch of the project. Used to identify production deployments. - `BuildConfig param.Field[ProjectNewParamsBuildConfig]` Body param: Configs for the project build process. - `BuildCaching bool` Enable build caching for the project. - `BuildCommand string` Command used to build project. - `DestinationDir string` Output directory of the build. - `RootDir string` Directory to run the command. - `WebAnalyticsTag string` The classifying tag for analytics. - `WebAnalyticsToken string` The auth token for analytics. - `DeploymentConfigs param.Field[ProjectNewParamsDeploymentConfigs]` Body param: Configs for deployments in a project. - `Preview ProjectNewParamsDeploymentConfigsPreview` Configs for preview deploys. - `AIBindings map[string, ProjectNewParamsDeploymentConfigsPreviewAIBindings]` Constellation bindings used for Pages Functions. - `ProjectID string` - `AlwaysUseLatestCompatibilityDate bool` Whether to always use the latest compatibility date for Pages Functions. - `AnalyticsEngineDatasets map[string, ProjectNewParamsDeploymentConfigsPreviewAnalyticsEngineDatasets]` Analytics Engine bindings used for Pages Functions. - `Dataset string` Name of the dataset. - `Browsers map[string, ProjectNewParamsDeploymentConfigsPreviewBrowsers]` Browser bindings used for Pages Functions. - `BuildImageMajorVersion int64` The major version of the build image to use for Pages Functions. - `CompatibilityDate string` Compatibility date used for Pages Functions. - `CompatibilityFlags []string` Compatibility flags used for Pages Functions. - `D1Databases map[string, ProjectNewParamsDeploymentConfigsPreviewD1Databases]` D1 databases used for Pages Functions. - `ID string` UUID of the D1 database. - `DurableObjectNamespaces map[string, ProjectNewParamsDeploymentConfigsPreviewDurableObjectNamespaces]` Durable Object namespaces used for Pages Functions. - `NamespaceID string` ID of the Durable Object namespace. - `EnvVars map[string, ProjectNewParamsDeploymentConfigsPreviewEnvVars]` Environment variables used for builds and Pages Functions. - `type ProjectNewParamsDeploymentConfigsPreviewEnvVarsPagesPlainTextEnvVar struct{…}` A plaintext environment variable. - `Type ProjectNewParamsDeploymentConfigsPreviewEnvVarsPagesPlainTextEnvVarType` - `const ProjectNewParamsDeploymentConfigsPreviewEnvVarsPagesPlainTextEnvVarTypePlainText ProjectNewParamsDeploymentConfigsPreviewEnvVarsPagesPlainTextEnvVarType = "plain_text"` - `Value string` Environment variable value. - `type ProjectNewParamsDeploymentConfigsPreviewEnvVarsPagesSecretTextEnvVar struct{…}` An encrypted environment variable. - `Type ProjectNewParamsDeploymentConfigsPreviewEnvVarsPagesSecretTextEnvVarType` - `const ProjectNewParamsDeploymentConfigsPreviewEnvVarsPagesSecretTextEnvVarTypeSecretText ProjectNewParamsDeploymentConfigsPreviewEnvVarsPagesSecretTextEnvVarType = "secret_text"` - `Value string` Secret value. - `FailOpen bool` Whether to fail open when the deployment config cannot be applied. - `HyperdriveBindings map[string, ProjectNewParamsDeploymentConfigsPreviewHyperdriveBindings]` Hyperdrive bindings used for Pages Functions. - `ID string` - `KVNamespaces map[string, ProjectNewParamsDeploymentConfigsPreviewKVNamespaces]` KV namespaces used for Pages Functions. - `NamespaceID string` ID of the KV namespace. - `Limits ProjectNewParamsDeploymentConfigsPreviewLimits` Limits for Pages Functions. - `CPUMs int64` CPU time limit in milliseconds. - `MTLSCertificates map[string, ProjectNewParamsDeploymentConfigsPreviewMTLSCertificates]` mTLS bindings used for Pages Functions. - `CertificateID string` - `Placement ProjectNewParamsDeploymentConfigsPreviewPlacement` Placement setting used for Pages Functions. - `Mode string` Placement mode. - `QueueProducers map[string, ProjectNewParamsDeploymentConfigsPreviewQueueProducers]` Queue Producer bindings used for Pages Functions. - `Name string` Name of the Queue. - `R2Buckets map[string, ProjectNewParamsDeploymentConfigsPreviewR2Buckets]` R2 buckets used for Pages Functions. - `Name string` Name of the R2 bucket. - `Jurisdiction string` Jurisdiction of the R2 bucket. - `Services map[string, ProjectNewParamsDeploymentConfigsPreviewServices]` Services used for Pages Functions. - `Service string` The Service name. - `Entrypoint string` The entrypoint to bind to. - `Environment string` The Service environment. - `UsageModel ProjectNewParamsDeploymentConfigsPreviewUsageModel` The usage model for Pages Functions. - `const ProjectNewParamsDeploymentConfigsPreviewUsageModelStandard ProjectNewParamsDeploymentConfigsPreviewUsageModel = "standard"` - `const ProjectNewParamsDeploymentConfigsPreviewUsageModelBundled ProjectNewParamsDeploymentConfigsPreviewUsageModel = "bundled"` - `const ProjectNewParamsDeploymentConfigsPreviewUsageModelUnbound ProjectNewParamsDeploymentConfigsPreviewUsageModel = "unbound"` - `VectorizeBindings map[string, ProjectNewParamsDeploymentConfigsPreviewVectorizeBindings]` Vectorize bindings used for Pages Functions. - `IndexName string` - `WranglerConfigHash string` Hash of the Wrangler configuration used for the deployment. - `Production ProjectNewParamsDeploymentConfigsProduction` Configs for production deploys. - `AIBindings map[string, ProjectNewParamsDeploymentConfigsProductionAIBindings]` Constellation bindings used for Pages Functions. - `ProjectID string` - `AlwaysUseLatestCompatibilityDate bool` Whether to always use the latest compatibility date for Pages Functions. - `AnalyticsEngineDatasets map[string, ProjectNewParamsDeploymentConfigsProductionAnalyticsEngineDatasets]` Analytics Engine bindings used for Pages Functions. - `Dataset string` Name of the dataset. - `Browsers map[string, ProjectNewParamsDeploymentConfigsProductionBrowsers]` Browser bindings used for Pages Functions. - `BuildImageMajorVersion int64` The major version of the build image to use for Pages Functions. - `CompatibilityDate string` Compatibility date used for Pages Functions. - `CompatibilityFlags []string` Compatibility flags used for Pages Functions. - `D1Databases map[string, ProjectNewParamsDeploymentConfigsProductionD1Databases]` D1 databases used for Pages Functions. - `ID string` UUID of the D1 database. - `DurableObjectNamespaces map[string, ProjectNewParamsDeploymentConfigsProductionDurableObjectNamespaces]` Durable Object namespaces used for Pages Functions. - `NamespaceID string` ID of the Durable Object namespace. - `EnvVars map[string, ProjectNewParamsDeploymentConfigsProductionEnvVars]` Environment variables used for builds and Pages Functions. - `type ProjectNewParamsDeploymentConfigsProductionEnvVarsPagesPlainTextEnvVar struct{…}` A plaintext environment variable. - `Type ProjectNewParamsDeploymentConfigsProductionEnvVarsPagesPlainTextEnvVarType` - `const ProjectNewParamsDeploymentConfigsProductionEnvVarsPagesPlainTextEnvVarTypePlainText ProjectNewParamsDeploymentConfigsProductionEnvVarsPagesPlainTextEnvVarType = "plain_text"` - `Value string` Environment variable value. - `type ProjectNewParamsDeploymentConfigsProductionEnvVarsPagesSecretTextEnvVar struct{…}` An encrypted environment variable. - `Type ProjectNewParamsDeploymentConfigsProductionEnvVarsPagesSecretTextEnvVarType` - `const ProjectNewParamsDeploymentConfigsProductionEnvVarsPagesSecretTextEnvVarTypeSecretText ProjectNewParamsDeploymentConfigsProductionEnvVarsPagesSecretTextEnvVarType = "secret_text"` - `Value string` Secret value. - `FailOpen bool` Whether to fail open when the deployment config cannot be applied. - `HyperdriveBindings map[string, ProjectNewParamsDeploymentConfigsProductionHyperdriveBindings]` Hyperdrive bindings used for Pages Functions. - `ID string` - `KVNamespaces map[string, ProjectNewParamsDeploymentConfigsProductionKVNamespaces]` KV namespaces used for Pages Functions. - `NamespaceID string` ID of the KV namespace. - `Limits ProjectNewParamsDeploymentConfigsProductionLimits` Limits for Pages Functions. - `CPUMs int64` CPU time limit in milliseconds. - `MTLSCertificates map[string, ProjectNewParamsDeploymentConfigsProductionMTLSCertificates]` mTLS bindings used for Pages Functions. - `CertificateID string` - `Placement ProjectNewParamsDeploymentConfigsProductionPlacement` Placement setting used for Pages Functions. - `Mode string` Placement mode. - `QueueProducers map[string, ProjectNewParamsDeploymentConfigsProductionQueueProducers]` Queue Producer bindings used for Pages Functions. - `Name string` Name of the Queue. - `R2Buckets map[string, ProjectNewParamsDeploymentConfigsProductionR2Buckets]` R2 buckets used for Pages Functions. - `Name string` Name of the R2 bucket. - `Jurisdiction string` Jurisdiction of the R2 bucket. - `Services map[string, ProjectNewParamsDeploymentConfigsProductionServices]` Services used for Pages Functions. - `Service string` The Service name. - `Entrypoint string` The entrypoint to bind to. - `Environment string` The Service environment. - `UsageModel ProjectNewParamsDeploymentConfigsProductionUsageModel` The usage model for Pages Functions. - `const ProjectNewParamsDeploymentConfigsProductionUsageModelStandard ProjectNewParamsDeploymentConfigsProductionUsageModel = "standard"` - `const ProjectNewParamsDeploymentConfigsProductionUsageModelBundled ProjectNewParamsDeploymentConfigsProductionUsageModel = "bundled"` - `const ProjectNewParamsDeploymentConfigsProductionUsageModelUnbound ProjectNewParamsDeploymentConfigsProductionUsageModel = "unbound"` - `VectorizeBindings map[string, ProjectNewParamsDeploymentConfigsProductionVectorizeBindings]` Vectorize bindings used for Pages Functions. - `IndexName string` - `WranglerConfigHash string` Hash of the Wrangler configuration used for the deployment. - `Source param.Field[ProjectNewParamsSource]` Body param: Configs for the project source control. - `Config ProjectNewParamsSourceConfig` - `DeploymentsEnabled bool` Whether to enable automatic deployments when pushing to the source repository. When disabled, no deployments (production or preview) will be triggered automatically. - `Owner string` The owner of the repository. - `OwnerID string` The owner ID of the repository. - `PathExcludes []string` A list of paths that should be excluded from triggering a preview deployment. Wildcard syntax (`*`) is supported. - `PathIncludes []string` A list of paths that should be watched to trigger a preview deployment. Wildcard syntax (`*`) is supported. - `PrCommentsEnabled bool` Whether to enable PR comments. - `PreviewBranchExcludes []string` A list of branches that should not trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`. - `PreviewBranchIncludes []string` A list of branches that should trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`. - `PreviewDeploymentSetting ProjectNewParamsSourceConfigPreviewDeploymentSetting` Controls whether commits to preview branches trigger a preview deployment. - `const ProjectNewParamsSourceConfigPreviewDeploymentSettingAll ProjectNewParamsSourceConfigPreviewDeploymentSetting = "all"` - `const ProjectNewParamsSourceConfigPreviewDeploymentSettingNone ProjectNewParamsSourceConfigPreviewDeploymentSetting = "none"` - `const ProjectNewParamsSourceConfigPreviewDeploymentSettingCustom ProjectNewParamsSourceConfigPreviewDeploymentSetting = "custom"` - `ProductionBranch string` The production branch of the repository. - `ProductionDeploymentsEnabled bool` Whether to trigger a production deployment on commits to the production branch. - `RepoID string` The ID of the repository. - `RepoName string` The name of the repository. - `Type ProjectNewParamsSourceType` The source control management provider. - `const ProjectNewParamsSourceTypeGitHub ProjectNewParamsSourceType = "github"` - `const ProjectNewParamsSourceTypeGitlab ProjectNewParamsSourceType = "gitlab"` ### Returns - `type Project struct{…}` - `ID string` ID of the project. - `CanonicalDeployment Deployment` Most recent production deployment of the project. - `ID string` Id of the deployment. - `Aliases []string` A list of alias URLs pointing to this deployment. - `BuildConfig DeploymentBuildConfig` Configs for the project build process. - `WebAnalyticsTag string` The classifying tag for analytics. - `WebAnalyticsToken string` The auth token for analytics. - `BuildCaching bool` Enable build caching for the project. - `BuildCommand string` Command used to build project. - `DestinationDir string` Assets output directory of the build. - `RootDir string` Directory to run the command. - `CreatedOn Time` When the deployment was created. - `DeploymentTrigger DeploymentDeploymentTrigger` Info about what caused the deployment. - `Metadata DeploymentDeploymentTriggerMetadata` Additional info about the trigger. - `Branch string` Where the trigger happened. - `CommitDirty bool` Whether the deployment trigger commit was dirty. - `CommitHash string` Hash of the deployment trigger commit. - `CommitMessage string` Message of the deployment trigger commit. - `Type DeploymentDeploymentTriggerType` What caused the deployment. - `const DeploymentDeploymentTriggerTypeGitHubPush DeploymentDeploymentTriggerType = "github:push"` - `const DeploymentDeploymentTriggerTypeADHoc DeploymentDeploymentTriggerType = "ad_hoc"` - `const DeploymentDeploymentTriggerTypeDeployHook DeploymentDeploymentTriggerType = "deploy_hook"` - `EnvVars map[string, DeploymentEnvVar]` Environment variables used for builds and Pages Functions. - `type DeploymentEnvVarsPagesPlainTextEnvVar struct{…}` A plaintext environment variable. - `Type DeploymentEnvVarsPagesPlainTextEnvVarType` - `const DeploymentEnvVarsPagesPlainTextEnvVarTypePlainText DeploymentEnvVarsPagesPlainTextEnvVarType = "plain_text"` - `Value string` Environment variable value. - `type DeploymentEnvVarsPagesSecretTextEnvVar struct{…}` An encrypted environment variable. - `Type DeploymentEnvVarsPagesSecretTextEnvVarType` - `const DeploymentEnvVarsPagesSecretTextEnvVarTypeSecretText DeploymentEnvVarsPagesSecretTextEnvVarType = "secret_text"` - `Value string` Secret value. - `Environment DeploymentEnvironment` Type of deploy. - `const DeploymentEnvironmentPreview DeploymentEnvironment = "preview"` - `const DeploymentEnvironmentProduction DeploymentEnvironment = "production"` - `IsSkipped bool` If the deployment has been skipped. - `LatestStage Stage` The status of the deployment. - `EndedOn Time` When the stage ended. - `Name StageName` The current build stage. - `const StageNameQueued StageName = "queued"` - `const StageNameInitialize StageName = "initialize"` - `const StageNameCloneRepo StageName = "clone_repo"` - `const StageNameBuild StageName = "build"` - `const StageNameDeploy StageName = "deploy"` - `StartedOn Time` When the stage started. - `Status StageStatus` State of the current stage. - `const StageStatusSuccess StageStatus = "success"` - `const StageStatusIdle StageStatus = "idle"` - `const StageStatusActive StageStatus = "active"` - `const StageStatusFailure StageStatus = "failure"` - `const StageStatusCanceled StageStatus = "canceled"` - `ModifiedOn Time` When the deployment was last modified. - `ProjectID string` Id of the project. - `ProjectName string` Name of the project. - `ShortID string` Short Id (8 character) of the deployment. - `Source DeploymentSource` Configs for the project source control. - `Config DeploymentSourceConfig` - `DeploymentsEnabled bool` Whether to enable automatic deployments when pushing to the source repository. When disabled, no deployments (production or preview) will be triggered automatically. - `Owner string` The owner of the repository. - `OwnerID string` The owner ID of the repository. - `PathExcludes []string` A list of paths that should be excluded from triggering a preview deployment. Wildcard syntax (`*`) is supported. - `PathIncludes []string` A list of paths that should be watched to trigger a preview deployment. Wildcard syntax (`*`) is supported. - `PrCommentsEnabled bool` Whether to enable PR comments. - `PreviewBranchExcludes []string` A list of branches that should not trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`. - `PreviewBranchIncludes []string` A list of branches that should trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`. - `PreviewDeploymentSetting DeploymentSourceConfigPreviewDeploymentSetting` Controls whether commits to preview branches trigger a preview deployment. - `const DeploymentSourceConfigPreviewDeploymentSettingAll DeploymentSourceConfigPreviewDeploymentSetting = "all"` - `const DeploymentSourceConfigPreviewDeploymentSettingNone DeploymentSourceConfigPreviewDeploymentSetting = "none"` - `const DeploymentSourceConfigPreviewDeploymentSettingCustom DeploymentSourceConfigPreviewDeploymentSetting = "custom"` - `ProductionBranch string` The production branch of the repository. - `ProductionDeploymentsEnabled bool` Whether to trigger a production deployment on commits to the production branch. - `RepoID string` The ID of the repository. - `RepoName string` The name of the repository. - `Type DeploymentSourceType` The source control management provider. - `const DeploymentSourceTypeGitHub DeploymentSourceType = "github"` - `const DeploymentSourceTypeGitlab DeploymentSourceType = "gitlab"` - `Stages []Stage` List of past stages. - `EndedOn Time` When the stage ended. - `Name StageName` The current build stage. - `StartedOn Time` When the stage started. - `Status StageStatus` State of the current stage. - `URL string` The live URL to view this deployment. - `UsesFunctions bool` Whether the deployment uses functions. - `CreatedOn Time` When the project was created. - `DeploymentConfigs ProjectDeploymentConfigs` Configs for deployments in a project. - `Preview ProjectDeploymentConfigsPreview` Configs for preview deploys. - `AlwaysUseLatestCompatibilityDate bool` Whether to always use the latest compatibility date for Pages Functions. - `BuildImageMajorVersion int64` The major version of the build image to use for Pages Functions. - `CompatibilityDate string` Compatibility date used for Pages Functions. - `CompatibilityFlags []string` Compatibility flags used for Pages Functions. - `EnvVars map[string, ProjectDeploymentConfigsPreviewEnvVar]` Environment variables used for builds and Pages Functions. - `type ProjectDeploymentConfigsPreviewEnvVarsPagesPlainTextEnvVar struct{…}` A plaintext environment variable. - `Type ProjectDeploymentConfigsPreviewEnvVarsPagesPlainTextEnvVarType` - `const ProjectDeploymentConfigsPreviewEnvVarsPagesPlainTextEnvVarTypePlainText ProjectDeploymentConfigsPreviewEnvVarsPagesPlainTextEnvVarType = "plain_text"` - `Value string` Environment variable value. - `type ProjectDeploymentConfigsPreviewEnvVarsPagesSecretTextEnvVar struct{…}` An encrypted environment variable. - `Type ProjectDeploymentConfigsPreviewEnvVarsPagesSecretTextEnvVarType` - `const ProjectDeploymentConfigsPreviewEnvVarsPagesSecretTextEnvVarTypeSecretText ProjectDeploymentConfigsPreviewEnvVarsPagesSecretTextEnvVarType = "secret_text"` - `Value string` Secret value. - `FailOpen bool` Whether to fail open when the deployment config cannot be applied. - `UsageModel ProjectDeploymentConfigsPreviewUsageModel` The usage model for Pages Functions. - `const ProjectDeploymentConfigsPreviewUsageModelStandard ProjectDeploymentConfigsPreviewUsageModel = "standard"` - `const ProjectDeploymentConfigsPreviewUsageModelBundled ProjectDeploymentConfigsPreviewUsageModel = "bundled"` - `const ProjectDeploymentConfigsPreviewUsageModelUnbound ProjectDeploymentConfigsPreviewUsageModel = "unbound"` - `AIBindings map[string, ProjectDeploymentConfigsPreviewAIBinding]` Constellation bindings used for Pages Functions. - `ProjectID string` - `AnalyticsEngineDatasets map[string, ProjectDeploymentConfigsPreviewAnalyticsEngineDataset]` Analytics Engine bindings used for Pages Functions. - `Dataset string` Name of the dataset. - `Browsers map[string, ProjectDeploymentConfigsPreviewBrowser]` Browser bindings used for Pages Functions. - `D1Databases map[string, ProjectDeploymentConfigsPreviewD1Database]` D1 databases used for Pages Functions. - `ID string` UUID of the D1 database. - `DurableObjectNamespaces map[string, ProjectDeploymentConfigsPreviewDurableObjectNamespace]` Durable Object namespaces used for Pages Functions. - `NamespaceID string` ID of the Durable Object namespace. - `HyperdriveBindings map[string, ProjectDeploymentConfigsPreviewHyperdriveBinding]` Hyperdrive bindings used for Pages Functions. - `ID string` - `KVNamespaces map[string, ProjectDeploymentConfigsPreviewKVNamespace]` KV namespaces used for Pages Functions. - `NamespaceID string` ID of the KV namespace. - `Limits ProjectDeploymentConfigsPreviewLimits` Limits for Pages Functions. - `CPUMs int64` CPU time limit in milliseconds. - `MTLSCertificates map[string, ProjectDeploymentConfigsPreviewMTLSCertificate]` mTLS bindings used for Pages Functions. - `CertificateID string` - `Placement ProjectDeploymentConfigsPreviewPlacement` Placement setting used for Pages Functions. - `Mode string` Placement mode. - `QueueProducers map[string, ProjectDeploymentConfigsPreviewQueueProducer]` Queue Producer bindings used for Pages Functions. - `Name string` Name of the Queue. - `R2Buckets map[string, ProjectDeploymentConfigsPreviewR2Bucket]` R2 buckets used for Pages Functions. - `Name string` Name of the R2 bucket. - `Jurisdiction string` Jurisdiction of the R2 bucket. - `Services map[string, ProjectDeploymentConfigsPreviewService]` Services used for Pages Functions. - `Environment string` The Service environment. - `Service string` The Service name. - `Entrypoint string` The entrypoint to bind to. - `VectorizeBindings map[string, ProjectDeploymentConfigsPreviewVectorizeBinding]` Vectorize bindings used for Pages Functions. - `IndexName string` - `WranglerConfigHash string` Hash of the Wrangler configuration used for the deployment. - `Production ProjectDeploymentConfigsProduction` Configs for production deploys. - `AlwaysUseLatestCompatibilityDate bool` Whether to always use the latest compatibility date for Pages Functions. - `BuildImageMajorVersion int64` The major version of the build image to use for Pages Functions. - `CompatibilityDate string` Compatibility date used for Pages Functions. - `CompatibilityFlags []string` Compatibility flags used for Pages Functions. - `EnvVars map[string, ProjectDeploymentConfigsProductionEnvVar]` Environment variables used for builds and Pages Functions. - `type ProjectDeploymentConfigsProductionEnvVarsPagesPlainTextEnvVar struct{…}` A plaintext environment variable. - `Type ProjectDeploymentConfigsProductionEnvVarsPagesPlainTextEnvVarType` - `const ProjectDeploymentConfigsProductionEnvVarsPagesPlainTextEnvVarTypePlainText ProjectDeploymentConfigsProductionEnvVarsPagesPlainTextEnvVarType = "plain_text"` - `Value string` Environment variable value. - `type ProjectDeploymentConfigsProductionEnvVarsPagesSecretTextEnvVar struct{…}` An encrypted environment variable. - `Type ProjectDeploymentConfigsProductionEnvVarsPagesSecretTextEnvVarType` - `const ProjectDeploymentConfigsProductionEnvVarsPagesSecretTextEnvVarTypeSecretText ProjectDeploymentConfigsProductionEnvVarsPagesSecretTextEnvVarType = "secret_text"` - `Value string` Secret value. - `FailOpen bool` Whether to fail open when the deployment config cannot be applied. - `UsageModel ProjectDeploymentConfigsProductionUsageModel` The usage model for Pages Functions. - `const ProjectDeploymentConfigsProductionUsageModelStandard ProjectDeploymentConfigsProductionUsageModel = "standard"` - `const ProjectDeploymentConfigsProductionUsageModelBundled ProjectDeploymentConfigsProductionUsageModel = "bundled"` - `const ProjectDeploymentConfigsProductionUsageModelUnbound ProjectDeploymentConfigsProductionUsageModel = "unbound"` - `AIBindings map[string, ProjectDeploymentConfigsProductionAIBinding]` Constellation bindings used for Pages Functions. - `ProjectID string` - `AnalyticsEngineDatasets map[string, ProjectDeploymentConfigsProductionAnalyticsEngineDataset]` Analytics Engine bindings used for Pages Functions. - `Dataset string` Name of the dataset. - `Browsers map[string, ProjectDeploymentConfigsProductionBrowser]` Browser bindings used for Pages Functions. - `D1Databases map[string, ProjectDeploymentConfigsProductionD1Database]` D1 databases used for Pages Functions. - `ID string` UUID of the D1 database. - `DurableObjectNamespaces map[string, ProjectDeploymentConfigsProductionDurableObjectNamespace]` Durable Object namespaces used for Pages Functions. - `NamespaceID string` ID of the Durable Object namespace. - `HyperdriveBindings map[string, ProjectDeploymentConfigsProductionHyperdriveBinding]` Hyperdrive bindings used for Pages Functions. - `ID string` - `KVNamespaces map[string, ProjectDeploymentConfigsProductionKVNamespace]` KV namespaces used for Pages Functions. - `NamespaceID string` ID of the KV namespace. - `Limits ProjectDeploymentConfigsProductionLimits` Limits for Pages Functions. - `CPUMs int64` CPU time limit in milliseconds. - `MTLSCertificates map[string, ProjectDeploymentConfigsProductionMTLSCertificate]` mTLS bindings used for Pages Functions. - `CertificateID string` - `Placement ProjectDeploymentConfigsProductionPlacement` Placement setting used for Pages Functions. - `Mode string` Placement mode. - `QueueProducers map[string, ProjectDeploymentConfigsProductionQueueProducer]` Queue Producer bindings used for Pages Functions. - `Name string` Name of the Queue. - `R2Buckets map[string, ProjectDeploymentConfigsProductionR2Bucket]` R2 buckets used for Pages Functions. - `Name string` Name of the R2 bucket. - `Jurisdiction string` Jurisdiction of the R2 bucket. - `Services map[string, ProjectDeploymentConfigsProductionService]` Services used for Pages Functions. - `Environment string` The Service environment. - `Service string` The Service name. - `Entrypoint string` The entrypoint to bind to. - `VectorizeBindings map[string, ProjectDeploymentConfigsProductionVectorizeBinding]` Vectorize bindings used for Pages Functions. - `IndexName string` - `WranglerConfigHash string` Hash of the Wrangler configuration used for the deployment. - `Framework string` Framework the project is using. - `FrameworkVersion string` Version of the framework the project is using. - `LatestDeployment Deployment` Most recent deployment of the project. - `Name string` Name of the project. - `PreviewScriptName string` Name of the preview script. - `ProductionBranch string` Production branch of the project. Used to identify production deployments. - `ProductionScriptName string` Name of the production script. - `UsesFunctions bool` Whether the project uses functions. - `BuildConfig ProjectBuildConfig` Configs for the project build process. - `WebAnalyticsTag string` The classifying tag for analytics. - `WebAnalyticsToken string` The auth token for analytics. - `BuildCaching bool` Enable build caching for the project. - `BuildCommand string` Command used to build project. - `DestinationDir string` Assets output directory of the build. - `RootDir string` Directory to run the command. - `Domains []string` A list of associated custom domains for the project. - `Source ProjectSource` Configs for the project source control. - `Config ProjectSourceConfig` - `DeploymentsEnabled bool` Whether to enable automatic deployments when pushing to the source repository. When disabled, no deployments (production or preview) will be triggered automatically. - `Owner string` The owner of the repository. - `OwnerID string` The owner ID of the repository. - `PathExcludes []string` A list of paths that should be excluded from triggering a preview deployment. Wildcard syntax (`*`) is supported. - `PathIncludes []string` A list of paths that should be watched to trigger a preview deployment. Wildcard syntax (`*`) is supported. - `PrCommentsEnabled bool` Whether to enable PR comments. - `PreviewBranchExcludes []string` A list of branches that should not trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`. - `PreviewBranchIncludes []string` A list of branches that should trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`. - `PreviewDeploymentSetting ProjectSourceConfigPreviewDeploymentSetting` Controls whether commits to preview branches trigger a preview deployment. - `const ProjectSourceConfigPreviewDeploymentSettingAll ProjectSourceConfigPreviewDeploymentSetting = "all"` - `const ProjectSourceConfigPreviewDeploymentSettingNone ProjectSourceConfigPreviewDeploymentSetting = "none"` - `const ProjectSourceConfigPreviewDeploymentSettingCustom ProjectSourceConfigPreviewDeploymentSetting = "custom"` - `ProductionBranch string` The production branch of the repository. - `ProductionDeploymentsEnabled bool` Whether to trigger a production deployment on commits to the production branch. - `RepoID string` The ID of the repository. - `RepoName string` The name of the repository. - `Type ProjectSourceType` The source control management provider. - `const ProjectSourceTypeGitHub ProjectSourceType = "github"` - `const ProjectSourceTypeGitlab ProjectSourceType = "gitlab"` - `Subdomain string` The Cloudflare subdomain associated with the project. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/pages" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) project, err := client.Pages.Projects.New(context.TODO(), pages.ProjectNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Name: cloudflare.F("my-pages-app"), ProductionBranch: cloudflare.F("main"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", project.ID) } ``` #### Response ```json { "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": "7b162ea7-7367-4d67-bcde-1160995d5", "canonical_deployment": { "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", "uses_functions": true }, "created_on": "2017-01-01T00:00:00Z", "deployment_configs": { "preview": { "always_use_latest_compatibility_date": false, "build_image_major_version": 3, "compatibility_date": "2025-01-01", "compatibility_flags": [ "url_standard" ], "env_vars": { "foo": { "type": "plain_text", "value": "hello world" } }, "fail_open": true, "usage_model": "standard", "ai_bindings": { "AI_BINDING": { "project_id": "some-project-id" } }, "analytics_engine_datasets": { "ANALYTICS_ENGINE_BINDING": { "dataset": "api_analytics" } }, "browsers": { "BROWSER": {} }, "d1_databases": { "D1_BINDING": { "id": "445e2955-951a-43f8-a35b-a4d0c8138f63" } }, "durable_object_namespaces": { "DO_BINDING": { "namespace_id": "5eb63bbbe01eeed093cb22bb8f5acdc3" } }, "hyperdrive_bindings": { "HYPERDRIVE": { "id": "a76a99bc342644deb02c38d66082262a" } }, "kv_namespaces": { "KV_BINDING": { "namespace_id": "5eb63bbbe01eeed093cb22bb8f5acdc3" } }, "limits": { "cpu_ms": 100 }, "mtls_certificates": { "MTLS": { "certificate_id": "d7cdd17c-916f-4cb7-aabe-585eb382ec4e" } }, "placement": { "mode": "smart" }, "queue_producers": { "QUEUE_PRODUCER_BINDING": { "name": "some-queue" } }, "r2_buckets": { "R2_BINDING": { "name": "some-bucket", "jurisdiction": "eu" } }, "services": { "SERVICE_BINDING": { "environment": "production", "service": "example-worker", "entrypoint": "MyHandler" } }, "vectorize_bindings": { "VECTORIZE": { "index_name": "my_index" } }, "wrangler_config_hash": "abc123def456" }, "production": { "always_use_latest_compatibility_date": false, "build_image_major_version": 3, "compatibility_date": "2025-01-01", "compatibility_flags": [ "url_standard" ], "env_vars": { "foo": { "type": "plain_text", "value": "hello world" } }, "fail_open": true, "usage_model": "standard", "ai_bindings": { "AI_BINDING": { "project_id": "some-project-id" } }, "analytics_engine_datasets": { "ANALYTICS_ENGINE_BINDING": { "dataset": "api_analytics" } }, "browsers": { "BROWSER": {} }, "d1_databases": { "D1_BINDING": { "id": "445e2955-951a-43f8-a35b-a4d0c8138f63" } }, "durable_object_namespaces": { "DO_BINDING": { "namespace_id": "5eb63bbbe01eeed093cb22bb8f5acdc3" } }, "hyperdrive_bindings": { "HYPERDRIVE": { "id": "a76a99bc342644deb02c38d66082262a" } }, "kv_namespaces": { "KV_BINDING": { "namespace_id": "5eb63bbbe01eeed093cb22bb8f5acdc3" } }, "limits": { "cpu_ms": 100 }, "mtls_certificates": { "MTLS": { "certificate_id": "d7cdd17c-916f-4cb7-aabe-585eb382ec4e" } }, "placement": { "mode": "smart" }, "queue_producers": { "QUEUE_PRODUCER_BINDING": { "name": "some-queue" } }, "r2_buckets": { "R2_BINDING": { "name": "some-bucket", "jurisdiction": "eu" } }, "services": { "SERVICE_BINDING": { "environment": "production", "service": "example-worker", "entrypoint": "MyHandler" } }, "vectorize_bindings": { "VECTORIZE": { "index_name": "my_index" } }, "wrangler_config_hash": "abc123def456" } }, "framework": "framework", "framework_version": "framework_version", "latest_deployment": { "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", "uses_functions": true }, "name": "this-is-my-project-01", "preview_script_name": "pages-worker--1234567-preview", "production_branch": "main", "production_script_name": "pages-worker--1234567-production", "uses_functions": true, "build_config": { "web_analytics_tag": "cee1c73f6e4743d0b5e6bb1a0bcaabcc", "web_analytics_token": "021e1057c18547eca7b79f2516f06o7x", "build_caching": true, "build_command": "npm run build", "destination_dir": "build", "root_dir": "/" }, "domains": [ "customdomain.com", "customdomain.org" ], "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" }, "subdomain": "helloworld.pages.dev" }, "success": true } ``` ## Update project `client.Pages.Projects.Edit(ctx, projectName, params) (*Project, error)` **patch** `/accounts/{account_id}/pages/projects/{project_name}` Set new attributes for an existing project. Modify environment variables. To delete an environment variable, set the key to null. ### Parameters - `projectName string` Name of the project. - `params ProjectEditParams` - `AccountID param.Field[string]` Path param: Identifier. - `BuildConfig param.Field[ProjectEditParamsBuildConfig]` Body param: Configs for the project build process. - `BuildCaching bool` Enable build caching for the project. - `BuildCommand string` Command used to build project. - `DestinationDir string` Output directory of the build. - `RootDir string` Directory to run the command. - `WebAnalyticsTag string` The classifying tag for analytics. - `WebAnalyticsToken string` The auth token for analytics. - `DeploymentConfigs param.Field[ProjectEditParamsDeploymentConfigs]` Body param: Configs for deployments in a project. - `Preview ProjectEditParamsDeploymentConfigsPreview` Configs for preview deploys. - `AIBindings map[string, ProjectEditParamsDeploymentConfigsPreviewAIBindings]` Constellation bindings used for Pages Functions. - `ProjectID string` - `AlwaysUseLatestCompatibilityDate bool` Whether to always use the latest compatibility date for Pages Functions. - `AnalyticsEngineDatasets map[string, ProjectEditParamsDeploymentConfigsPreviewAnalyticsEngineDatasets]` Analytics Engine bindings used for Pages Functions. - `Dataset string` Name of the dataset. - `Browsers map[string, ProjectEditParamsDeploymentConfigsPreviewBrowsers]` Browser bindings used for Pages Functions. - `BuildImageMajorVersion int64` The major version of the build image to use for Pages Functions. - `CompatibilityDate string` Compatibility date used for Pages Functions. - `CompatibilityFlags []string` Compatibility flags used for Pages Functions. - `D1Databases map[string, ProjectEditParamsDeploymentConfigsPreviewD1Databases]` D1 databases used for Pages Functions. - `ID string` UUID of the D1 database. - `DurableObjectNamespaces map[string, ProjectEditParamsDeploymentConfigsPreviewDurableObjectNamespaces]` Durable Object namespaces used for Pages Functions. - `NamespaceID string` ID of the Durable Object namespace. - `EnvVars map[string, ProjectEditParamsDeploymentConfigsPreviewEnvVars]` Environment variables used for builds and Pages Functions. - `type ProjectEditParamsDeploymentConfigsPreviewEnvVarsPagesPlainTextEnvVar struct{…}` A plaintext environment variable. - `Type ProjectEditParamsDeploymentConfigsPreviewEnvVarsPagesPlainTextEnvVarType` - `const ProjectEditParamsDeploymentConfigsPreviewEnvVarsPagesPlainTextEnvVarTypePlainText ProjectEditParamsDeploymentConfigsPreviewEnvVarsPagesPlainTextEnvVarType = "plain_text"` - `Value string` Environment variable value. - `type ProjectEditParamsDeploymentConfigsPreviewEnvVarsPagesSecretTextEnvVar struct{…}` An encrypted environment variable. - `Type ProjectEditParamsDeploymentConfigsPreviewEnvVarsPagesSecretTextEnvVarType` - `const ProjectEditParamsDeploymentConfigsPreviewEnvVarsPagesSecretTextEnvVarTypeSecretText ProjectEditParamsDeploymentConfigsPreviewEnvVarsPagesSecretTextEnvVarType = "secret_text"` - `Value string` Secret value. - `FailOpen bool` Whether to fail open when the deployment config cannot be applied. - `HyperdriveBindings map[string, ProjectEditParamsDeploymentConfigsPreviewHyperdriveBindings]` Hyperdrive bindings used for Pages Functions. - `ID string` - `KVNamespaces map[string, ProjectEditParamsDeploymentConfigsPreviewKVNamespaces]` KV namespaces used for Pages Functions. - `NamespaceID string` ID of the KV namespace. - `Limits ProjectEditParamsDeploymentConfigsPreviewLimits` Limits for Pages Functions. - `CPUMs int64` CPU time limit in milliseconds. - `MTLSCertificates map[string, ProjectEditParamsDeploymentConfigsPreviewMTLSCertificates]` mTLS bindings used for Pages Functions. - `CertificateID string` - `Placement ProjectEditParamsDeploymentConfigsPreviewPlacement` Placement setting used for Pages Functions. - `Mode string` Placement mode. - `QueueProducers map[string, ProjectEditParamsDeploymentConfigsPreviewQueueProducers]` Queue Producer bindings used for Pages Functions. - `Name string` Name of the Queue. - `R2Buckets map[string, ProjectEditParamsDeploymentConfigsPreviewR2Buckets]` R2 buckets used for Pages Functions. - `Name string` Name of the R2 bucket. - `Jurisdiction string` Jurisdiction of the R2 bucket. - `Services map[string, ProjectEditParamsDeploymentConfigsPreviewServices]` Services used for Pages Functions. - `Service string` The Service name. - `Entrypoint string` The entrypoint to bind to. - `Environment string` The Service environment. - `UsageModel ProjectEditParamsDeploymentConfigsPreviewUsageModel` The usage model for Pages Functions. - `const ProjectEditParamsDeploymentConfigsPreviewUsageModelStandard ProjectEditParamsDeploymentConfigsPreviewUsageModel = "standard"` - `const ProjectEditParamsDeploymentConfigsPreviewUsageModelBundled ProjectEditParamsDeploymentConfigsPreviewUsageModel = "bundled"` - `const ProjectEditParamsDeploymentConfigsPreviewUsageModelUnbound ProjectEditParamsDeploymentConfigsPreviewUsageModel = "unbound"` - `VectorizeBindings map[string, ProjectEditParamsDeploymentConfigsPreviewVectorizeBindings]` Vectorize bindings used for Pages Functions. - `IndexName string` - `WranglerConfigHash string` Hash of the Wrangler configuration used for the deployment. - `Production ProjectEditParamsDeploymentConfigsProduction` Configs for production deploys. - `AIBindings map[string, ProjectEditParamsDeploymentConfigsProductionAIBindings]` Constellation bindings used for Pages Functions. - `ProjectID string` - `AlwaysUseLatestCompatibilityDate bool` Whether to always use the latest compatibility date for Pages Functions. - `AnalyticsEngineDatasets map[string, ProjectEditParamsDeploymentConfigsProductionAnalyticsEngineDatasets]` Analytics Engine bindings used for Pages Functions. - `Dataset string` Name of the dataset. - `Browsers map[string, ProjectEditParamsDeploymentConfigsProductionBrowsers]` Browser bindings used for Pages Functions. - `BuildImageMajorVersion int64` The major version of the build image to use for Pages Functions. - `CompatibilityDate string` Compatibility date used for Pages Functions. - `CompatibilityFlags []string` Compatibility flags used for Pages Functions. - `D1Databases map[string, ProjectEditParamsDeploymentConfigsProductionD1Databases]` D1 databases used for Pages Functions. - `ID string` UUID of the D1 database. - `DurableObjectNamespaces map[string, ProjectEditParamsDeploymentConfigsProductionDurableObjectNamespaces]` Durable Object namespaces used for Pages Functions. - `NamespaceID string` ID of the Durable Object namespace. - `EnvVars map[string, ProjectEditParamsDeploymentConfigsProductionEnvVars]` Environment variables used for builds and Pages Functions. - `type ProjectEditParamsDeploymentConfigsProductionEnvVarsPagesPlainTextEnvVar struct{…}` A plaintext environment variable. - `Type ProjectEditParamsDeploymentConfigsProductionEnvVarsPagesPlainTextEnvVarType` - `const ProjectEditParamsDeploymentConfigsProductionEnvVarsPagesPlainTextEnvVarTypePlainText ProjectEditParamsDeploymentConfigsProductionEnvVarsPagesPlainTextEnvVarType = "plain_text"` - `Value string` Environment variable value. - `type ProjectEditParamsDeploymentConfigsProductionEnvVarsPagesSecretTextEnvVar struct{…}` An encrypted environment variable. - `Type ProjectEditParamsDeploymentConfigsProductionEnvVarsPagesSecretTextEnvVarType` - `const ProjectEditParamsDeploymentConfigsProductionEnvVarsPagesSecretTextEnvVarTypeSecretText ProjectEditParamsDeploymentConfigsProductionEnvVarsPagesSecretTextEnvVarType = "secret_text"` - `Value string` Secret value. - `FailOpen bool` Whether to fail open when the deployment config cannot be applied. - `HyperdriveBindings map[string, ProjectEditParamsDeploymentConfigsProductionHyperdriveBindings]` Hyperdrive bindings used for Pages Functions. - `ID string` - `KVNamespaces map[string, ProjectEditParamsDeploymentConfigsProductionKVNamespaces]` KV namespaces used for Pages Functions. - `NamespaceID string` ID of the KV namespace. - `Limits ProjectEditParamsDeploymentConfigsProductionLimits` Limits for Pages Functions. - `CPUMs int64` CPU time limit in milliseconds. - `MTLSCertificates map[string, ProjectEditParamsDeploymentConfigsProductionMTLSCertificates]` mTLS bindings used for Pages Functions. - `CertificateID string` - `Placement ProjectEditParamsDeploymentConfigsProductionPlacement` Placement setting used for Pages Functions. - `Mode string` Placement mode. - `QueueProducers map[string, ProjectEditParamsDeploymentConfigsProductionQueueProducers]` Queue Producer bindings used for Pages Functions. - `Name string` Name of the Queue. - `R2Buckets map[string, ProjectEditParamsDeploymentConfigsProductionR2Buckets]` R2 buckets used for Pages Functions. - `Name string` Name of the R2 bucket. - `Jurisdiction string` Jurisdiction of the R2 bucket. - `Services map[string, ProjectEditParamsDeploymentConfigsProductionServices]` Services used for Pages Functions. - `Service string` The Service name. - `Entrypoint string` The entrypoint to bind to. - `Environment string` The Service environment. - `UsageModel ProjectEditParamsDeploymentConfigsProductionUsageModel` The usage model for Pages Functions. - `const ProjectEditParamsDeploymentConfigsProductionUsageModelStandard ProjectEditParamsDeploymentConfigsProductionUsageModel = "standard"` - `const ProjectEditParamsDeploymentConfigsProductionUsageModelBundled ProjectEditParamsDeploymentConfigsProductionUsageModel = "bundled"` - `const ProjectEditParamsDeploymentConfigsProductionUsageModelUnbound ProjectEditParamsDeploymentConfigsProductionUsageModel = "unbound"` - `VectorizeBindings map[string, ProjectEditParamsDeploymentConfigsProductionVectorizeBindings]` Vectorize bindings used for Pages Functions. - `IndexName string` - `WranglerConfigHash string` Hash of the Wrangler configuration used for the deployment. - `Name param.Field[string]` Body param: Name of the project. - `ProductionBranch param.Field[string]` Body param: Production branch of the project. Used to identify production deployments. - `Source param.Field[ProjectEditParamsSource]` Body param: Configs for the project source control. - `Config ProjectEditParamsSourceConfig` - `DeploymentsEnabled bool` Whether to enable automatic deployments when pushing to the source repository. When disabled, no deployments (production or preview) will be triggered automatically. - `Owner string` The owner of the repository. - `OwnerID string` The owner ID of the repository. - `PathExcludes []string` A list of paths that should be excluded from triggering a preview deployment. Wildcard syntax (`*`) is supported. - `PathIncludes []string` A list of paths that should be watched to trigger a preview deployment. Wildcard syntax (`*`) is supported. - `PrCommentsEnabled bool` Whether to enable PR comments. - `PreviewBranchExcludes []string` A list of branches that should not trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`. - `PreviewBranchIncludes []string` A list of branches that should trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`. - `PreviewDeploymentSetting ProjectEditParamsSourceConfigPreviewDeploymentSetting` Controls whether commits to preview branches trigger a preview deployment. - `const ProjectEditParamsSourceConfigPreviewDeploymentSettingAll ProjectEditParamsSourceConfigPreviewDeploymentSetting = "all"` - `const ProjectEditParamsSourceConfigPreviewDeploymentSettingNone ProjectEditParamsSourceConfigPreviewDeploymentSetting = "none"` - `const ProjectEditParamsSourceConfigPreviewDeploymentSettingCustom ProjectEditParamsSourceConfigPreviewDeploymentSetting = "custom"` - `ProductionBranch string` The production branch of the repository. - `ProductionDeploymentsEnabled bool` Whether to trigger a production deployment on commits to the production branch. - `RepoID string` The ID of the repository. - `RepoName string` The name of the repository. - `Type ProjectEditParamsSourceType` The source control management provider. - `const ProjectEditParamsSourceTypeGitHub ProjectEditParamsSourceType = "github"` - `const ProjectEditParamsSourceTypeGitlab ProjectEditParamsSourceType = "gitlab"` ### Returns - `type Project struct{…}` - `ID string` ID of the project. - `CanonicalDeployment Deployment` Most recent production deployment of the project. - `ID string` Id of the deployment. - `Aliases []string` A list of alias URLs pointing to this deployment. - `BuildConfig DeploymentBuildConfig` Configs for the project build process. - `WebAnalyticsTag string` The classifying tag for analytics. - `WebAnalyticsToken string` The auth token for analytics. - `BuildCaching bool` Enable build caching for the project. - `BuildCommand string` Command used to build project. - `DestinationDir string` Assets output directory of the build. - `RootDir string` Directory to run the command. - `CreatedOn Time` When the deployment was created. - `DeploymentTrigger DeploymentDeploymentTrigger` Info about what caused the deployment. - `Metadata DeploymentDeploymentTriggerMetadata` Additional info about the trigger. - `Branch string` Where the trigger happened. - `CommitDirty bool` Whether the deployment trigger commit was dirty. - `CommitHash string` Hash of the deployment trigger commit. - `CommitMessage string` Message of the deployment trigger commit. - `Type DeploymentDeploymentTriggerType` What caused the deployment. - `const DeploymentDeploymentTriggerTypeGitHubPush DeploymentDeploymentTriggerType = "github:push"` - `const DeploymentDeploymentTriggerTypeADHoc DeploymentDeploymentTriggerType = "ad_hoc"` - `const DeploymentDeploymentTriggerTypeDeployHook DeploymentDeploymentTriggerType = "deploy_hook"` - `EnvVars map[string, DeploymentEnvVar]` Environment variables used for builds and Pages Functions. - `type DeploymentEnvVarsPagesPlainTextEnvVar struct{…}` A plaintext environment variable. - `Type DeploymentEnvVarsPagesPlainTextEnvVarType` - `const DeploymentEnvVarsPagesPlainTextEnvVarTypePlainText DeploymentEnvVarsPagesPlainTextEnvVarType = "plain_text"` - `Value string` Environment variable value. - `type DeploymentEnvVarsPagesSecretTextEnvVar struct{…}` An encrypted environment variable. - `Type DeploymentEnvVarsPagesSecretTextEnvVarType` - `const DeploymentEnvVarsPagesSecretTextEnvVarTypeSecretText DeploymentEnvVarsPagesSecretTextEnvVarType = "secret_text"` - `Value string` Secret value. - `Environment DeploymentEnvironment` Type of deploy. - `const DeploymentEnvironmentPreview DeploymentEnvironment = "preview"` - `const DeploymentEnvironmentProduction DeploymentEnvironment = "production"` - `IsSkipped bool` If the deployment has been skipped. - `LatestStage Stage` The status of the deployment. - `EndedOn Time` When the stage ended. - `Name StageName` The current build stage. - `const StageNameQueued StageName = "queued"` - `const StageNameInitialize StageName = "initialize"` - `const StageNameCloneRepo StageName = "clone_repo"` - `const StageNameBuild StageName = "build"` - `const StageNameDeploy StageName = "deploy"` - `StartedOn Time` When the stage started. - `Status StageStatus` State of the current stage. - `const StageStatusSuccess StageStatus = "success"` - `const StageStatusIdle StageStatus = "idle"` - `const StageStatusActive StageStatus = "active"` - `const StageStatusFailure StageStatus = "failure"` - `const StageStatusCanceled StageStatus = "canceled"` - `ModifiedOn Time` When the deployment was last modified. - `ProjectID string` Id of the project. - `ProjectName string` Name of the project. - `ShortID string` Short Id (8 character) of the deployment. - `Source DeploymentSource` Configs for the project source control. - `Config DeploymentSourceConfig` - `DeploymentsEnabled bool` Whether to enable automatic deployments when pushing to the source repository. When disabled, no deployments (production or preview) will be triggered automatically. - `Owner string` The owner of the repository. - `OwnerID string` The owner ID of the repository. - `PathExcludes []string` A list of paths that should be excluded from triggering a preview deployment. Wildcard syntax (`*`) is supported. - `PathIncludes []string` A list of paths that should be watched to trigger a preview deployment. Wildcard syntax (`*`) is supported. - `PrCommentsEnabled bool` Whether to enable PR comments. - `PreviewBranchExcludes []string` A list of branches that should not trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`. - `PreviewBranchIncludes []string` A list of branches that should trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`. - `PreviewDeploymentSetting DeploymentSourceConfigPreviewDeploymentSetting` Controls whether commits to preview branches trigger a preview deployment. - `const DeploymentSourceConfigPreviewDeploymentSettingAll DeploymentSourceConfigPreviewDeploymentSetting = "all"` - `const DeploymentSourceConfigPreviewDeploymentSettingNone DeploymentSourceConfigPreviewDeploymentSetting = "none"` - `const DeploymentSourceConfigPreviewDeploymentSettingCustom DeploymentSourceConfigPreviewDeploymentSetting = "custom"` - `ProductionBranch string` The production branch of the repository. - `ProductionDeploymentsEnabled bool` Whether to trigger a production deployment on commits to the production branch. - `RepoID string` The ID of the repository. - `RepoName string` The name of the repository. - `Type DeploymentSourceType` The source control management provider. - `const DeploymentSourceTypeGitHub DeploymentSourceType = "github"` - `const DeploymentSourceTypeGitlab DeploymentSourceType = "gitlab"` - `Stages []Stage` List of past stages. - `EndedOn Time` When the stage ended. - `Name StageName` The current build stage. - `StartedOn Time` When the stage started. - `Status StageStatus` State of the current stage. - `URL string` The live URL to view this deployment. - `UsesFunctions bool` Whether the deployment uses functions. - `CreatedOn Time` When the project was created. - `DeploymentConfigs ProjectDeploymentConfigs` Configs for deployments in a project. - `Preview ProjectDeploymentConfigsPreview` Configs for preview deploys. - `AlwaysUseLatestCompatibilityDate bool` Whether to always use the latest compatibility date for Pages Functions. - `BuildImageMajorVersion int64` The major version of the build image to use for Pages Functions. - `CompatibilityDate string` Compatibility date used for Pages Functions. - `CompatibilityFlags []string` Compatibility flags used for Pages Functions. - `EnvVars map[string, ProjectDeploymentConfigsPreviewEnvVar]` Environment variables used for builds and Pages Functions. - `type ProjectDeploymentConfigsPreviewEnvVarsPagesPlainTextEnvVar struct{…}` A plaintext environment variable. - `Type ProjectDeploymentConfigsPreviewEnvVarsPagesPlainTextEnvVarType` - `const ProjectDeploymentConfigsPreviewEnvVarsPagesPlainTextEnvVarTypePlainText ProjectDeploymentConfigsPreviewEnvVarsPagesPlainTextEnvVarType = "plain_text"` - `Value string` Environment variable value. - `type ProjectDeploymentConfigsPreviewEnvVarsPagesSecretTextEnvVar struct{…}` An encrypted environment variable. - `Type ProjectDeploymentConfigsPreviewEnvVarsPagesSecretTextEnvVarType` - `const ProjectDeploymentConfigsPreviewEnvVarsPagesSecretTextEnvVarTypeSecretText ProjectDeploymentConfigsPreviewEnvVarsPagesSecretTextEnvVarType = "secret_text"` - `Value string` Secret value. - `FailOpen bool` Whether to fail open when the deployment config cannot be applied. - `UsageModel ProjectDeploymentConfigsPreviewUsageModel` The usage model for Pages Functions. - `const ProjectDeploymentConfigsPreviewUsageModelStandard ProjectDeploymentConfigsPreviewUsageModel = "standard"` - `const ProjectDeploymentConfigsPreviewUsageModelBundled ProjectDeploymentConfigsPreviewUsageModel = "bundled"` - `const ProjectDeploymentConfigsPreviewUsageModelUnbound ProjectDeploymentConfigsPreviewUsageModel = "unbound"` - `AIBindings map[string, ProjectDeploymentConfigsPreviewAIBinding]` Constellation bindings used for Pages Functions. - `ProjectID string` - `AnalyticsEngineDatasets map[string, ProjectDeploymentConfigsPreviewAnalyticsEngineDataset]` Analytics Engine bindings used for Pages Functions. - `Dataset string` Name of the dataset. - `Browsers map[string, ProjectDeploymentConfigsPreviewBrowser]` Browser bindings used for Pages Functions. - `D1Databases map[string, ProjectDeploymentConfigsPreviewD1Database]` D1 databases used for Pages Functions. - `ID string` UUID of the D1 database. - `DurableObjectNamespaces map[string, ProjectDeploymentConfigsPreviewDurableObjectNamespace]` Durable Object namespaces used for Pages Functions. - `NamespaceID string` ID of the Durable Object namespace. - `HyperdriveBindings map[string, ProjectDeploymentConfigsPreviewHyperdriveBinding]` Hyperdrive bindings used for Pages Functions. - `ID string` - `KVNamespaces map[string, ProjectDeploymentConfigsPreviewKVNamespace]` KV namespaces used for Pages Functions. - `NamespaceID string` ID of the KV namespace. - `Limits ProjectDeploymentConfigsPreviewLimits` Limits for Pages Functions. - `CPUMs int64` CPU time limit in milliseconds. - `MTLSCertificates map[string, ProjectDeploymentConfigsPreviewMTLSCertificate]` mTLS bindings used for Pages Functions. - `CertificateID string` - `Placement ProjectDeploymentConfigsPreviewPlacement` Placement setting used for Pages Functions. - `Mode string` Placement mode. - `QueueProducers map[string, ProjectDeploymentConfigsPreviewQueueProducer]` Queue Producer bindings used for Pages Functions. - `Name string` Name of the Queue. - `R2Buckets map[string, ProjectDeploymentConfigsPreviewR2Bucket]` R2 buckets used for Pages Functions. - `Name string` Name of the R2 bucket. - `Jurisdiction string` Jurisdiction of the R2 bucket. - `Services map[string, ProjectDeploymentConfigsPreviewService]` Services used for Pages Functions. - `Environment string` The Service environment. - `Service string` The Service name. - `Entrypoint string` The entrypoint to bind to. - `VectorizeBindings map[string, ProjectDeploymentConfigsPreviewVectorizeBinding]` Vectorize bindings used for Pages Functions. - `IndexName string` - `WranglerConfigHash string` Hash of the Wrangler configuration used for the deployment. - `Production ProjectDeploymentConfigsProduction` Configs for production deploys. - `AlwaysUseLatestCompatibilityDate bool` Whether to always use the latest compatibility date for Pages Functions. - `BuildImageMajorVersion int64` The major version of the build image to use for Pages Functions. - `CompatibilityDate string` Compatibility date used for Pages Functions. - `CompatibilityFlags []string` Compatibility flags used for Pages Functions. - `EnvVars map[string, ProjectDeploymentConfigsProductionEnvVar]` Environment variables used for builds and Pages Functions. - `type ProjectDeploymentConfigsProductionEnvVarsPagesPlainTextEnvVar struct{…}` A plaintext environment variable. - `Type ProjectDeploymentConfigsProductionEnvVarsPagesPlainTextEnvVarType` - `const ProjectDeploymentConfigsProductionEnvVarsPagesPlainTextEnvVarTypePlainText ProjectDeploymentConfigsProductionEnvVarsPagesPlainTextEnvVarType = "plain_text"` - `Value string` Environment variable value. - `type ProjectDeploymentConfigsProductionEnvVarsPagesSecretTextEnvVar struct{…}` An encrypted environment variable. - `Type ProjectDeploymentConfigsProductionEnvVarsPagesSecretTextEnvVarType` - `const ProjectDeploymentConfigsProductionEnvVarsPagesSecretTextEnvVarTypeSecretText ProjectDeploymentConfigsProductionEnvVarsPagesSecretTextEnvVarType = "secret_text"` - `Value string` Secret value. - `FailOpen bool` Whether to fail open when the deployment config cannot be applied. - `UsageModel ProjectDeploymentConfigsProductionUsageModel` The usage model for Pages Functions. - `const ProjectDeploymentConfigsProductionUsageModelStandard ProjectDeploymentConfigsProductionUsageModel = "standard"` - `const ProjectDeploymentConfigsProductionUsageModelBundled ProjectDeploymentConfigsProductionUsageModel = "bundled"` - `const ProjectDeploymentConfigsProductionUsageModelUnbound ProjectDeploymentConfigsProductionUsageModel = "unbound"` - `AIBindings map[string, ProjectDeploymentConfigsProductionAIBinding]` Constellation bindings used for Pages Functions. - `ProjectID string` - `AnalyticsEngineDatasets map[string, ProjectDeploymentConfigsProductionAnalyticsEngineDataset]` Analytics Engine bindings used for Pages Functions. - `Dataset string` Name of the dataset. - `Browsers map[string, ProjectDeploymentConfigsProductionBrowser]` Browser bindings used for Pages Functions. - `D1Databases map[string, ProjectDeploymentConfigsProductionD1Database]` D1 databases used for Pages Functions. - `ID string` UUID of the D1 database. - `DurableObjectNamespaces map[string, ProjectDeploymentConfigsProductionDurableObjectNamespace]` Durable Object namespaces used for Pages Functions. - `NamespaceID string` ID of the Durable Object namespace. - `HyperdriveBindings map[string, ProjectDeploymentConfigsProductionHyperdriveBinding]` Hyperdrive bindings used for Pages Functions. - `ID string` - `KVNamespaces map[string, ProjectDeploymentConfigsProductionKVNamespace]` KV namespaces used for Pages Functions. - `NamespaceID string` ID of the KV namespace. - `Limits ProjectDeploymentConfigsProductionLimits` Limits for Pages Functions. - `CPUMs int64` CPU time limit in milliseconds. - `MTLSCertificates map[string, ProjectDeploymentConfigsProductionMTLSCertificate]` mTLS bindings used for Pages Functions. - `CertificateID string` - `Placement ProjectDeploymentConfigsProductionPlacement` Placement setting used for Pages Functions. - `Mode string` Placement mode. - `QueueProducers map[string, ProjectDeploymentConfigsProductionQueueProducer]` Queue Producer bindings used for Pages Functions. - `Name string` Name of the Queue. - `R2Buckets map[string, ProjectDeploymentConfigsProductionR2Bucket]` R2 buckets used for Pages Functions. - `Name string` Name of the R2 bucket. - `Jurisdiction string` Jurisdiction of the R2 bucket. - `Services map[string, ProjectDeploymentConfigsProductionService]` Services used for Pages Functions. - `Environment string` The Service environment. - `Service string` The Service name. - `Entrypoint string` The entrypoint to bind to. - `VectorizeBindings map[string, ProjectDeploymentConfigsProductionVectorizeBinding]` Vectorize bindings used for Pages Functions. - `IndexName string` - `WranglerConfigHash string` Hash of the Wrangler configuration used for the deployment. - `Framework string` Framework the project is using. - `FrameworkVersion string` Version of the framework the project is using. - `LatestDeployment Deployment` Most recent deployment of the project. - `Name string` Name of the project. - `PreviewScriptName string` Name of the preview script. - `ProductionBranch string` Production branch of the project. Used to identify production deployments. - `ProductionScriptName string` Name of the production script. - `UsesFunctions bool` Whether the project uses functions. - `BuildConfig ProjectBuildConfig` Configs for the project build process. - `WebAnalyticsTag string` The classifying tag for analytics. - `WebAnalyticsToken string` The auth token for analytics. - `BuildCaching bool` Enable build caching for the project. - `BuildCommand string` Command used to build project. - `DestinationDir string` Assets output directory of the build. - `RootDir string` Directory to run the command. - `Domains []string` A list of associated custom domains for the project. - `Source ProjectSource` Configs for the project source control. - `Config ProjectSourceConfig` - `DeploymentsEnabled bool` Whether to enable automatic deployments when pushing to the source repository. When disabled, no deployments (production or preview) will be triggered automatically. - `Owner string` The owner of the repository. - `OwnerID string` The owner ID of the repository. - `PathExcludes []string` A list of paths that should be excluded from triggering a preview deployment. Wildcard syntax (`*`) is supported. - `PathIncludes []string` A list of paths that should be watched to trigger a preview deployment. Wildcard syntax (`*`) is supported. - `PrCommentsEnabled bool` Whether to enable PR comments. - `PreviewBranchExcludes []string` A list of branches that should not trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`. - `PreviewBranchIncludes []string` A list of branches that should trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`. - `PreviewDeploymentSetting ProjectSourceConfigPreviewDeploymentSetting` Controls whether commits to preview branches trigger a preview deployment. - `const ProjectSourceConfigPreviewDeploymentSettingAll ProjectSourceConfigPreviewDeploymentSetting = "all"` - `const ProjectSourceConfigPreviewDeploymentSettingNone ProjectSourceConfigPreviewDeploymentSetting = "none"` - `const ProjectSourceConfigPreviewDeploymentSettingCustom ProjectSourceConfigPreviewDeploymentSetting = "custom"` - `ProductionBranch string` The production branch of the repository. - `ProductionDeploymentsEnabled bool` Whether to trigger a production deployment on commits to the production branch. - `RepoID string` The ID of the repository. - `RepoName string` The name of the repository. - `Type ProjectSourceType` The source control management provider. - `const ProjectSourceTypeGitHub ProjectSourceType = "github"` - `const ProjectSourceTypeGitlab ProjectSourceType = "gitlab"` - `Subdomain string` The Cloudflare subdomain associated with the project. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/pages" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) project, err := client.Pages.Projects.Edit( context.TODO(), "this-is-my-project-01", pages.ProjectEditParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", project.ID) } ``` #### Response ```json { "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": "7b162ea7-7367-4d67-bcde-1160995d5", "canonical_deployment": { "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", "uses_functions": true }, "created_on": "2017-01-01T00:00:00Z", "deployment_configs": { "preview": { "always_use_latest_compatibility_date": false, "build_image_major_version": 3, "compatibility_date": "2025-01-01", "compatibility_flags": [ "url_standard" ], "env_vars": { "foo": { "type": "plain_text", "value": "hello world" } }, "fail_open": true, "usage_model": "standard", "ai_bindings": { "AI_BINDING": { "project_id": "some-project-id" } }, "analytics_engine_datasets": { "ANALYTICS_ENGINE_BINDING": { "dataset": "api_analytics" } }, "browsers": { "BROWSER": {} }, "d1_databases": { "D1_BINDING": { "id": "445e2955-951a-43f8-a35b-a4d0c8138f63" } }, "durable_object_namespaces": { "DO_BINDING": { "namespace_id": "5eb63bbbe01eeed093cb22bb8f5acdc3" } }, "hyperdrive_bindings": { "HYPERDRIVE": { "id": "a76a99bc342644deb02c38d66082262a" } }, "kv_namespaces": { "KV_BINDING": { "namespace_id": "5eb63bbbe01eeed093cb22bb8f5acdc3" } }, "limits": { "cpu_ms": 100 }, "mtls_certificates": { "MTLS": { "certificate_id": "d7cdd17c-916f-4cb7-aabe-585eb382ec4e" } }, "placement": { "mode": "smart" }, "queue_producers": { "QUEUE_PRODUCER_BINDING": { "name": "some-queue" } }, "r2_buckets": { "R2_BINDING": { "name": "some-bucket", "jurisdiction": "eu" } }, "services": { "SERVICE_BINDING": { "environment": "production", "service": "example-worker", "entrypoint": "MyHandler" } }, "vectorize_bindings": { "VECTORIZE": { "index_name": "my_index" } }, "wrangler_config_hash": "abc123def456" }, "production": { "always_use_latest_compatibility_date": false, "build_image_major_version": 3, "compatibility_date": "2025-01-01", "compatibility_flags": [ "url_standard" ], "env_vars": { "foo": { "type": "plain_text", "value": "hello world" } }, "fail_open": true, "usage_model": "standard", "ai_bindings": { "AI_BINDING": { "project_id": "some-project-id" } }, "analytics_engine_datasets": { "ANALYTICS_ENGINE_BINDING": { "dataset": "api_analytics" } }, "browsers": { "BROWSER": {} }, "d1_databases": { "D1_BINDING": { "id": "445e2955-951a-43f8-a35b-a4d0c8138f63" } }, "durable_object_namespaces": { "DO_BINDING": { "namespace_id": "5eb63bbbe01eeed093cb22bb8f5acdc3" } }, "hyperdrive_bindings": { "HYPERDRIVE": { "id": "a76a99bc342644deb02c38d66082262a" } }, "kv_namespaces": { "KV_BINDING": { "namespace_id": "5eb63bbbe01eeed093cb22bb8f5acdc3" } }, "limits": { "cpu_ms": 100 }, "mtls_certificates": { "MTLS": { "certificate_id": "d7cdd17c-916f-4cb7-aabe-585eb382ec4e" } }, "placement": { "mode": "smart" }, "queue_producers": { "QUEUE_PRODUCER_BINDING": { "name": "some-queue" } }, "r2_buckets": { "R2_BINDING": { "name": "some-bucket", "jurisdiction": "eu" } }, "services": { "SERVICE_BINDING": { "environment": "production", "service": "example-worker", "entrypoint": "MyHandler" } }, "vectorize_bindings": { "VECTORIZE": { "index_name": "my_index" } }, "wrangler_config_hash": "abc123def456" } }, "framework": "framework", "framework_version": "framework_version", "latest_deployment": { "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", "uses_functions": true }, "name": "this-is-my-project-01", "preview_script_name": "pages-worker--1234567-preview", "production_branch": "main", "production_script_name": "pages-worker--1234567-production", "uses_functions": true, "build_config": { "web_analytics_tag": "cee1c73f6e4743d0b5e6bb1a0bcaabcc", "web_analytics_token": "021e1057c18547eca7b79f2516f06o7x", "build_caching": true, "build_command": "npm run build", "destination_dir": "build", "root_dir": "/" }, "domains": [ "customdomain.com", "customdomain.org" ], "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" }, "subdomain": "helloworld.pages.dev" }, "success": true } ``` ## Delete project `client.Pages.Projects.Delete(ctx, projectName, body) (*ProjectDeleteResponse, error)` **delete** `/accounts/{account_id}/pages/projects/{project_name}` Delete a project by name. ### Parameters - `projectName string` Name of the project. - `body ProjectDeleteParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type ProjectDeleteResponse interface{…}` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/pages" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) project, err := client.Pages.Projects.Delete( context.TODO(), "this-is-my-project-01", pages.ProjectDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", project) } ``` #### Response ```json { "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": {}, "success": true } ``` ## Purge build cache `client.Pages.Projects.PurgeBuildCache(ctx, projectName, body) (*ProjectPurgeBuildCacheResponse, error)` **post** `/accounts/{account_id}/pages/projects/{project_name}/purge_build_cache` Purge all cached build artifacts for a Pages project ### Parameters - `projectName string` Name of the project. - `body ProjectPurgeBuildCacheParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type ProjectPurgeBuildCacheResponse interface{…}` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/pages" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.Pages.Projects.PurgeBuildCache( context.TODO(), "this-is-my-project-01", pages.ProjectPurgeBuildCacheParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### Response ```json { "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": {}, "success": true } ``` ## Domain Types ### Deployment - `type Deployment struct{…}` - `ID string` Id of the deployment. - `Aliases []string` A list of alias URLs pointing to this deployment. - `BuildConfig DeploymentBuildConfig` Configs for the project build process. - `WebAnalyticsTag string` The classifying tag for analytics. - `WebAnalyticsToken string` The auth token for analytics. - `BuildCaching bool` Enable build caching for the project. - `BuildCommand string` Command used to build project. - `DestinationDir string` Assets output directory of the build. - `RootDir string` Directory to run the command. - `CreatedOn Time` When the deployment was created. - `DeploymentTrigger DeploymentDeploymentTrigger` Info about what caused the deployment. - `Metadata DeploymentDeploymentTriggerMetadata` Additional info about the trigger. - `Branch string` Where the trigger happened. - `CommitDirty bool` Whether the deployment trigger commit was dirty. - `CommitHash string` Hash of the deployment trigger commit. - `CommitMessage string` Message of the deployment trigger commit. - `Type DeploymentDeploymentTriggerType` What caused the deployment. - `const DeploymentDeploymentTriggerTypeGitHubPush DeploymentDeploymentTriggerType = "github:push"` - `const DeploymentDeploymentTriggerTypeADHoc DeploymentDeploymentTriggerType = "ad_hoc"` - `const DeploymentDeploymentTriggerTypeDeployHook DeploymentDeploymentTriggerType = "deploy_hook"` - `EnvVars map[string, DeploymentEnvVar]` Environment variables used for builds and Pages Functions. - `type DeploymentEnvVarsPagesPlainTextEnvVar struct{…}` A plaintext environment variable. - `Type DeploymentEnvVarsPagesPlainTextEnvVarType` - `const DeploymentEnvVarsPagesPlainTextEnvVarTypePlainText DeploymentEnvVarsPagesPlainTextEnvVarType = "plain_text"` - `Value string` Environment variable value. - `type DeploymentEnvVarsPagesSecretTextEnvVar struct{…}` An encrypted environment variable. - `Type DeploymentEnvVarsPagesSecretTextEnvVarType` - `const DeploymentEnvVarsPagesSecretTextEnvVarTypeSecretText DeploymentEnvVarsPagesSecretTextEnvVarType = "secret_text"` - `Value string` Secret value. - `Environment DeploymentEnvironment` Type of deploy. - `const DeploymentEnvironmentPreview DeploymentEnvironment = "preview"` - `const DeploymentEnvironmentProduction DeploymentEnvironment = "production"` - `IsSkipped bool` If the deployment has been skipped. - `LatestStage Stage` The status of the deployment. - `EndedOn Time` When the stage ended. - `Name StageName` The current build stage. - `const StageNameQueued StageName = "queued"` - `const StageNameInitialize StageName = "initialize"` - `const StageNameCloneRepo StageName = "clone_repo"` - `const StageNameBuild StageName = "build"` - `const StageNameDeploy StageName = "deploy"` - `StartedOn Time` When the stage started. - `Status StageStatus` State of the current stage. - `const StageStatusSuccess StageStatus = "success"` - `const StageStatusIdle StageStatus = "idle"` - `const StageStatusActive StageStatus = "active"` - `const StageStatusFailure StageStatus = "failure"` - `const StageStatusCanceled StageStatus = "canceled"` - `ModifiedOn Time` When the deployment was last modified. - `ProjectID string` Id of the project. - `ProjectName string` Name of the project. - `ShortID string` Short Id (8 character) of the deployment. - `Source DeploymentSource` Configs for the project source control. - `Config DeploymentSourceConfig` - `DeploymentsEnabled bool` Whether to enable automatic deployments when pushing to the source repository. When disabled, no deployments (production or preview) will be triggered automatically. - `Owner string` The owner of the repository. - `OwnerID string` The owner ID of the repository. - `PathExcludes []string` A list of paths that should be excluded from triggering a preview deployment. Wildcard syntax (`*`) is supported. - `PathIncludes []string` A list of paths that should be watched to trigger a preview deployment. Wildcard syntax (`*`) is supported. - `PrCommentsEnabled bool` Whether to enable PR comments. - `PreviewBranchExcludes []string` A list of branches that should not trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`. - `PreviewBranchIncludes []string` A list of branches that should trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`. - `PreviewDeploymentSetting DeploymentSourceConfigPreviewDeploymentSetting` Controls whether commits to preview branches trigger a preview deployment. - `const DeploymentSourceConfigPreviewDeploymentSettingAll DeploymentSourceConfigPreviewDeploymentSetting = "all"` - `const DeploymentSourceConfigPreviewDeploymentSettingNone DeploymentSourceConfigPreviewDeploymentSetting = "none"` - `const DeploymentSourceConfigPreviewDeploymentSettingCustom DeploymentSourceConfigPreviewDeploymentSetting = "custom"` - `ProductionBranch string` The production branch of the repository. - `ProductionDeploymentsEnabled bool` Whether to trigger a production deployment on commits to the production branch. - `RepoID string` The ID of the repository. - `RepoName string` The name of the repository. - `Type DeploymentSourceType` The source control management provider. - `const DeploymentSourceTypeGitHub DeploymentSourceType = "github"` - `const DeploymentSourceTypeGitlab DeploymentSourceType = "gitlab"` - `Stages []Stage` List of past stages. - `EndedOn Time` When the stage ended. - `Name StageName` The current build stage. - `StartedOn Time` When the stage started. - `Status StageStatus` State of the current stage. - `URL string` The live URL to view this deployment. - `UsesFunctions bool` Whether the deployment uses functions. ### Project - `type Project struct{…}` - `ID string` ID of the project. - `CanonicalDeployment Deployment` Most recent production deployment of the project. - `ID string` Id of the deployment. - `Aliases []string` A list of alias URLs pointing to this deployment. - `BuildConfig DeploymentBuildConfig` Configs for the project build process. - `WebAnalyticsTag string` The classifying tag for analytics. - `WebAnalyticsToken string` The auth token for analytics. - `BuildCaching bool` Enable build caching for the project. - `BuildCommand string` Command used to build project. - `DestinationDir string` Assets output directory of the build. - `RootDir string` Directory to run the command. - `CreatedOn Time` When the deployment was created. - `DeploymentTrigger DeploymentDeploymentTrigger` Info about what caused the deployment. - `Metadata DeploymentDeploymentTriggerMetadata` Additional info about the trigger. - `Branch string` Where the trigger happened. - `CommitDirty bool` Whether the deployment trigger commit was dirty. - `CommitHash string` Hash of the deployment trigger commit. - `CommitMessage string` Message of the deployment trigger commit. - `Type DeploymentDeploymentTriggerType` What caused the deployment. - `const DeploymentDeploymentTriggerTypeGitHubPush DeploymentDeploymentTriggerType = "github:push"` - `const DeploymentDeploymentTriggerTypeADHoc DeploymentDeploymentTriggerType = "ad_hoc"` - `const DeploymentDeploymentTriggerTypeDeployHook DeploymentDeploymentTriggerType = "deploy_hook"` - `EnvVars map[string, DeploymentEnvVar]` Environment variables used for builds and Pages Functions. - `type DeploymentEnvVarsPagesPlainTextEnvVar struct{…}` A plaintext environment variable. - `Type DeploymentEnvVarsPagesPlainTextEnvVarType` - `const DeploymentEnvVarsPagesPlainTextEnvVarTypePlainText DeploymentEnvVarsPagesPlainTextEnvVarType = "plain_text"` - `Value string` Environment variable value. - `type DeploymentEnvVarsPagesSecretTextEnvVar struct{…}` An encrypted environment variable. - `Type DeploymentEnvVarsPagesSecretTextEnvVarType` - `const DeploymentEnvVarsPagesSecretTextEnvVarTypeSecretText DeploymentEnvVarsPagesSecretTextEnvVarType = "secret_text"` - `Value string` Secret value. - `Environment DeploymentEnvironment` Type of deploy. - `const DeploymentEnvironmentPreview DeploymentEnvironment = "preview"` - `const DeploymentEnvironmentProduction DeploymentEnvironment = "production"` - `IsSkipped bool` If the deployment has been skipped. - `LatestStage Stage` The status of the deployment. - `EndedOn Time` When the stage ended. - `Name StageName` The current build stage. - `const StageNameQueued StageName = "queued"` - `const StageNameInitialize StageName = "initialize"` - `const StageNameCloneRepo StageName = "clone_repo"` - `const StageNameBuild StageName = "build"` - `const StageNameDeploy StageName = "deploy"` - `StartedOn Time` When the stage started. - `Status StageStatus` State of the current stage. - `const StageStatusSuccess StageStatus = "success"` - `const StageStatusIdle StageStatus = "idle"` - `const StageStatusActive StageStatus = "active"` - `const StageStatusFailure StageStatus = "failure"` - `const StageStatusCanceled StageStatus = "canceled"` - `ModifiedOn Time` When the deployment was last modified. - `ProjectID string` Id of the project. - `ProjectName string` Name of the project. - `ShortID string` Short Id (8 character) of the deployment. - `Source DeploymentSource` Configs for the project source control. - `Config DeploymentSourceConfig` - `DeploymentsEnabled bool` Whether to enable automatic deployments when pushing to the source repository. When disabled, no deployments (production or preview) will be triggered automatically. - `Owner string` The owner of the repository. - `OwnerID string` The owner ID of the repository. - `PathExcludes []string` A list of paths that should be excluded from triggering a preview deployment. Wildcard syntax (`*`) is supported. - `PathIncludes []string` A list of paths that should be watched to trigger a preview deployment. Wildcard syntax (`*`) is supported. - `PrCommentsEnabled bool` Whether to enable PR comments. - `PreviewBranchExcludes []string` A list of branches that should not trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`. - `PreviewBranchIncludes []string` A list of branches that should trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`. - `PreviewDeploymentSetting DeploymentSourceConfigPreviewDeploymentSetting` Controls whether commits to preview branches trigger a preview deployment. - `const DeploymentSourceConfigPreviewDeploymentSettingAll DeploymentSourceConfigPreviewDeploymentSetting = "all"` - `const DeploymentSourceConfigPreviewDeploymentSettingNone DeploymentSourceConfigPreviewDeploymentSetting = "none"` - `const DeploymentSourceConfigPreviewDeploymentSettingCustom DeploymentSourceConfigPreviewDeploymentSetting = "custom"` - `ProductionBranch string` The production branch of the repository. - `ProductionDeploymentsEnabled bool` Whether to trigger a production deployment on commits to the production branch. - `RepoID string` The ID of the repository. - `RepoName string` The name of the repository. - `Type DeploymentSourceType` The source control management provider. - `const DeploymentSourceTypeGitHub DeploymentSourceType = "github"` - `const DeploymentSourceTypeGitlab DeploymentSourceType = "gitlab"` - `Stages []Stage` List of past stages. - `EndedOn Time` When the stage ended. - `Name StageName` The current build stage. - `StartedOn Time` When the stage started. - `Status StageStatus` State of the current stage. - `URL string` The live URL to view this deployment. - `UsesFunctions bool` Whether the deployment uses functions. - `CreatedOn Time` When the project was created. - `DeploymentConfigs ProjectDeploymentConfigs` Configs for deployments in a project. - `Preview ProjectDeploymentConfigsPreview` Configs for preview deploys. - `AlwaysUseLatestCompatibilityDate bool` Whether to always use the latest compatibility date for Pages Functions. - `BuildImageMajorVersion int64` The major version of the build image to use for Pages Functions. - `CompatibilityDate string` Compatibility date used for Pages Functions. - `CompatibilityFlags []string` Compatibility flags used for Pages Functions. - `EnvVars map[string, ProjectDeploymentConfigsPreviewEnvVar]` Environment variables used for builds and Pages Functions. - `type ProjectDeploymentConfigsPreviewEnvVarsPagesPlainTextEnvVar struct{…}` A plaintext environment variable. - `Type ProjectDeploymentConfigsPreviewEnvVarsPagesPlainTextEnvVarType` - `const ProjectDeploymentConfigsPreviewEnvVarsPagesPlainTextEnvVarTypePlainText ProjectDeploymentConfigsPreviewEnvVarsPagesPlainTextEnvVarType = "plain_text"` - `Value string` Environment variable value. - `type ProjectDeploymentConfigsPreviewEnvVarsPagesSecretTextEnvVar struct{…}` An encrypted environment variable. - `Type ProjectDeploymentConfigsPreviewEnvVarsPagesSecretTextEnvVarType` - `const ProjectDeploymentConfigsPreviewEnvVarsPagesSecretTextEnvVarTypeSecretText ProjectDeploymentConfigsPreviewEnvVarsPagesSecretTextEnvVarType = "secret_text"` - `Value string` Secret value. - `FailOpen bool` Whether to fail open when the deployment config cannot be applied. - `UsageModel ProjectDeploymentConfigsPreviewUsageModel` The usage model for Pages Functions. - `const ProjectDeploymentConfigsPreviewUsageModelStandard ProjectDeploymentConfigsPreviewUsageModel = "standard"` - `const ProjectDeploymentConfigsPreviewUsageModelBundled ProjectDeploymentConfigsPreviewUsageModel = "bundled"` - `const ProjectDeploymentConfigsPreviewUsageModelUnbound ProjectDeploymentConfigsPreviewUsageModel = "unbound"` - `AIBindings map[string, ProjectDeploymentConfigsPreviewAIBinding]` Constellation bindings used for Pages Functions. - `ProjectID string` - `AnalyticsEngineDatasets map[string, ProjectDeploymentConfigsPreviewAnalyticsEngineDataset]` Analytics Engine bindings used for Pages Functions. - `Dataset string` Name of the dataset. - `Browsers map[string, ProjectDeploymentConfigsPreviewBrowser]` Browser bindings used for Pages Functions. - `D1Databases map[string, ProjectDeploymentConfigsPreviewD1Database]` D1 databases used for Pages Functions. - `ID string` UUID of the D1 database. - `DurableObjectNamespaces map[string, ProjectDeploymentConfigsPreviewDurableObjectNamespace]` Durable Object namespaces used for Pages Functions. - `NamespaceID string` ID of the Durable Object namespace. - `HyperdriveBindings map[string, ProjectDeploymentConfigsPreviewHyperdriveBinding]` Hyperdrive bindings used for Pages Functions. - `ID string` - `KVNamespaces map[string, ProjectDeploymentConfigsPreviewKVNamespace]` KV namespaces used for Pages Functions. - `NamespaceID string` ID of the KV namespace. - `Limits ProjectDeploymentConfigsPreviewLimits` Limits for Pages Functions. - `CPUMs int64` CPU time limit in milliseconds. - `MTLSCertificates map[string, ProjectDeploymentConfigsPreviewMTLSCertificate]` mTLS bindings used for Pages Functions. - `CertificateID string` - `Placement ProjectDeploymentConfigsPreviewPlacement` Placement setting used for Pages Functions. - `Mode string` Placement mode. - `QueueProducers map[string, ProjectDeploymentConfigsPreviewQueueProducer]` Queue Producer bindings used for Pages Functions. - `Name string` Name of the Queue. - `R2Buckets map[string, ProjectDeploymentConfigsPreviewR2Bucket]` R2 buckets used for Pages Functions. - `Name string` Name of the R2 bucket. - `Jurisdiction string` Jurisdiction of the R2 bucket. - `Services map[string, ProjectDeploymentConfigsPreviewService]` Services used for Pages Functions. - `Environment string` The Service environment. - `Service string` The Service name. - `Entrypoint string` The entrypoint to bind to. - `VectorizeBindings map[string, ProjectDeploymentConfigsPreviewVectorizeBinding]` Vectorize bindings used for Pages Functions. - `IndexName string` - `WranglerConfigHash string` Hash of the Wrangler configuration used for the deployment. - `Production ProjectDeploymentConfigsProduction` Configs for production deploys. - `AlwaysUseLatestCompatibilityDate bool` Whether to always use the latest compatibility date for Pages Functions. - `BuildImageMajorVersion int64` The major version of the build image to use for Pages Functions. - `CompatibilityDate string` Compatibility date used for Pages Functions. - `CompatibilityFlags []string` Compatibility flags used for Pages Functions. - `EnvVars map[string, ProjectDeploymentConfigsProductionEnvVar]` Environment variables used for builds and Pages Functions. - `type ProjectDeploymentConfigsProductionEnvVarsPagesPlainTextEnvVar struct{…}` A plaintext environment variable. - `Type ProjectDeploymentConfigsProductionEnvVarsPagesPlainTextEnvVarType` - `const ProjectDeploymentConfigsProductionEnvVarsPagesPlainTextEnvVarTypePlainText ProjectDeploymentConfigsProductionEnvVarsPagesPlainTextEnvVarType = "plain_text"` - `Value string` Environment variable value. - `type ProjectDeploymentConfigsProductionEnvVarsPagesSecretTextEnvVar struct{…}` An encrypted environment variable. - `Type ProjectDeploymentConfigsProductionEnvVarsPagesSecretTextEnvVarType` - `const ProjectDeploymentConfigsProductionEnvVarsPagesSecretTextEnvVarTypeSecretText ProjectDeploymentConfigsProductionEnvVarsPagesSecretTextEnvVarType = "secret_text"` - `Value string` Secret value. - `FailOpen bool` Whether to fail open when the deployment config cannot be applied. - `UsageModel ProjectDeploymentConfigsProductionUsageModel` The usage model for Pages Functions. - `const ProjectDeploymentConfigsProductionUsageModelStandard ProjectDeploymentConfigsProductionUsageModel = "standard"` - `const ProjectDeploymentConfigsProductionUsageModelBundled ProjectDeploymentConfigsProductionUsageModel = "bundled"` - `const ProjectDeploymentConfigsProductionUsageModelUnbound ProjectDeploymentConfigsProductionUsageModel = "unbound"` - `AIBindings map[string, ProjectDeploymentConfigsProductionAIBinding]` Constellation bindings used for Pages Functions. - `ProjectID string` - `AnalyticsEngineDatasets map[string, ProjectDeploymentConfigsProductionAnalyticsEngineDataset]` Analytics Engine bindings used for Pages Functions. - `Dataset string` Name of the dataset. - `Browsers map[string, ProjectDeploymentConfigsProductionBrowser]` Browser bindings used for Pages Functions. - `D1Databases map[string, ProjectDeploymentConfigsProductionD1Database]` D1 databases used for Pages Functions. - `ID string` UUID of the D1 database. - `DurableObjectNamespaces map[string, ProjectDeploymentConfigsProductionDurableObjectNamespace]` Durable Object namespaces used for Pages Functions. - `NamespaceID string` ID of the Durable Object namespace. - `HyperdriveBindings map[string, ProjectDeploymentConfigsProductionHyperdriveBinding]` Hyperdrive bindings used for Pages Functions. - `ID string` - `KVNamespaces map[string, ProjectDeploymentConfigsProductionKVNamespace]` KV namespaces used for Pages Functions. - `NamespaceID string` ID of the KV namespace. - `Limits ProjectDeploymentConfigsProductionLimits` Limits for Pages Functions. - `CPUMs int64` CPU time limit in milliseconds. - `MTLSCertificates map[string, ProjectDeploymentConfigsProductionMTLSCertificate]` mTLS bindings used for Pages Functions. - `CertificateID string` - `Placement ProjectDeploymentConfigsProductionPlacement` Placement setting used for Pages Functions. - `Mode string` Placement mode. - `QueueProducers map[string, ProjectDeploymentConfigsProductionQueueProducer]` Queue Producer bindings used for Pages Functions. - `Name string` Name of the Queue. - `R2Buckets map[string, ProjectDeploymentConfigsProductionR2Bucket]` R2 buckets used for Pages Functions. - `Name string` Name of the R2 bucket. - `Jurisdiction string` Jurisdiction of the R2 bucket. - `Services map[string, ProjectDeploymentConfigsProductionService]` Services used for Pages Functions. - `Environment string` The Service environment. - `Service string` The Service name. - `Entrypoint string` The entrypoint to bind to. - `VectorizeBindings map[string, ProjectDeploymentConfigsProductionVectorizeBinding]` Vectorize bindings used for Pages Functions. - `IndexName string` - `WranglerConfigHash string` Hash of the Wrangler configuration used for the deployment. - `Framework string` Framework the project is using. - `FrameworkVersion string` Version of the framework the project is using. - `LatestDeployment Deployment` Most recent deployment of the project. - `Name string` Name of the project. - `PreviewScriptName string` Name of the preview script. - `ProductionBranch string` Production branch of the project. Used to identify production deployments. - `ProductionScriptName string` Name of the production script. - `UsesFunctions bool` Whether the project uses functions. - `BuildConfig ProjectBuildConfig` Configs for the project build process. - `WebAnalyticsTag string` The classifying tag for analytics. - `WebAnalyticsToken string` The auth token for analytics. - `BuildCaching bool` Enable build caching for the project. - `BuildCommand string` Command used to build project. - `DestinationDir string` Assets output directory of the build. - `RootDir string` Directory to run the command. - `Domains []string` A list of associated custom domains for the project. - `Source ProjectSource` Configs for the project source control. - `Config ProjectSourceConfig` - `DeploymentsEnabled bool` Whether to enable automatic deployments when pushing to the source repository. When disabled, no deployments (production or preview) will be triggered automatically. - `Owner string` The owner of the repository. - `OwnerID string` The owner ID of the repository. - `PathExcludes []string` A list of paths that should be excluded from triggering a preview deployment. Wildcard syntax (`*`) is supported. - `PathIncludes []string` A list of paths that should be watched to trigger a preview deployment. Wildcard syntax (`*`) is supported. - `PrCommentsEnabled bool` Whether to enable PR comments. - `PreviewBranchExcludes []string` A list of branches that should not trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`. - `PreviewBranchIncludes []string` A list of branches that should trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`. - `PreviewDeploymentSetting ProjectSourceConfigPreviewDeploymentSetting` Controls whether commits to preview branches trigger a preview deployment. - `const ProjectSourceConfigPreviewDeploymentSettingAll ProjectSourceConfigPreviewDeploymentSetting = "all"` - `const ProjectSourceConfigPreviewDeploymentSettingNone ProjectSourceConfigPreviewDeploymentSetting = "none"` - `const ProjectSourceConfigPreviewDeploymentSettingCustom ProjectSourceConfigPreviewDeploymentSetting = "custom"` - `ProductionBranch string` The production branch of the repository. - `ProductionDeploymentsEnabled bool` Whether to trigger a production deployment on commits to the production branch. - `RepoID string` The ID of the repository. - `RepoName string` The name of the repository. - `Type ProjectSourceType` The source control management provider. - `const ProjectSourceTypeGitHub ProjectSourceType = "github"` - `const ProjectSourceTypeGitlab ProjectSourceType = "gitlab"` - `Subdomain string` The Cloudflare subdomain associated with the project. ### Stage - `type Stage struct{…}` The status of the deployment. - `EndedOn Time` When the stage ended. - `Name StageName` The current build stage. - `const StageNameQueued StageName = "queued"` - `const StageNameInitialize StageName = "initialize"` - `const StageNameCloneRepo StageName = "clone_repo"` - `const StageNameBuild StageName = "build"` - `const StageNameDeploy StageName = "deploy"` - `StartedOn Time` When the stage started. - `Status StageStatus` State of the current stage. - `const StageStatusSuccess StageStatus = "success"` - `const StageStatusIdle StageStatus = "idle"` - `const StageStatusActive StageStatus = "active"` - `const StageStatusFailure StageStatus = "failure"` - `const StageStatusCanceled StageStatus = "canceled"` # Deployments ## Get deployments `client.Pages.Projects.Deployments.List(ctx, projectName, params) (*V4PagePaginationArray[Deployment], error)` **get** `/accounts/{account_id}/pages/projects/{project_name}/deployments` Fetch a list of project deployments. ### Parameters - `projectName string` Name of the project. - `params ProjectDeploymentListParams` - `AccountID param.Field[string]` Path param: Identifier. - `Env param.Field[ProjectDeploymentListParamsEnv]` Query param: What type of deployments to fetch. - `const ProjectDeploymentListParamsEnvProduction ProjectDeploymentListParamsEnv = "production"` - `const ProjectDeploymentListParamsEnvPreview ProjectDeploymentListParamsEnv = "preview"` - `Page param.Field[int64]` Query param: Which page of deployments to fetch. - `PerPage param.Field[int64]` Query param: How many deployments to return per page. ### Returns - `type Deployment struct{…}` - `ID string` Id of the deployment. - `Aliases []string` A list of alias URLs pointing to this deployment. - `BuildConfig DeploymentBuildConfig` Configs for the project build process. - `WebAnalyticsTag string` The classifying tag for analytics. - `WebAnalyticsToken string` The auth token for analytics. - `BuildCaching bool` Enable build caching for the project. - `BuildCommand string` Command used to build project. - `DestinationDir string` Assets output directory of the build. - `RootDir string` Directory to run the command. - `CreatedOn Time` When the deployment was created. - `DeploymentTrigger DeploymentDeploymentTrigger` Info about what caused the deployment. - `Metadata DeploymentDeploymentTriggerMetadata` Additional info about the trigger. - `Branch string` Where the trigger happened. - `CommitDirty bool` Whether the deployment trigger commit was dirty. - `CommitHash string` Hash of the deployment trigger commit. - `CommitMessage string` Message of the deployment trigger commit. - `Type DeploymentDeploymentTriggerType` What caused the deployment. - `const DeploymentDeploymentTriggerTypeGitHubPush DeploymentDeploymentTriggerType = "github:push"` - `const DeploymentDeploymentTriggerTypeADHoc DeploymentDeploymentTriggerType = "ad_hoc"` - `const DeploymentDeploymentTriggerTypeDeployHook DeploymentDeploymentTriggerType = "deploy_hook"` - `EnvVars map[string, DeploymentEnvVar]` Environment variables used for builds and Pages Functions. - `type DeploymentEnvVarsPagesPlainTextEnvVar struct{…}` A plaintext environment variable. - `Type DeploymentEnvVarsPagesPlainTextEnvVarType` - `const DeploymentEnvVarsPagesPlainTextEnvVarTypePlainText DeploymentEnvVarsPagesPlainTextEnvVarType = "plain_text"` - `Value string` Environment variable value. - `type DeploymentEnvVarsPagesSecretTextEnvVar struct{…}` An encrypted environment variable. - `Type DeploymentEnvVarsPagesSecretTextEnvVarType` - `const DeploymentEnvVarsPagesSecretTextEnvVarTypeSecretText DeploymentEnvVarsPagesSecretTextEnvVarType = "secret_text"` - `Value string` Secret value. - `Environment DeploymentEnvironment` Type of deploy. - `const DeploymentEnvironmentPreview DeploymentEnvironment = "preview"` - `const DeploymentEnvironmentProduction DeploymentEnvironment = "production"` - `IsSkipped bool` If the deployment has been skipped. - `LatestStage Stage` The status of the deployment. - `EndedOn Time` When the stage ended. - `Name StageName` The current build stage. - `const StageNameQueued StageName = "queued"` - `const StageNameInitialize StageName = "initialize"` - `const StageNameCloneRepo StageName = "clone_repo"` - `const StageNameBuild StageName = "build"` - `const StageNameDeploy StageName = "deploy"` - `StartedOn Time` When the stage started. - `Status StageStatus` State of the current stage. - `const StageStatusSuccess StageStatus = "success"` - `const StageStatusIdle StageStatus = "idle"` - `const StageStatusActive StageStatus = "active"` - `const StageStatusFailure StageStatus = "failure"` - `const StageStatusCanceled StageStatus = "canceled"` - `ModifiedOn Time` When the deployment was last modified. - `ProjectID string` Id of the project. - `ProjectName string` Name of the project. - `ShortID string` Short Id (8 character) of the deployment. - `Source DeploymentSource` Configs for the project source control. - `Config DeploymentSourceConfig` - `DeploymentsEnabled bool` Whether to enable automatic deployments when pushing to the source repository. When disabled, no deployments (production or preview) will be triggered automatically. - `Owner string` The owner of the repository. - `OwnerID string` The owner ID of the repository. - `PathExcludes []string` A list of paths that should be excluded from triggering a preview deployment. Wildcard syntax (`*`) is supported. - `PathIncludes []string` A list of paths that should be watched to trigger a preview deployment. Wildcard syntax (`*`) is supported. - `PrCommentsEnabled bool` Whether to enable PR comments. - `PreviewBranchExcludes []string` A list of branches that should not trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`. - `PreviewBranchIncludes []string` A list of branches that should trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`. - `PreviewDeploymentSetting DeploymentSourceConfigPreviewDeploymentSetting` Controls whether commits to preview branches trigger a preview deployment. - `const DeploymentSourceConfigPreviewDeploymentSettingAll DeploymentSourceConfigPreviewDeploymentSetting = "all"` - `const DeploymentSourceConfigPreviewDeploymentSettingNone DeploymentSourceConfigPreviewDeploymentSetting = "none"` - `const DeploymentSourceConfigPreviewDeploymentSettingCustom DeploymentSourceConfigPreviewDeploymentSetting = "custom"` - `ProductionBranch string` The production branch of the repository. - `ProductionDeploymentsEnabled bool` Whether to trigger a production deployment on commits to the production branch. - `RepoID string` The ID of the repository. - `RepoName string` The name of the repository. - `Type DeploymentSourceType` The source control management provider. - `const DeploymentSourceTypeGitHub DeploymentSourceType = "github"` - `const DeploymentSourceTypeGitlab DeploymentSourceType = "gitlab"` - `Stages []Stage` List of past stages. - `EndedOn Time` When the stage ended. - `Name StageName` The current build stage. - `StartedOn Time` When the stage started. - `Status StageStatus` State of the current stage. - `URL string` The live URL to view this deployment. - `UsesFunctions bool` Whether the deployment uses functions. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/pages" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.Pages.Projects.Deployments.List( context.TODO(), "this-is-my-project-01", pages.ProjectDeploymentListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "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", "uses_functions": true } ], "success": true, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` ## Get deployment info `client.Pages.Projects.Deployments.Get(ctx, projectName, deploymentID, query) (*Deployment, error)` **get** `/accounts/{account_id}/pages/projects/{project_name}/deployments/{deployment_id}` Fetch information about a deployment. ### Parameters - `projectName string` Name of the project. - `deploymentID string` Identifier. - `query ProjectDeploymentGetParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type Deployment struct{…}` - `ID string` Id of the deployment. - `Aliases []string` A list of alias URLs pointing to this deployment. - `BuildConfig DeploymentBuildConfig` Configs for the project build process. - `WebAnalyticsTag string` The classifying tag for analytics. - `WebAnalyticsToken string` The auth token for analytics. - `BuildCaching bool` Enable build caching for the project. - `BuildCommand string` Command used to build project. - `DestinationDir string` Assets output directory of the build. - `RootDir string` Directory to run the command. - `CreatedOn Time` When the deployment was created. - `DeploymentTrigger DeploymentDeploymentTrigger` Info about what caused the deployment. - `Metadata DeploymentDeploymentTriggerMetadata` Additional info about the trigger. - `Branch string` Where the trigger happened. - `CommitDirty bool` Whether the deployment trigger commit was dirty. - `CommitHash string` Hash of the deployment trigger commit. - `CommitMessage string` Message of the deployment trigger commit. - `Type DeploymentDeploymentTriggerType` What caused the deployment. - `const DeploymentDeploymentTriggerTypeGitHubPush DeploymentDeploymentTriggerType = "github:push"` - `const DeploymentDeploymentTriggerTypeADHoc DeploymentDeploymentTriggerType = "ad_hoc"` - `const DeploymentDeploymentTriggerTypeDeployHook DeploymentDeploymentTriggerType = "deploy_hook"` - `EnvVars map[string, DeploymentEnvVar]` Environment variables used for builds and Pages Functions. - `type DeploymentEnvVarsPagesPlainTextEnvVar struct{…}` A plaintext environment variable. - `Type DeploymentEnvVarsPagesPlainTextEnvVarType` - `const DeploymentEnvVarsPagesPlainTextEnvVarTypePlainText DeploymentEnvVarsPagesPlainTextEnvVarType = "plain_text"` - `Value string` Environment variable value. - `type DeploymentEnvVarsPagesSecretTextEnvVar struct{…}` An encrypted environment variable. - `Type DeploymentEnvVarsPagesSecretTextEnvVarType` - `const DeploymentEnvVarsPagesSecretTextEnvVarTypeSecretText DeploymentEnvVarsPagesSecretTextEnvVarType = "secret_text"` - `Value string` Secret value. - `Environment DeploymentEnvironment` Type of deploy. - `const DeploymentEnvironmentPreview DeploymentEnvironment = "preview"` - `const DeploymentEnvironmentProduction DeploymentEnvironment = "production"` - `IsSkipped bool` If the deployment has been skipped. - `LatestStage Stage` The status of the deployment. - `EndedOn Time` When the stage ended. - `Name StageName` The current build stage. - `const StageNameQueued StageName = "queued"` - `const StageNameInitialize StageName = "initialize"` - `const StageNameCloneRepo StageName = "clone_repo"` - `const StageNameBuild StageName = "build"` - `const StageNameDeploy StageName = "deploy"` - `StartedOn Time` When the stage started. - `Status StageStatus` State of the current stage. - `const StageStatusSuccess StageStatus = "success"` - `const StageStatusIdle StageStatus = "idle"` - `const StageStatusActive StageStatus = "active"` - `const StageStatusFailure StageStatus = "failure"` - `const StageStatusCanceled StageStatus = "canceled"` - `ModifiedOn Time` When the deployment was last modified. - `ProjectID string` Id of the project. - `ProjectName string` Name of the project. - `ShortID string` Short Id (8 character) of the deployment. - `Source DeploymentSource` Configs for the project source control. - `Config DeploymentSourceConfig` - `DeploymentsEnabled bool` Whether to enable automatic deployments when pushing to the source repository. When disabled, no deployments (production or preview) will be triggered automatically. - `Owner string` The owner of the repository. - `OwnerID string` The owner ID of the repository. - `PathExcludes []string` A list of paths that should be excluded from triggering a preview deployment. Wildcard syntax (`*`) is supported. - `PathIncludes []string` A list of paths that should be watched to trigger a preview deployment. Wildcard syntax (`*`) is supported. - `PrCommentsEnabled bool` Whether to enable PR comments. - `PreviewBranchExcludes []string` A list of branches that should not trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`. - `PreviewBranchIncludes []string` A list of branches that should trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`. - `PreviewDeploymentSetting DeploymentSourceConfigPreviewDeploymentSetting` Controls whether commits to preview branches trigger a preview deployment. - `const DeploymentSourceConfigPreviewDeploymentSettingAll DeploymentSourceConfigPreviewDeploymentSetting = "all"` - `const DeploymentSourceConfigPreviewDeploymentSettingNone DeploymentSourceConfigPreviewDeploymentSetting = "none"` - `const DeploymentSourceConfigPreviewDeploymentSettingCustom DeploymentSourceConfigPreviewDeploymentSetting = "custom"` - `ProductionBranch string` The production branch of the repository. - `ProductionDeploymentsEnabled bool` Whether to trigger a production deployment on commits to the production branch. - `RepoID string` The ID of the repository. - `RepoName string` The name of the repository. - `Type DeploymentSourceType` The source control management provider. - `const DeploymentSourceTypeGitHub DeploymentSourceType = "github"` - `const DeploymentSourceTypeGitlab DeploymentSourceType = "gitlab"` - `Stages []Stage` List of past stages. - `EndedOn Time` When the stage ended. - `Name StageName` The current build stage. - `StartedOn Time` When the stage started. - `Status StageStatus` State of the current stage. - `URL string` The live URL to view this deployment. - `UsesFunctions bool` Whether the deployment uses functions. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/pages" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) deployment, err := client.Pages.Projects.Deployments.Get( context.TODO(), "this-is-my-project-01", "023e105f4ecef8ad9ca31a8372d0c353", pages.ProjectDeploymentGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", deployment.ID) } ``` #### Response ```json { "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", "uses_functions": true }, "success": true } ``` ## Create deployment `client.Pages.Projects.Deployments.New(ctx, projectName, params) (*Deployment, error)` **post** `/accounts/{account_id}/pages/projects/{project_name}/deployments` Start a new deployment from production. The repository and account must have already been authorized on the Cloudflare Pages dashboard. ### Parameters - `projectName string` Name of the project. - `params ProjectDeploymentNewParams` - `AccountID param.Field[string]` Path param: Identifier. - `Headers param.Field[Reader]` Body param: Headers configuration file for the deployment. - `Redirects param.Field[Reader]` Body param: Redirects configuration file for the deployment. - `RoutesJson param.Field[Reader]` Body param: Routes configuration file defining routing rules. - `WorkerBundle param.Field[Reader]` Body param: Worker bundle file in multipart/form-data format. Mutually exclusive with `_worker.js`. Cannot specify both `_worker.js` and `_worker.bundle` in the same request. Maximum size: 25 MiB. - `WorkerJS param.Field[Reader]` Body param: Worker JavaScript file. Mutually exclusive with `_worker.bundle`. Cannot specify both `_worker.js` and `_worker.bundle` in the same request. - `Branch param.Field[string]` Body param: The branch to build the new deployment from. The `HEAD` of the branch will be used. If omitted, the production branch will be used by default. - `CommitDirty param.Field[ProjectDeploymentNewParamsCommitDirty]` Body param: Boolean string indicating if the working directory has uncommitted changes. - `const ProjectDeploymentNewParamsCommitDirtyTrue ProjectDeploymentNewParamsCommitDirty = "true"` - `const ProjectDeploymentNewParamsCommitDirtyFalse ProjectDeploymentNewParamsCommitDirty = "false"` - `CommitHash param.Field[string]` Body param: Git commit SHA associated with this deployment. - `CommitMessage param.Field[string]` Body param: Git commit message associated with this deployment. - `FunctionsFilepathRoutingConfigJson param.Field[Reader]` Body param: Functions routing configuration file. - `Manifest param.Field[string]` Body param: JSON string containing a manifest of files to deploy. Maps file paths to their content hashes. Required for direct upload deployments. Maximum 20,000 entries. - `PagesBuildOutputDir param.Field[string]` Body param: The build output directory path. - `WranglerConfigHash param.Field[string]` Body param: Hash of the Wrangler configuration file used for this deployment. ### Returns - `type Deployment struct{…}` - `ID string` Id of the deployment. - `Aliases []string` A list of alias URLs pointing to this deployment. - `BuildConfig DeploymentBuildConfig` Configs for the project build process. - `WebAnalyticsTag string` The classifying tag for analytics. - `WebAnalyticsToken string` The auth token for analytics. - `BuildCaching bool` Enable build caching for the project. - `BuildCommand string` Command used to build project. - `DestinationDir string` Assets output directory of the build. - `RootDir string` Directory to run the command. - `CreatedOn Time` When the deployment was created. - `DeploymentTrigger DeploymentDeploymentTrigger` Info about what caused the deployment. - `Metadata DeploymentDeploymentTriggerMetadata` Additional info about the trigger. - `Branch string` Where the trigger happened. - `CommitDirty bool` Whether the deployment trigger commit was dirty. - `CommitHash string` Hash of the deployment trigger commit. - `CommitMessage string` Message of the deployment trigger commit. - `Type DeploymentDeploymentTriggerType` What caused the deployment. - `const DeploymentDeploymentTriggerTypeGitHubPush DeploymentDeploymentTriggerType = "github:push"` - `const DeploymentDeploymentTriggerTypeADHoc DeploymentDeploymentTriggerType = "ad_hoc"` - `const DeploymentDeploymentTriggerTypeDeployHook DeploymentDeploymentTriggerType = "deploy_hook"` - `EnvVars map[string, DeploymentEnvVar]` Environment variables used for builds and Pages Functions. - `type DeploymentEnvVarsPagesPlainTextEnvVar struct{…}` A plaintext environment variable. - `Type DeploymentEnvVarsPagesPlainTextEnvVarType` - `const DeploymentEnvVarsPagesPlainTextEnvVarTypePlainText DeploymentEnvVarsPagesPlainTextEnvVarType = "plain_text"` - `Value string` Environment variable value. - `type DeploymentEnvVarsPagesSecretTextEnvVar struct{…}` An encrypted environment variable. - `Type DeploymentEnvVarsPagesSecretTextEnvVarType` - `const DeploymentEnvVarsPagesSecretTextEnvVarTypeSecretText DeploymentEnvVarsPagesSecretTextEnvVarType = "secret_text"` - `Value string` Secret value. - `Environment DeploymentEnvironment` Type of deploy. - `const DeploymentEnvironmentPreview DeploymentEnvironment = "preview"` - `const DeploymentEnvironmentProduction DeploymentEnvironment = "production"` - `IsSkipped bool` If the deployment has been skipped. - `LatestStage Stage` The status of the deployment. - `EndedOn Time` When the stage ended. - `Name StageName` The current build stage. - `const StageNameQueued StageName = "queued"` - `const StageNameInitialize StageName = "initialize"` - `const StageNameCloneRepo StageName = "clone_repo"` - `const StageNameBuild StageName = "build"` - `const StageNameDeploy StageName = "deploy"` - `StartedOn Time` When the stage started. - `Status StageStatus` State of the current stage. - `const StageStatusSuccess StageStatus = "success"` - `const StageStatusIdle StageStatus = "idle"` - `const StageStatusActive StageStatus = "active"` - `const StageStatusFailure StageStatus = "failure"` - `const StageStatusCanceled StageStatus = "canceled"` - `ModifiedOn Time` When the deployment was last modified. - `ProjectID string` Id of the project. - `ProjectName string` Name of the project. - `ShortID string` Short Id (8 character) of the deployment. - `Source DeploymentSource` Configs for the project source control. - `Config DeploymentSourceConfig` - `DeploymentsEnabled bool` Whether to enable automatic deployments when pushing to the source repository. When disabled, no deployments (production or preview) will be triggered automatically. - `Owner string` The owner of the repository. - `OwnerID string` The owner ID of the repository. - `PathExcludes []string` A list of paths that should be excluded from triggering a preview deployment. Wildcard syntax (`*`) is supported. - `PathIncludes []string` A list of paths that should be watched to trigger a preview deployment. Wildcard syntax (`*`) is supported. - `PrCommentsEnabled bool` Whether to enable PR comments. - `PreviewBranchExcludes []string` A list of branches that should not trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`. - `PreviewBranchIncludes []string` A list of branches that should trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`. - `PreviewDeploymentSetting DeploymentSourceConfigPreviewDeploymentSetting` Controls whether commits to preview branches trigger a preview deployment. - `const DeploymentSourceConfigPreviewDeploymentSettingAll DeploymentSourceConfigPreviewDeploymentSetting = "all"` - `const DeploymentSourceConfigPreviewDeploymentSettingNone DeploymentSourceConfigPreviewDeploymentSetting = "none"` - `const DeploymentSourceConfigPreviewDeploymentSettingCustom DeploymentSourceConfigPreviewDeploymentSetting = "custom"` - `ProductionBranch string` The production branch of the repository. - `ProductionDeploymentsEnabled bool` Whether to trigger a production deployment on commits to the production branch. - `RepoID string` The ID of the repository. - `RepoName string` The name of the repository. - `Type DeploymentSourceType` The source control management provider. - `const DeploymentSourceTypeGitHub DeploymentSourceType = "github"` - `const DeploymentSourceTypeGitlab DeploymentSourceType = "gitlab"` - `Stages []Stage` List of past stages. - `EndedOn Time` When the stage ended. - `Name StageName` The current build stage. - `StartedOn Time` When the stage started. - `Status StageStatus` State of the current stage. - `URL string` The live URL to view this deployment. - `UsesFunctions bool` Whether the deployment uses functions. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/pages" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) deployment, err := client.Pages.Projects.Deployments.New( context.TODO(), "this-is-my-project-01", pages.ProjectDeploymentNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", deployment.ID) } ``` #### Response ```json { "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", "uses_functions": true }, "success": true } ``` ## Delete deployment `client.Pages.Projects.Deployments.Delete(ctx, projectName, deploymentID, body) (*ProjectDeploymentDeleteResponse, error)` **delete** `/accounts/{account_id}/pages/projects/{project_name}/deployments/{deployment_id}` Delete a deployment. ### Parameters - `projectName string` Name of the project. - `deploymentID string` Identifier. - `body ProjectDeploymentDeleteParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type ProjectDeploymentDeleteResponse interface{…}` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/pages" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) deployment, err := client.Pages.Projects.Deployments.Delete( context.TODO(), "this-is-my-project-01", "023e105f4ecef8ad9ca31a8372d0c353", pages.ProjectDeploymentDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", deployment) } ``` #### Response ```json { "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": {}, "success": true } ``` ## Retry deployment `client.Pages.Projects.Deployments.Retry(ctx, projectName, deploymentID, body) (*Deployment, error)` **post** `/accounts/{account_id}/pages/projects/{project_name}/deployments/{deployment_id}/retry` Retry a previous deployment. ### Parameters - `projectName string` Name of the project. - `deploymentID string` Identifier. - `body ProjectDeploymentRetryParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type Deployment struct{…}` - `ID string` Id of the deployment. - `Aliases []string` A list of alias URLs pointing to this deployment. - `BuildConfig DeploymentBuildConfig` Configs for the project build process. - `WebAnalyticsTag string` The classifying tag for analytics. - `WebAnalyticsToken string` The auth token for analytics. - `BuildCaching bool` Enable build caching for the project. - `BuildCommand string` Command used to build project. - `DestinationDir string` Assets output directory of the build. - `RootDir string` Directory to run the command. - `CreatedOn Time` When the deployment was created. - `DeploymentTrigger DeploymentDeploymentTrigger` Info about what caused the deployment. - `Metadata DeploymentDeploymentTriggerMetadata` Additional info about the trigger. - `Branch string` Where the trigger happened. - `CommitDirty bool` Whether the deployment trigger commit was dirty. - `CommitHash string` Hash of the deployment trigger commit. - `CommitMessage string` Message of the deployment trigger commit. - `Type DeploymentDeploymentTriggerType` What caused the deployment. - `const DeploymentDeploymentTriggerTypeGitHubPush DeploymentDeploymentTriggerType = "github:push"` - `const DeploymentDeploymentTriggerTypeADHoc DeploymentDeploymentTriggerType = "ad_hoc"` - `const DeploymentDeploymentTriggerTypeDeployHook DeploymentDeploymentTriggerType = "deploy_hook"` - `EnvVars map[string, DeploymentEnvVar]` Environment variables used for builds and Pages Functions. - `type DeploymentEnvVarsPagesPlainTextEnvVar struct{…}` A plaintext environment variable. - `Type DeploymentEnvVarsPagesPlainTextEnvVarType` - `const DeploymentEnvVarsPagesPlainTextEnvVarTypePlainText DeploymentEnvVarsPagesPlainTextEnvVarType = "plain_text"` - `Value string` Environment variable value. - `type DeploymentEnvVarsPagesSecretTextEnvVar struct{…}` An encrypted environment variable. - `Type DeploymentEnvVarsPagesSecretTextEnvVarType` - `const DeploymentEnvVarsPagesSecretTextEnvVarTypeSecretText DeploymentEnvVarsPagesSecretTextEnvVarType = "secret_text"` - `Value string` Secret value. - `Environment DeploymentEnvironment` Type of deploy. - `const DeploymentEnvironmentPreview DeploymentEnvironment = "preview"` - `const DeploymentEnvironmentProduction DeploymentEnvironment = "production"` - `IsSkipped bool` If the deployment has been skipped. - `LatestStage Stage` The status of the deployment. - `EndedOn Time` When the stage ended. - `Name StageName` The current build stage. - `const StageNameQueued StageName = "queued"` - `const StageNameInitialize StageName = "initialize"` - `const StageNameCloneRepo StageName = "clone_repo"` - `const StageNameBuild StageName = "build"` - `const StageNameDeploy StageName = "deploy"` - `StartedOn Time` When the stage started. - `Status StageStatus` State of the current stage. - `const StageStatusSuccess StageStatus = "success"` - `const StageStatusIdle StageStatus = "idle"` - `const StageStatusActive StageStatus = "active"` - `const StageStatusFailure StageStatus = "failure"` - `const StageStatusCanceled StageStatus = "canceled"` - `ModifiedOn Time` When the deployment was last modified. - `ProjectID string` Id of the project. - `ProjectName string` Name of the project. - `ShortID string` Short Id (8 character) of the deployment. - `Source DeploymentSource` Configs for the project source control. - `Config DeploymentSourceConfig` - `DeploymentsEnabled bool` Whether to enable automatic deployments when pushing to the source repository. When disabled, no deployments (production or preview) will be triggered automatically. - `Owner string` The owner of the repository. - `OwnerID string` The owner ID of the repository. - `PathExcludes []string` A list of paths that should be excluded from triggering a preview deployment. Wildcard syntax (`*`) is supported. - `PathIncludes []string` A list of paths that should be watched to trigger a preview deployment. Wildcard syntax (`*`) is supported. - `PrCommentsEnabled bool` Whether to enable PR comments. - `PreviewBranchExcludes []string` A list of branches that should not trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`. - `PreviewBranchIncludes []string` A list of branches that should trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`. - `PreviewDeploymentSetting DeploymentSourceConfigPreviewDeploymentSetting` Controls whether commits to preview branches trigger a preview deployment. - `const DeploymentSourceConfigPreviewDeploymentSettingAll DeploymentSourceConfigPreviewDeploymentSetting = "all"` - `const DeploymentSourceConfigPreviewDeploymentSettingNone DeploymentSourceConfigPreviewDeploymentSetting = "none"` - `const DeploymentSourceConfigPreviewDeploymentSettingCustom DeploymentSourceConfigPreviewDeploymentSetting = "custom"` - `ProductionBranch string` The production branch of the repository. - `ProductionDeploymentsEnabled bool` Whether to trigger a production deployment on commits to the production branch. - `RepoID string` The ID of the repository. - `RepoName string` The name of the repository. - `Type DeploymentSourceType` The source control management provider. - `const DeploymentSourceTypeGitHub DeploymentSourceType = "github"` - `const DeploymentSourceTypeGitlab DeploymentSourceType = "gitlab"` - `Stages []Stage` List of past stages. - `EndedOn Time` When the stage ended. - `Name StageName` The current build stage. - `StartedOn Time` When the stage started. - `Status StageStatus` State of the current stage. - `URL string` The live URL to view this deployment. - `UsesFunctions bool` Whether the deployment uses functions. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/pages" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) deployment, err := client.Pages.Projects.Deployments.Retry( context.TODO(), "this-is-my-project-01", "023e105f4ecef8ad9ca31a8372d0c353", pages.ProjectDeploymentRetryParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", deployment.ID) } ``` #### Response ```json { "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", "uses_functions": true }, "success": true } ``` ## Rollback deployment `client.Pages.Projects.Deployments.Rollback(ctx, projectName, deploymentID, body) (*Deployment, error)` **post** `/accounts/{account_id}/pages/projects/{project_name}/deployments/{deployment_id}/rollback` Rollback the production deployment to a previous deployment. You can only rollback to succesful builds on production. ### Parameters - `projectName string` Name of the project. - `deploymentID string` Identifier. - `body ProjectDeploymentRollbackParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type Deployment struct{…}` - `ID string` Id of the deployment. - `Aliases []string` A list of alias URLs pointing to this deployment. - `BuildConfig DeploymentBuildConfig` Configs for the project build process. - `WebAnalyticsTag string` The classifying tag for analytics. - `WebAnalyticsToken string` The auth token for analytics. - `BuildCaching bool` Enable build caching for the project. - `BuildCommand string` Command used to build project. - `DestinationDir string` Assets output directory of the build. - `RootDir string` Directory to run the command. - `CreatedOn Time` When the deployment was created. - `DeploymentTrigger DeploymentDeploymentTrigger` Info about what caused the deployment. - `Metadata DeploymentDeploymentTriggerMetadata` Additional info about the trigger. - `Branch string` Where the trigger happened. - `CommitDirty bool` Whether the deployment trigger commit was dirty. - `CommitHash string` Hash of the deployment trigger commit. - `CommitMessage string` Message of the deployment trigger commit. - `Type DeploymentDeploymentTriggerType` What caused the deployment. - `const DeploymentDeploymentTriggerTypeGitHubPush DeploymentDeploymentTriggerType = "github:push"` - `const DeploymentDeploymentTriggerTypeADHoc DeploymentDeploymentTriggerType = "ad_hoc"` - `const DeploymentDeploymentTriggerTypeDeployHook DeploymentDeploymentTriggerType = "deploy_hook"` - `EnvVars map[string, DeploymentEnvVar]` Environment variables used for builds and Pages Functions. - `type DeploymentEnvVarsPagesPlainTextEnvVar struct{…}` A plaintext environment variable. - `Type DeploymentEnvVarsPagesPlainTextEnvVarType` - `const DeploymentEnvVarsPagesPlainTextEnvVarTypePlainText DeploymentEnvVarsPagesPlainTextEnvVarType = "plain_text"` - `Value string` Environment variable value. - `type DeploymentEnvVarsPagesSecretTextEnvVar struct{…}` An encrypted environment variable. - `Type DeploymentEnvVarsPagesSecretTextEnvVarType` - `const DeploymentEnvVarsPagesSecretTextEnvVarTypeSecretText DeploymentEnvVarsPagesSecretTextEnvVarType = "secret_text"` - `Value string` Secret value. - `Environment DeploymentEnvironment` Type of deploy. - `const DeploymentEnvironmentPreview DeploymentEnvironment = "preview"` - `const DeploymentEnvironmentProduction DeploymentEnvironment = "production"` - `IsSkipped bool` If the deployment has been skipped. - `LatestStage Stage` The status of the deployment. - `EndedOn Time` When the stage ended. - `Name StageName` The current build stage. - `const StageNameQueued StageName = "queued"` - `const StageNameInitialize StageName = "initialize"` - `const StageNameCloneRepo StageName = "clone_repo"` - `const StageNameBuild StageName = "build"` - `const StageNameDeploy StageName = "deploy"` - `StartedOn Time` When the stage started. - `Status StageStatus` State of the current stage. - `const StageStatusSuccess StageStatus = "success"` - `const StageStatusIdle StageStatus = "idle"` - `const StageStatusActive StageStatus = "active"` - `const StageStatusFailure StageStatus = "failure"` - `const StageStatusCanceled StageStatus = "canceled"` - `ModifiedOn Time` When the deployment was last modified. - `ProjectID string` Id of the project. - `ProjectName string` Name of the project. - `ShortID string` Short Id (8 character) of the deployment. - `Source DeploymentSource` Configs for the project source control. - `Config DeploymentSourceConfig` - `DeploymentsEnabled bool` Whether to enable automatic deployments when pushing to the source repository. When disabled, no deployments (production or preview) will be triggered automatically. - `Owner string` The owner of the repository. - `OwnerID string` The owner ID of the repository. - `PathExcludes []string` A list of paths that should be excluded from triggering a preview deployment. Wildcard syntax (`*`) is supported. - `PathIncludes []string` A list of paths that should be watched to trigger a preview deployment. Wildcard syntax (`*`) is supported. - `PrCommentsEnabled bool` Whether to enable PR comments. - `PreviewBranchExcludes []string` A list of branches that should not trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`. - `PreviewBranchIncludes []string` A list of branches that should trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`. - `PreviewDeploymentSetting DeploymentSourceConfigPreviewDeploymentSetting` Controls whether commits to preview branches trigger a preview deployment. - `const DeploymentSourceConfigPreviewDeploymentSettingAll DeploymentSourceConfigPreviewDeploymentSetting = "all"` - `const DeploymentSourceConfigPreviewDeploymentSettingNone DeploymentSourceConfigPreviewDeploymentSetting = "none"` - `const DeploymentSourceConfigPreviewDeploymentSettingCustom DeploymentSourceConfigPreviewDeploymentSetting = "custom"` - `ProductionBranch string` The production branch of the repository. - `ProductionDeploymentsEnabled bool` Whether to trigger a production deployment on commits to the production branch. - `RepoID string` The ID of the repository. - `RepoName string` The name of the repository. - `Type DeploymentSourceType` The source control management provider. - `const DeploymentSourceTypeGitHub DeploymentSourceType = "github"` - `const DeploymentSourceTypeGitlab DeploymentSourceType = "gitlab"` - `Stages []Stage` List of past stages. - `EndedOn Time` When the stage ended. - `Name StageName` The current build stage. - `StartedOn Time` When the stage started. - `Status StageStatus` State of the current stage. - `URL string` The live URL to view this deployment. - `UsesFunctions bool` Whether the deployment uses functions. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/pages" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) deployment, err := client.Pages.Projects.Deployments.Rollback( context.TODO(), "this-is-my-project-01", "023e105f4ecef8ad9ca31a8372d0c353", pages.ProjectDeploymentRollbackParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", deployment.ID) } ``` #### Response ```json { "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", "uses_functions": true }, "success": true } ``` # History # Logs ## Get deployment logs `client.Pages.Projects.Deployments.History.Logs.Get(ctx, projectName, deploymentID, query) (*ProjectDeploymentHistoryLogGetResponse, error)` **get** `/accounts/{account_id}/pages/projects/{project_name}/deployments/{deployment_id}/history/logs` Fetch deployment logs for a project. ### Parameters - `projectName string` Name of the project. - `deploymentID string` Identifier. - `query ProjectDeploymentHistoryLogGetParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type ProjectDeploymentHistoryLogGetResponse struct{…}` - `Data []ProjectDeploymentHistoryLogGetResponseData` - `Line string` - `Ts string` - `IncludesContainerLogs bool` - `Total int64` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/pages" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) log, err := client.Pages.Projects.Deployments.History.Logs.Get( context.TODO(), "this-is-my-project-01", "023e105f4ecef8ad9ca31a8372d0c353", pages.ProjectDeploymentHistoryLogGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", log.Data) } ``` #### Response ```json { "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": { "data": [ { "line": "Cloning repository...", "ts": "2021-04-20T19:35:29.0749819Z" }, { "line": "From https://github.com/cloudflare/example", "ts": "2021-04-20T19:35:30.0749819Z" }, { "line": " * branch 209c5bb11d89533f426b2f8469bcae12fdccf71b -> FETCH_HEAD", "ts": "2021-04-20T19:35:30.0749819Z" }, { "line": "", "ts": "2021-04-20T19:35:30.0749819Z" }, { "line": "HEAD is now at 209c5bb Update index.html", "ts": "2021-04-20T19:35:30.0749819Z" }, { "line": "", "ts": "2021-04-20T19:35:30.0749819Z" }, { "line": "", "ts": "2021-04-20T19:35:30.0749819Z" }, { "line": "Success: Finished cloning repository files", "ts": "2021-04-20T19:35:30.0749819Z" }, { "line": "Installing dependencies", "ts": "2021-04-20T19:35:59.0749819Z" }, { "line": "Python version set to 2.7", "ts": "2021-04-20T19:35:59.0931208Z" }, { "line": "v12.18.0 is already installed.", "ts": "2021-04-20T19:36:02.2369501Z" }, { "line": "Now using node v12.18.0 (npm v6.14.4)", "ts": "2021-04-20T19:36:02.6028886Z" }, { "line": "Started restoring cached build plugins", "ts": "2021-04-20T19:36:02.624555Z" }, { "line": "Finished restoring cached build plugins", "ts": "2021-04-20T19:36:02.6340688Z" }, { "line": "Attempting ruby version 2.7.1, read from environment", "ts": "2021-04-20T19:36:02.963095Z" }, { "line": "Using ruby version 2.7.1", "ts": "2021-04-20T19:36:04.2236084Z" }, { "line": "Using PHP version 5.6", "ts": "2021-04-20T19:36:04.5450152Z" }, { "line": "5.2 is already installed.", "ts": "2021-04-20T19:36:04.5740509Z" }, { "line": "Using Swift version 5.2", "ts": "2021-04-20T19:36:04.577035Z" }, { "line": "Installing Hugo 0.54.0", "ts": "2021-04-20T19:36:04.5771615Z" }, { "line": "Hugo Static Site Generator v0.54.0-B1A82C61A/extended linux/amd64 BuildDate: 2019-02-01T10:04:38Z", "ts": "2021-04-20T19:36:05.4786868Z" }, { "line": "Started restoring cached go cache", "ts": "2021-04-20T19:36:05.4794366Z" }, { "line": "Finished restoring cached go cache", "ts": "2021-04-20T19:36:05.481977Z" }, { "line": "go version go1.14.4 linux/amd64", "ts": "2021-04-20T19:36:05.9049776Z" }, { "line": "go version go1.14.4 linux/amd64", "ts": "2021-04-20T19:36:05.9086053Z" }, { "line": "Installing missing commands", "ts": "2021-04-20T19:36:05.9163568Z" }, { "line": "Verify run directory", "ts": "2021-04-20T19:36:05.9163934Z" }, { "line": "Executing user command: echo \"skipping build step: no build command specified\"", "ts": "2021-04-20T19:36:05.9164636Z" }, { "line": "skipping build step: no build command specified", "ts": "2021-04-20T19:36:05.9165087Z" }, { "line": "Finished", "ts": "2021-04-20T19:36:05.917412Z" } ], "includes_container_logs": true, "total": 30 }, "success": true } ``` # Domains ## Get domains `client.Pages.Projects.Domains.List(ctx, projectName, query) (*SinglePage[ProjectDomainListResponse], error)` **get** `/accounts/{account_id}/pages/projects/{project_name}/domains` Fetch a list of all domains associated with a Pages project. ### Parameters - `projectName string` Name of the project. - `query ProjectDomainListParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type ProjectDomainListResponse struct{…}` - `ID string` - `CertificateAuthority ProjectDomainListResponseCertificateAuthority` - `const ProjectDomainListResponseCertificateAuthorityGoogle ProjectDomainListResponseCertificateAuthority = "google"` - `const ProjectDomainListResponseCertificateAuthorityLetsEncrypt ProjectDomainListResponseCertificateAuthority = "lets_encrypt"` - `CreatedOn string` - `DomainID string` - `Name string` The domain name. - `Status ProjectDomainListResponseStatus` - `const ProjectDomainListResponseStatusInitializing ProjectDomainListResponseStatus = "initializing"` - `const ProjectDomainListResponseStatusPending ProjectDomainListResponseStatus = "pending"` - `const ProjectDomainListResponseStatusActive ProjectDomainListResponseStatus = "active"` - `const ProjectDomainListResponseStatusDeactivated ProjectDomainListResponseStatus = "deactivated"` - `const ProjectDomainListResponseStatusBlocked ProjectDomainListResponseStatus = "blocked"` - `const ProjectDomainListResponseStatusError ProjectDomainListResponseStatus = "error"` - `ValidationData ProjectDomainListResponseValidationData` - `Method ProjectDomainListResponseValidationDataMethod` - `const ProjectDomainListResponseValidationDataMethodHTTP ProjectDomainListResponseValidationDataMethod = "http"` - `const ProjectDomainListResponseValidationDataMethodTXT ProjectDomainListResponseValidationDataMethod = "txt"` - `Status ProjectDomainListResponseValidationDataStatus` - `const ProjectDomainListResponseValidationDataStatusInitializing ProjectDomainListResponseValidationDataStatus = "initializing"` - `const ProjectDomainListResponseValidationDataStatusPending ProjectDomainListResponseValidationDataStatus = "pending"` - `const ProjectDomainListResponseValidationDataStatusActive ProjectDomainListResponseValidationDataStatus = "active"` - `const ProjectDomainListResponseValidationDataStatusDeactivated ProjectDomainListResponseValidationDataStatus = "deactivated"` - `const ProjectDomainListResponseValidationDataStatusError ProjectDomainListResponseValidationDataStatus = "error"` - `ErrorMessage string` - `TXTName string` - `TXTValue string` - `VerificationData ProjectDomainListResponseVerificationData` - `Status ProjectDomainListResponseVerificationDataStatus` - `const ProjectDomainListResponseVerificationDataStatusPending ProjectDomainListResponseVerificationDataStatus = "pending"` - `const ProjectDomainListResponseVerificationDataStatusActive ProjectDomainListResponseVerificationDataStatus = "active"` - `const ProjectDomainListResponseVerificationDataStatusDeactivated ProjectDomainListResponseVerificationDataStatus = "deactivated"` - `const ProjectDomainListResponseVerificationDataStatusBlocked ProjectDomainListResponseVerificationDataStatus = "blocked"` - `const ProjectDomainListResponseVerificationDataStatusError ProjectDomainListResponseVerificationDataStatus = "error"` - `ErrorMessage string` - `ZoneTag string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/pages" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.Pages.Projects.Domains.List( context.TODO(), "this-is-my-project-01", pages.ProjectDomainListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "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": "id", "certificate_authority": "lets_encrypt", "created_on": "created_on", "domain_id": "domain_id", "name": "this-is-my-domain-01.com", "status": "initializing", "validation_data": { "method": "http", "status": "initializing", "error_message": "error_message", "txt_name": "txt_name", "txt_value": "txt_value" }, "verification_data": { "status": "pending", "error_message": "error_message" }, "zone_tag": "zone_tag" } ], "success": true, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` ## Get domain `client.Pages.Projects.Domains.Get(ctx, projectName, domainName, query) (*ProjectDomainGetResponse, error)` **get** `/accounts/{account_id}/pages/projects/{project_name}/domains/{domain_name}` Fetch a single domain. ### Parameters - `projectName string` Name of the project. - `domainName string` The domain name. - `query ProjectDomainGetParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type ProjectDomainGetResponse struct{…}` - `ID string` - `CertificateAuthority ProjectDomainGetResponseCertificateAuthority` - `const ProjectDomainGetResponseCertificateAuthorityGoogle ProjectDomainGetResponseCertificateAuthority = "google"` - `const ProjectDomainGetResponseCertificateAuthorityLetsEncrypt ProjectDomainGetResponseCertificateAuthority = "lets_encrypt"` - `CreatedOn string` - `DomainID string` - `Name string` The domain name. - `Status ProjectDomainGetResponseStatus` - `const ProjectDomainGetResponseStatusInitializing ProjectDomainGetResponseStatus = "initializing"` - `const ProjectDomainGetResponseStatusPending ProjectDomainGetResponseStatus = "pending"` - `const ProjectDomainGetResponseStatusActive ProjectDomainGetResponseStatus = "active"` - `const ProjectDomainGetResponseStatusDeactivated ProjectDomainGetResponseStatus = "deactivated"` - `const ProjectDomainGetResponseStatusBlocked ProjectDomainGetResponseStatus = "blocked"` - `const ProjectDomainGetResponseStatusError ProjectDomainGetResponseStatus = "error"` - `ValidationData ProjectDomainGetResponseValidationData` - `Method ProjectDomainGetResponseValidationDataMethod` - `const ProjectDomainGetResponseValidationDataMethodHTTP ProjectDomainGetResponseValidationDataMethod = "http"` - `const ProjectDomainGetResponseValidationDataMethodTXT ProjectDomainGetResponseValidationDataMethod = "txt"` - `Status ProjectDomainGetResponseValidationDataStatus` - `const ProjectDomainGetResponseValidationDataStatusInitializing ProjectDomainGetResponseValidationDataStatus = "initializing"` - `const ProjectDomainGetResponseValidationDataStatusPending ProjectDomainGetResponseValidationDataStatus = "pending"` - `const ProjectDomainGetResponseValidationDataStatusActive ProjectDomainGetResponseValidationDataStatus = "active"` - `const ProjectDomainGetResponseValidationDataStatusDeactivated ProjectDomainGetResponseValidationDataStatus = "deactivated"` - `const ProjectDomainGetResponseValidationDataStatusError ProjectDomainGetResponseValidationDataStatus = "error"` - `ErrorMessage string` - `TXTName string` - `TXTValue string` - `VerificationData ProjectDomainGetResponseVerificationData` - `Status ProjectDomainGetResponseVerificationDataStatus` - `const ProjectDomainGetResponseVerificationDataStatusPending ProjectDomainGetResponseVerificationDataStatus = "pending"` - `const ProjectDomainGetResponseVerificationDataStatusActive ProjectDomainGetResponseVerificationDataStatus = "active"` - `const ProjectDomainGetResponseVerificationDataStatusDeactivated ProjectDomainGetResponseVerificationDataStatus = "deactivated"` - `const ProjectDomainGetResponseVerificationDataStatusBlocked ProjectDomainGetResponseVerificationDataStatus = "blocked"` - `const ProjectDomainGetResponseVerificationDataStatusError ProjectDomainGetResponseVerificationDataStatus = "error"` - `ErrorMessage string` - `ZoneTag string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/pages" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) domain, err := client.Pages.Projects.Domains.Get( context.TODO(), "this-is-my-project-01", "this-is-my-domain-01.com", pages.ProjectDomainGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", domain.ID) } ``` #### Response ```json { "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": "id", "certificate_authority": "lets_encrypt", "created_on": "created_on", "domain_id": "domain_id", "name": "this-is-my-domain-01.com", "status": "initializing", "validation_data": { "method": "http", "status": "initializing", "error_message": "error_message", "txt_name": "txt_name", "txt_value": "txt_value" }, "verification_data": { "status": "pending", "error_message": "error_message" }, "zone_tag": "zone_tag" }, "success": true } ``` ## Add domain `client.Pages.Projects.Domains.New(ctx, projectName, params) (*ProjectDomainNewResponse, error)` **post** `/accounts/{account_id}/pages/projects/{project_name}/domains` Add a new domain for the Pages project. ### Parameters - `projectName string` Name of the project. - `params ProjectDomainNewParams` - `AccountID param.Field[string]` Path param: Identifier. - `Name param.Field[string]` Body param: The domain name. ### Returns - `type ProjectDomainNewResponse struct{…}` - `ID string` - `CertificateAuthority ProjectDomainNewResponseCertificateAuthority` - `const ProjectDomainNewResponseCertificateAuthorityGoogle ProjectDomainNewResponseCertificateAuthority = "google"` - `const ProjectDomainNewResponseCertificateAuthorityLetsEncrypt ProjectDomainNewResponseCertificateAuthority = "lets_encrypt"` - `CreatedOn string` - `DomainID string` - `Name string` The domain name. - `Status ProjectDomainNewResponseStatus` - `const ProjectDomainNewResponseStatusInitializing ProjectDomainNewResponseStatus = "initializing"` - `const ProjectDomainNewResponseStatusPending ProjectDomainNewResponseStatus = "pending"` - `const ProjectDomainNewResponseStatusActive ProjectDomainNewResponseStatus = "active"` - `const ProjectDomainNewResponseStatusDeactivated ProjectDomainNewResponseStatus = "deactivated"` - `const ProjectDomainNewResponseStatusBlocked ProjectDomainNewResponseStatus = "blocked"` - `const ProjectDomainNewResponseStatusError ProjectDomainNewResponseStatus = "error"` - `ValidationData ProjectDomainNewResponseValidationData` - `Method ProjectDomainNewResponseValidationDataMethod` - `const ProjectDomainNewResponseValidationDataMethodHTTP ProjectDomainNewResponseValidationDataMethod = "http"` - `const ProjectDomainNewResponseValidationDataMethodTXT ProjectDomainNewResponseValidationDataMethod = "txt"` - `Status ProjectDomainNewResponseValidationDataStatus` - `const ProjectDomainNewResponseValidationDataStatusInitializing ProjectDomainNewResponseValidationDataStatus = "initializing"` - `const ProjectDomainNewResponseValidationDataStatusPending ProjectDomainNewResponseValidationDataStatus = "pending"` - `const ProjectDomainNewResponseValidationDataStatusActive ProjectDomainNewResponseValidationDataStatus = "active"` - `const ProjectDomainNewResponseValidationDataStatusDeactivated ProjectDomainNewResponseValidationDataStatus = "deactivated"` - `const ProjectDomainNewResponseValidationDataStatusError ProjectDomainNewResponseValidationDataStatus = "error"` - `ErrorMessage string` - `TXTName string` - `TXTValue string` - `VerificationData ProjectDomainNewResponseVerificationData` - `Status ProjectDomainNewResponseVerificationDataStatus` - `const ProjectDomainNewResponseVerificationDataStatusPending ProjectDomainNewResponseVerificationDataStatus = "pending"` - `const ProjectDomainNewResponseVerificationDataStatusActive ProjectDomainNewResponseVerificationDataStatus = "active"` - `const ProjectDomainNewResponseVerificationDataStatusDeactivated ProjectDomainNewResponseVerificationDataStatus = "deactivated"` - `const ProjectDomainNewResponseVerificationDataStatusBlocked ProjectDomainNewResponseVerificationDataStatus = "blocked"` - `const ProjectDomainNewResponseVerificationDataStatusError ProjectDomainNewResponseVerificationDataStatus = "error"` - `ErrorMessage string` - `ZoneTag string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/pages" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) domain, err := client.Pages.Projects.Domains.New( context.TODO(), "this-is-my-project-01", pages.ProjectDomainNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Name: cloudflare.F("this-is-my-domain-01.com"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", domain.ID) } ``` #### Response ```json { "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": "id", "certificate_authority": "lets_encrypt", "created_on": "created_on", "domain_id": "domain_id", "name": "this-is-my-domain-01.com", "status": "initializing", "validation_data": { "method": "http", "status": "initializing", "error_message": "error_message", "txt_name": "txt_name", "txt_value": "txt_value" }, "verification_data": { "status": "pending", "error_message": "error_message" }, "zone_tag": "zone_tag" }, "success": true } ``` ## Patch domain `client.Pages.Projects.Domains.Edit(ctx, projectName, domainName, body) (*ProjectDomainEditResponse, error)` **patch** `/accounts/{account_id}/pages/projects/{project_name}/domains/{domain_name}` Retry the validation status of a single domain. ### Parameters - `projectName string` Name of the project. - `domainName string` The domain name. - `body ProjectDomainEditParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type ProjectDomainEditResponse struct{…}` - `ID string` - `CertificateAuthority ProjectDomainEditResponseCertificateAuthority` - `const ProjectDomainEditResponseCertificateAuthorityGoogle ProjectDomainEditResponseCertificateAuthority = "google"` - `const ProjectDomainEditResponseCertificateAuthorityLetsEncrypt ProjectDomainEditResponseCertificateAuthority = "lets_encrypt"` - `CreatedOn string` - `DomainID string` - `Name string` The domain name. - `Status ProjectDomainEditResponseStatus` - `const ProjectDomainEditResponseStatusInitializing ProjectDomainEditResponseStatus = "initializing"` - `const ProjectDomainEditResponseStatusPending ProjectDomainEditResponseStatus = "pending"` - `const ProjectDomainEditResponseStatusActive ProjectDomainEditResponseStatus = "active"` - `const ProjectDomainEditResponseStatusDeactivated ProjectDomainEditResponseStatus = "deactivated"` - `const ProjectDomainEditResponseStatusBlocked ProjectDomainEditResponseStatus = "blocked"` - `const ProjectDomainEditResponseStatusError ProjectDomainEditResponseStatus = "error"` - `ValidationData ProjectDomainEditResponseValidationData` - `Method ProjectDomainEditResponseValidationDataMethod` - `const ProjectDomainEditResponseValidationDataMethodHTTP ProjectDomainEditResponseValidationDataMethod = "http"` - `const ProjectDomainEditResponseValidationDataMethodTXT ProjectDomainEditResponseValidationDataMethod = "txt"` - `Status ProjectDomainEditResponseValidationDataStatus` - `const ProjectDomainEditResponseValidationDataStatusInitializing ProjectDomainEditResponseValidationDataStatus = "initializing"` - `const ProjectDomainEditResponseValidationDataStatusPending ProjectDomainEditResponseValidationDataStatus = "pending"` - `const ProjectDomainEditResponseValidationDataStatusActive ProjectDomainEditResponseValidationDataStatus = "active"` - `const ProjectDomainEditResponseValidationDataStatusDeactivated ProjectDomainEditResponseValidationDataStatus = "deactivated"` - `const ProjectDomainEditResponseValidationDataStatusError ProjectDomainEditResponseValidationDataStatus = "error"` - `ErrorMessage string` - `TXTName string` - `TXTValue string` - `VerificationData ProjectDomainEditResponseVerificationData` - `Status ProjectDomainEditResponseVerificationDataStatus` - `const ProjectDomainEditResponseVerificationDataStatusPending ProjectDomainEditResponseVerificationDataStatus = "pending"` - `const ProjectDomainEditResponseVerificationDataStatusActive ProjectDomainEditResponseVerificationDataStatus = "active"` - `const ProjectDomainEditResponseVerificationDataStatusDeactivated ProjectDomainEditResponseVerificationDataStatus = "deactivated"` - `const ProjectDomainEditResponseVerificationDataStatusBlocked ProjectDomainEditResponseVerificationDataStatus = "blocked"` - `const ProjectDomainEditResponseVerificationDataStatusError ProjectDomainEditResponseVerificationDataStatus = "error"` - `ErrorMessage string` - `ZoneTag string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/pages" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.Pages.Projects.Domains.Edit( context.TODO(), "this-is-my-project-01", "this-is-my-domain-01.com", pages.ProjectDomainEditParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.ID) } ``` #### Response ```json { "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": "id", "certificate_authority": "lets_encrypt", "created_on": "created_on", "domain_id": "domain_id", "name": "this-is-my-domain-01.com", "status": "initializing", "validation_data": { "method": "http", "status": "initializing", "error_message": "error_message", "txt_name": "txt_name", "txt_value": "txt_value" }, "verification_data": { "status": "pending", "error_message": "error_message" }, "zone_tag": "zone_tag" }, "success": true } ``` ## Delete domain `client.Pages.Projects.Domains.Delete(ctx, projectName, domainName, body) (*ProjectDomainDeleteResponse, error)` **delete** `/accounts/{account_id}/pages/projects/{project_name}/domains/{domain_name}` Delete a Pages project's domain. ### Parameters - `projectName string` Name of the project. - `domainName string` The domain name. - `body ProjectDomainDeleteParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type ProjectDomainDeleteResponse interface{…}` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/pages" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) domain, err := client.Pages.Projects.Domains.Delete( context.TODO(), "this-is-my-project-01", "this-is-my-domain-01.com", pages.ProjectDomainDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", domain) } ``` #### Response ```json { "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": {}, "success": true } ```