POST
POST /repos/{owner}/{repo}/pages/deployments — GitHub API
GitHub token (required); https://api.github.com
GitHub APICreate a GitHub Pages deployment
- Base URL
- https://api.github.com
- Auth
- Authorization: Bearer <GITHUB_API_KEY>
- Last verified
- 2026-10-20 · upstream hash matched
Actions Try in browser→
Agents: curl -H "Accept: text/markdown" this URL
→ 370 tokens · Vary: Accept
→ 370 tokens · Vary: Accept
Critical gotchas
GitHub recommends an Accept: application/vnd.github+json header and an explicit X-GitHub-Api-Version header.
Fine-grained tokens only authorize repositories and permissions selected when the token is created.
cURL
curl -X POST 'https://api.github.com/repos/example-owner/example-repo/pages/deployments' \ -H "Authorization: Bearer $GITHUB_TOKEN" \ -H 'Accept: application/vnd.github+json' \ -H 'X-GitHub-Api-Version: 2026-03-10' \ -H 'Content-Type: application/json' \ -d '{ "pages_build_version": "GITHUB_SHA", "oidc_token": "example-oidc-token"}'
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| owner | path | string | Yes | The account owner of the repository. The name is not case sensitive. |
| repo | path | string | Yes | The name of the repository without the `.git` extension. The name is not case sensitive. |
| artifact_id | body | number | No | 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_url | body | string | No | 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. |
| environment | body | string | No | The target environment for this GitHub Pages deployment. |
| pages_build_version | body | string | Yes | A unique string that represents the version of the build for this deployment. |
| oidc_token | body | string | Yes | The OIDC token issued by GitHub Actions certifying the origin of the deployment. |
Response 200 OK
{
"id": 0,
"status_url": "https://api.github.com/repos/github/hello-world/pages/deployments/4fd754f7e594640989b406850d0bc8f06a121251",
"page_url": "hello-world.github.io",
"preview_url": "monalisa-1231a2312sa32-23sda74.drafts.github.io"
} Get a free GitHub API key → sponsored Affiliate link - we may earn a commission, at no extra cost to you.