Sample - GitHub REST API
POST/repos/{owner}/{repo}/pages/deployments

Create a GitHub Pages deployment

Create a GitHub Pages deployment for a repository.

The authenticated user must have write permission to the repository.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

2 parameters · 5 body fields
ownerstringrequired
The account owner of the repository. The name is not case sensitive.
repostringrequired
The name of the repository without the `.git` extension. The name is not case sensitive.
artifact_idnumberoptional
The ID of an artifact that contains the .zip or .tar of static assets to deploy. The artifact belongs to the repository. Either `artifact_id` or `artifact_url` are required.
artifact_urlstringoptional
The URL of an artifact that contains the .zip or .tar of static assets to deploy. The artifact belongs to the repository. Either `artifact_id` or `artifact_url` are required.
environmentstringoptional
The target environment for this GitHub Pages deployment.
Default:github-pages
pages_build_versionstringrequired
A unique string that represents the version of the build for this deployment.
Default:GITHUB_SHA
oidc_tokenstringrequired
The OIDC token issued by GitHub Actions certifying the origin of the deployment.

4 status codes
200Response
idintegerrequired
The ID of the GitHub Pages deployment. This is the Git SHA of the deployed commit.
status_urlstringrequired
The URI to monitor GitHub Pages deployment status.
page_urlstringrequired
The URI to the deployed GitHub Pages.
preview_urlstringoptional
The URI to the deployed GitHub Pages preview.
400Bad Request
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
404Resource not found
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
422Validation failed, or the endpoint has been spammed.
messagestringrequired
documentation_urlstringrequired
errorsarray<object>optional

Error handling

A 400 is returned: Bad Request. A 404 is returned: Resource not found. A 422 is returned: Validation failed, or the endpoint has been spammed.