Hanzo
OpenapiCloudflare

Creates a Cloudflare Pages project on the org's account.

Creates a Cloudflare Pages project on the org's account. Requires org admin.

POST /v1/cloudflare/pages/projects

Addresshttps://api.hanzo.ai/v1/cloudflare/pages/projects
MethodPOST
Operationpost_cloudflare_pages_projects
AuthAuthorization: Bearer $HANZO_API_KEY

Creates a Cloudflare Pages project on the org's account. Requires org admin. Only the modeled fields reach Cloudflare, so an unmodeled key in the request is dropped rather than forwarded.

Request

39 fields, body application/json (required).

FieldInTypeRequiredDescription
build_configbodyPagesBuildConfig
build_config.build_commandbodystringBuildCommand is what Cloudflare runs to build the site ("npm run build").
build_config.destination_dirbodystringDestinationDir is the directory the build leaves the site in ("dist"), relative to RootDir.
build_config.root_dirbodystringRootDir is where in the repository the build runs, for a project that is not at the repository root.
deployment_configsbodyPagesDeploymentConfigs
deployment_configs.previewbodyPagesDeploymentConfig
deployment_configs.preview.compatibility_datebodystringCompatibilityDate pins which Workers runtime behaviour the functions run under, as a date ("2024-01-01").
deployment_configs.preview.compatibility_flagsbodystring[]CompatibilityFlags turn individual runtime behaviours on or off ahead of, or behind, the date above ("nodejs_compat").
deployment_configs.preview.d1_databasesbodyobjectD1Databases binds D1 databases in, keyed by binding name.
deployment_configs.preview.d1_databases.*bodyPagesD1Binding
deployment_configs.preview.d1_databases.*.idbodystringID is the D1 database this binding points at, by Cloudflare's uuid.
deployment_configs.preview.env_varsbodyobjectEnvVars are the environment variables the functions see, KEYED BY VARIABLE NAME.
deployment_configs.preview.env_vars.*bodyPagesEnvVar
deployment_configs.preview.env_vars.*.typebodystringType is "plain_text" or "secret_text" and decides that: plain text is readable afterwards, secret text is write-only.
deployment_configs.preview.env_vars.*.valuebodystringValue is the variable's value. Under type "secret_text" Cloudflare encrypts it on arrival and never reads it back, so a later read of the project shows the…
deployment_configs.preview.kv_namespacesbodyobjectKVNamespaces binds KV namespaces into the functions, KEYED BY THE BINDING NAME the code reads (env.SESSIONS).
deployment_configs.preview.kv_namespaces.*bodyPagesKVBinding
deployment_configs.preview.kv_namespaces.*.namespace_idbodystringNamespaceID is the KV namespace this binding points at, by Cloudflare's id rather than its title.
deployment_configs.preview.r2_bucketsbodyobjectR2Buckets binds R2 buckets in, keyed by binding name.
deployment_configs.preview.r2_buckets.*bodyPagesR2Binding
deployment_configs.preview.r2_buckets.*.namebodystringName is the R2 bucket this binding points at, by bucket name — R2 addresses buckets by name where KV and D1 use ids.
deployment_configs.productionbodyPagesDeploymentConfig
deployment_configs.production.compatibility_datebodystringCompatibilityDate pins which Workers runtime behaviour the functions run under, as a date ("2024-01-01").
deployment_configs.production.compatibility_flagsbodystring[]CompatibilityFlags turn individual runtime behaviours on or off ahead of, or behind, the date above ("nodejs_compat").
deployment_configs.production.d1_databasesbodyobjectD1Databases binds D1 databases in, keyed by binding name.
deployment_configs.production.d1_databases.*bodyPagesD1Binding
deployment_configs.production.d1_databases.*.idbodystringID is the D1 database this binding points at, by Cloudflare's uuid.
deployment_configs.production.env_varsbodyobjectEnvVars are the environment variables the functions see, KEYED BY VARIABLE NAME.
deployment_configs.production.env_vars.*bodyPagesEnvVar
deployment_configs.production.env_vars.*.typebodystringType is "plain_text" or "secret_text" and decides that: plain text is readable afterwards, secret text is write-only.
deployment_configs.production.env_vars.*.valuebodystringValue is the variable's value. Under type "secret_text" Cloudflare encrypts it on arrival and never reads it back, so a later read of the project shows the…
deployment_configs.production.kv_namespacesbodyobjectKVNamespaces binds KV namespaces into the functions, KEYED BY THE BINDING NAME the code reads (env.SESSIONS).
deployment_configs.production.kv_namespaces.*bodyPagesKVBinding
deployment_configs.production.kv_namespaces.*.namespace_idbodystringNamespaceID is the KV namespace this binding points at, by Cloudflare's id rather than its title.
deployment_configs.production.r2_bucketsbodyobjectR2Buckets binds R2 buckets in, keyed by binding name.
deployment_configs.production.r2_buckets.*bodyPagesR2Binding
deployment_configs.production.r2_buckets.*.namebodystringName is the R2 bucket this binding points at, by bucket name — R2 addresses buckets by name where KV and D1 use ids.
namebodystringName is the project name, and it is also the address: the site answers at <name>.pages.dev.
production_branchbodystringProductionBranch is which git branch builds to production; every other branch builds a preview.

Response

StatusBodyMeaning
200ok

200 body — 1 field.

FieldInTypeAlwaysDescription
(body)bodyanyyes

Failure carries the platform error shape — see Errors.

Examples

hanzo cloudflare pages projects create

Cloudflare API · All Hanzo APIs · Interactive reference

How is this guide?

On this page