Get project
client.Pages.Projects.Get(ctx, projectName, query) (*Project, error)
GET/accounts/{account_id}/pages/projects/{project_name}
Fetch a project by name.
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
Example:
API Email + API Key
The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.
Example:
The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.
Example:
Accepted Permissions (at least one required)
Get project
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)
}
{
"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
}Returns Examples
{
"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
}