# Create a GitHub Enterprise Server Pages site

From **GitHub v3 REST API**.

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

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

## Parameters

### `owner`

- Location: path
- Required: true
- Type: `string`

### `repo`

- Location: path
- Required: true
- Type: `string`

## Request body

- Required: true
### `application/json`

- Type: `object`
- Nullable: true

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

```json
{
  "source": {
    "branch": "main",
    "path": "/docs"
  }
}
```

```json
{"description":"The source branch and directory used to publish your Pages site.","nullable":true,"properties":{"source":{"description":"The source branch and directory used to publish your Pages site.","properties":{"branch":{"description":"The repository branch used to publish your site's source files.","type":"string"},"path":{"default":"/","description":"The repository directory that includes the source files for the Pages site. Allowed paths are `/` or `/docs`. Default: `/`","enum":["/","/docs"],"type":"string"}},"required":["branch"],"type":"object"}},"required":["source"],"type":"object"}
```

## Responses

### `201`

Response

### `application/json`

- Type: `object`

The configuration for GitHub Pages for a repository.

```json
{
  "cname": "developer.github.com",
  "custom_404": false,
  "html_url": "https://developer.github.com",
  "https_certificate": {
    "description": "Certificate is approved",
    "domains": [
      "developer.github.com"
    ],
    "expires_at": "2021-05-22",
    "state": "approved"
  },
  "https_enforced": true,
  "public": true,
  "source": {
    "branch": "master",
    "path": "/"
  },
  "status": "built",
  "url": "https://api.github.com/repos/github/developer.github.com/pages"
}
```

```json
{"description":"The configuration for GitHub Pages for a repository.","properties":{"cname":{"description":"The Pages site's custom domain","example":"example.com","nullable":true,"type":"string"},"custom_404":{"default":false,"description":"Whether the Page has a custom 404 page.","example":false,"type":"boolean"},"html_url":{"description":"The web address the Page can be accessed from.","example":"https://example.com","format":"uri","type":"string"},"https_certificate":{"$ref":"#/components/schemas/pages-https-certificate"},"https_enforced":{"description":"Whether https is enabled on the domain","example":true,"type":"boolean"},"pending_domain_unverified_at":{"description":"The timestamp when a pending domain becomes unverified.","format":"date-time","nullable":true,"type":"string"},"protected_domain_state":{"description":"The state if the domain is verified","enum":["pending","verified","unverified"],"example":"pending","nullable":true,"type":"string"},"public":{"description":"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.","example":true,"type":"boolean"},"source":{"$ref":"#/components/schemas/pages-source-hash"},"status":{"description":"The status of the most recent build of the Page.","enum":["built","building","errored"],"example":"built","nullable":true,"type":"string"},"url":{"description":"The API address for accessing this Page resource.","example":"https://api.github.com/repos/github/hello-world/pages","format":"uri","type":"string"}},"required":["url","status","cname","custom_404","public"],"title":"GitHub Pages","type":"object"}
```

### `409`

Conflict

### `application/json`

- Type: `object`

Basic Error

```json
{"description":"Basic Error","properties":{"documentation_url":{"type":"string"},"message":{"type":"string"},"status":{"type":"string"},"url":{"type":"string"}},"title":"Basic Error","type":"object"}
```

### `422`

Validation failed

### `application/json`

- Type: `object`

Validation Error

```json
{"description":"Validation Error","properties":{"documentation_url":{"type":"string"},"errors":{"items":{"properties":{"code":{"type":"string"},"field":{"type":"string"},"index":{"type":"integer"},"message":{"type":"string"},"resource":{"type":"string"},"value":{"oneOf":[{"nullable":true,"type":"string"},{"nullable":true,"type":"integer"},{"items":{"type":"string"},"nullable":true,"type":"array"}]}},"required":["code"],"type":"object"},"type":"array"},"message":{"type":"string"}},"required":["message","documentation_url"],"title":"Validation Error","type":"object"}
```

## Request examples

### cURL

```shell
curl --request POST \
  --url {protocol}://{hostname}/api/v3/repos/{owner}/{repo}/pages \
  --header 'content-type: application/json' \
  --data '{
  "source": {
    "branch": "main",
    "path": "/docs"
  }
}'
```
