Skip to content

Update information about a GitHub Pages site

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

Updates information for a GitHub Pages site. For more information, see “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.

API method documentation

owner
required
string

The account owner of the repository. The name is not case sensitive.

repo
required
string

The name of the repository without the .git extension. The name is not case sensitive.

Media type application/json
Any of:
object
cname

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.”

string
nullable
https_enforced

Specify whether HTTPS should be enforced for the repository.

boolean
build_type
required

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.

string
Allowed values: legacy workflow
source
Any of:

Update the source for the repository. Must include the branch name, and may optionally specify the subdirectory /docs. Possible values are "gh-pages", "master", and "master /docs".

string
Allowed values: gh-pages master master /docs
Examples
Example default
{
"cname": "octocatblog.com",
"source": {
"branch": "main",
"path": "/"
}
}

Response

Bad Request

Basic Error

Basic Error

object
message
string
documentation_url
string
url
string
status
string
Example generated
{
"message": "example",
"documentation_url": "example",
"url": "example",
"status": "example"
}

Conflict

Media type application/json
Basic Error

Basic Error

object
message
string
documentation_url
string
url
string
status
string
Example generated
{
"message": "example",
"documentation_url": "example",
"url": "example",
"status": "example"
}

Validation failed, or the endpoint has been spammed.

Media type application/json
Validation Error

Validation Error

object
message
required
string
documentation_url
required
string
errors
Array<object>
object
resource
string
field
string
message
string
code
required
string
index
integer
value
One of:
string
nullable
Example generated
{
"message": "example",
"documentation_url": "example",
"errors": [
{
"resource": "example",
"field": "example",
"message": "example",
"code": "example",
"index": 1,
"value": [
"example"
]
}
]
}