Use this API to administer and use GitLab Pages, including managing custom domains.

GitLab Pages must be enabled to use these endpoints.

List all Pages domains

GET /api/v4/pages/domains

Lists all Pages domains on the instance. You must have administrator access to the instance.

Parameters

NameTypeDescription
domain
Query
StringThe domain of the GitLab Pages site to filter on
page
Query
IntegerCurrent page number
Default: 1
Example: 1
per_page
Query
IntegerNumber of items per page
Default: 20
Example: 20

Responses

CodeDescriptionSchema
200OKAPIEntitiesPagesDomainBasic
400Bad Request—

Retrieve Pages settings for a project

GET /api/v4/projects/{id}/pages

Retrieves Pages settings for a specified project. You must have the Maintainer or Owner role for the project.

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project owned by the authenticated user

Responses

CodeDescriptionSchema
200OK—
400Bad Request—
401Unauthorized—
404Not Found—

Update Pages settings for a project

PATCH /api/v4/projects/{id}/pages

Updates Pages settings for a specified project. You must have the Maintainer or Owner role for the project.

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project owned by the authenticated user

Request body (application/json)

PropertyTypeDescription
pages_https_onlyBooleanWhether to force HTTPS
pages_primary_domainStringSet pages primary domain
pages_unique_domain_enabledBooleanWhether to use unique domain

Responses

CodeDescriptionSchema
200OK—
400Bad Request—
401Unauthorized—
404Not Found—

Unpublish Pages

DELETE /api/v4/projects/{id}/pages

Unpublishes Pages from a specified project. You must have the Maintainer or Owner role for the project.

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project owned by the authenticated user

Responses

CodeDescriptionSchema
204No Content—
400Bad Request—
401Unauthorized—
404Not Found—

List all Pages domains in a project

GET /api/v4/projects/{id}/pages/domains

Lists all Pages domains in a specified project. You must have permissions to view Pages domains.

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project owned by the authenticated user
page
Query
IntegerCurrent page number
Default: 1
Example: 1
per_page
Query
IntegerNumber of items per page
Default: 20
Example: 20

Responses

CodeDescriptionSchema
200OKAPIEntitiesPagesDomain
400Bad Request—
404Not Found—

Create Pages domain

POST /api/v4/projects/{id}/pages/domains

Creates a Pages domain in a specified project. You must have permissions to create Pages domains.

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project owned by the authenticated user

Request body (application/json)

PropertyTypeDescription
auto_ssl_enabledBooleanEnables automatic generation of SSL certificates issued by Let’s Encrypt for custom domains
Default: false
certificateString (binary) or stringThe certificate
domain
Required
StringThe domain
keyString (binary) or stringThe key
user_provided_certificateString—
user_provided_keyString—

Responses

CodeDescriptionSchema
201CreatedAPIEntitiesPagesDomain
400Bad Request—
404Not Found—

Retrieve a Pages domain

GET /api/v4/projects/{id}/pages/domains/{domain}

Retrieves a Pages domain from a specified project. You must have permissions to view Pages domains.

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project owned by the authenticated user
domain
Path, required
StringThe domain

Responses

CodeDescriptionSchema
200OKAPIEntitiesPagesDomain
400Bad Request—
404Not Found—

Update Pages domain

PUT /api/v4/projects/{id}/pages/domains/{domain}

Updates a specified Pages domain in a project. You must have permissions to change an existing Pages domain.

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project owned by the authenticated user
domain
Path, required
StringThe domain

Request body (application/json)

PropertyTypeDescription
auto_ssl_enabledBooleanEnables automatic generation of SSL certificates issued by Let’s Encrypt for custom domains
certificateString (binary) or stringThe certificate
keyString (binary) or stringThe key

Responses

CodeDescriptionSchema
200OK—
400Bad Request—
404Not Found—

Delete Pages domain

DELETE /api/v4/projects/{id}/pages/domains/{domain}

Deletes a specified Pages domain in a project.

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project owned by the authenticated user
domain
Path, required
StringThe domain

Responses

CodeDescriptionSchema
204Resource deleted—
400Bad Request—
404Not Found—

Verify Pages domain

PUT /api/v4/projects/{id}/pages/domains/{domain}/verify

Verifies a specified Pages domain in a project. You must have permissions to update Pages domains.

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project owned by the authenticated user
domain
Path, required
StringThe domain to verify

Responses

CodeDescriptionSchema
200OKAPIEntitiesPagesDomain
400Bad Request—
404Not Found—

Schemas

Objects returned by the operations above and objects nested in their request bodies.

APIEntitiesPagesDomain

PropertyTypeDescription
auto_ssl_enabledString—
certificateAPIEntitiesPagesDomainCertificate—
domainString—
enabled_untilString—
urlString—
verification_codeString—
verifiedString—

APIEntitiesPagesDomainBasic

PropertyTypeDescription
auto_ssl_enabledString—
certificate_expirationAPIEntitiesPagesDomainCertificateExpiration—
domainString—
enabled_untilString—
project_idString—
urlString—
verification_codeString—
verifiedString—

APIEntitiesPagesDomainCertificate

PropertyTypeDescription
certificateString—
certificate_textString—
expiredString—
subjectString—

APIEntitiesPagesDomainCertificateExpiration

PropertyTypeDescription
expirationString—
expiredString—