PUT/repos/{owner}/{repo}/pages

Update information about a GitHub Pages site

Updates GitHub Pages settings for a repository. Provide at least one of build_type, source, or cname; build_type accepts legacy or workflow, and source accepts a branch name with an optional /docs path or an object containing branch and path. The authenticated user must be a repository administrator, maintainer, or have the manage GitHub Pages settings permission.

2 parameters · 4 body fields
ownerstringrequired
The account owner of the repository. The name is not case sensitive.
repostringrequired
The repository name without the `.git` extension. The name is not case sensitive.

GitHub Pages settings to update. Include at least one of build_type, source, or cname.

cnamestringoptional
Specify a custom domain for the repository. Sending a `null` value will remove the custom domain. For more about custom domains, see "[Using a custom domain with GitHub Pages](https://docs.github.com/pages/configuring-a-custom-domain-for-your-github-pages-site)."
https_enforcedbooleanoptional
Specify whether HTTPS should be enforced for the repository.
build_typestringrequired
The process by which the GitHub Pages site will be built. `workflow` means that the site is built by a custom GitHub Actions workflow. `legacy` means that the site is built by GitHub when changes are pushed to a specific branch.
Allowed:legacyworkflow
sourcestringoptional
The repository source, specified as `gh-pages`, `master`, or `master /docs`, or as an object containing the branch name and path.
Allowed:gh-pagesmastermaster /docs

4 status codes
204Returns no response body after updating the GitHub Pages site.
400Returned when the request is invalid.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
409Returned when the update conflicts with the current state.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
422Returned when validation fails or the endpoint has been spammed.
messagestringrequired
documentation_urlstringrequired
errorsarray<object>optional

Error handling

A 400 is returned for a bad request. A 409 indicates a conflict, and a 422 is returned when validation fails or the endpoint has been spammed. The owner and repo path parameters identify the repository; provide at least one of build_type, source, or cname, and use an allowed build_type value or source format.