Skip to content
Start here

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.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Pages ReadPages Write
ParametersExpand Collapse
projectName string

Name of the project.

deploymentID string

Identifier.

maxLength32
query ProjectDeploymentGetParams
AccountID param.Field[string]

Identifier.

maxLength32
ReturnsExpand Collapse
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 boolOptional

Enable build caching for the project.

BuildCommand stringOptional

Command used to build project.

DestinationDir stringOptional

Assets output directory of the build.

RootDir stringOptional

Directory to run the command.

CreatedOn Time

When the deployment was created.

formatdate-time
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.

One of the following:
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.

One of the following:
type DeploymentEnvVarsPagesPlainTextEnvVar struct{…}

A plaintext environment variable.

Type DeploymentEnvVarsPagesPlainTextEnvVarType
Value string

Environment variable value.

type DeploymentEnvVarsPagesSecretTextEnvVar struct{…}

An encrypted environment variable.

Type DeploymentEnvVarsPagesSecretTextEnvVarType
Value string

Secret value.

Environment DeploymentEnvironment

Type of deploy.

One of the following:
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.

formatdate-time
Name StageName

The current build stage.

One of the following:
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.

formatdate-time
Status StageStatus

State of the current stage.

One of the following:
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.

formatdate-time
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
DeprecatedDeploymentsEnabled bool

Use production_deployments_enabled and preview_deployment_setting for more granular control.

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.

One of the following:
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.

One of the following:
const DeploymentSourceTypeGitHub DeploymentSourceType = "github"
const DeploymentSourceTypeGitlab DeploymentSourceType = "gitlab"
Stages []Stage

List of past stages.

EndedOn Time

When the stage ended.

formatdate-time
Name StageName

The current build stage.

One of the following:
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.

formatdate-time
Status StageStatus

State of the current stage.

One of the following:
const StageStatusSuccess StageStatus = "success"
const StageStatusIdle StageStatus = "idle"
const StageStatusActive StageStatus = "active"
const StageStatusFailure StageStatus = "failure"
const StageStatusCanceled StageStatus = "canceled"
URL string

The live URL to view this deployment.

UsesFunctions boolOptional

Whether the deployment uses functions.

Get deployment info

package main

import (
  "context"
  "fmt"

  "github.com/stainless-sdks/cloudflare-go"
  "github.com/stainless-sdks/cloudflare-go/option"
  "github.com/stainless-sdks/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)
}
{
  "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
}
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": "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
}