Create a GitHub Pages site

Configures a GitHub Pages site. For more information, see "About GitHub Pages."

switcheroo Preview (required)

Enabling and disabling Pages in the Pages API is currently available for developers to preview. See the blog post preview for more details. To access the new endpoints during the preview period, you must provide a custom media type in the Accept header:



string The token will be passed in the authorization header.



object The source branch and directory used to publish your Pages site.

string The repository branch used to publish your site's source files.

string The repository directory that includes the source files for the Pages site. Allowed paths are / or /docs. Default: /


POST https://api.github.com/repos///pages
authorization: bearer undefined
accept: application/vnd.github.v3+json
user-agent: octokit.rest
content-length: 0

Example Response

Status: 201
  "url": "https://api.github.com/repos/github/developer.github.com/pages",
  "status": "built",
  "cname": "developer.github.com",
  "custom_404": false,
  "html_url": "https://developer.github.com",
  "source": {
    "branch": "master",
    "path": "/"

See documentation on GitHub developer guides