---
title: "Create a GitHub Pages site"
method: POST
path: "/repos/{owner}/{repo}/pages"
tags: ["repos"]
---

# Create a GitHub Pages site

`POST /repos/{owner}/{repo}/pages`

Configures a GitHub Pages site. For more information, see "[About GitHub Pages](/github/working-with-github-pages/about-github-pages)."

The authenticated user must be a repository administrator, maintainer, or have the 'manage GitHub Pages settings' permission.

OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.

## Path parameters

- `owner` string, required
- `repo` string, required

## Request body

- union — The source branch and directory used to publish your Pages site.
  - object
    - `build_type` 'legacy' | 'workflow' — The process in which the Page will be built. Possible values are `"legacy"` and `"workflow"`.
    - `source` object, required — The source branch and directory used to publish your Pages site.
      - `branch` string, required — The repository branch used to publish your site's source files.
      - `path` '/' | '/docs' — The repository directory that includes the source files for the Pages site. Allowed paths are `/` or `/docs`. Default: `/`
  - object
    - `build_type` 'legacy' | 'workflow', required — The process in which the Page will be built. Possible values are `"legacy"` and `"workflow"`.
    - `source` object — The source branch and directory used to publish your Pages site.
      - `branch` string, required — The repository branch used to publish your site's source files.
      - `path` '/' | '/docs' — The repository directory that includes the source files for the Pages site. Allowed paths are `/` or `/docs`. Default: `/`

## Response `201`

Response

- Page — The configuration for GitHub Pages for a repository.
  - `url` string, uri, required — The API address for accessing this Page resource.
  - `status` 'built' | 'building' | 'errored', nullable, required — The status of the most recent build of the Page.
  - `cname` string, nullable, required — The Pages site's custom domain
  - `protected_domain_state` 'pending' | 'verified' | 'unverified', nullable — The state if the domain is verified
  - `pending_domain_unverified_at` string, date-time, nullable — The timestamp when a pending domain becomes unverified.
  - `custom_404` boolean, required — Whether the Page has a custom 404 page.
  - `html_url` string, uri — The web address the Page can be accessed from.
  - `build_type` 'legacy' | 'workflow', nullable — The process in which the Page will be built.
  - `source` PagesSourceHash
    - `branch` string, required
    - `path` string, required
  - `public` boolean, required — Whether the GitHub Pages site is publicly visible. If set to `true`, the site is accessible to anyone on the internet. If set to `false`, the site will only be accessible to users who have at least `read` access to the repository that published the site.
  - `https_certificate` PagesHttpsCertificate
    - `state` 'new' | 'authorization_created' | 'authorization_pending' | 'authorized' | 'authorization_revoked' | 'issued' | 'uploaded' | 'approved' | 'errored' | 'bad_authz' | 'destroy_pending' | 'dns_changed', required
    - `description` string, required
    - `domains` string[], required — Array of the domain set and its alternate name (if it is configured)
    - `expires_at` string, date
  - `https_enforced` boolean — Whether https is enabled on the domain

## Other responses

- `409` — Conflict
- `422` — Validation failed, or the endpoint has been spammed.

---

[API](https://skmtc.net/github/apis/rest-api.md) · [All operations](https://skmtc.net/github/apis/rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/github/rest-api/versions/80850db290cd/schema)
