Use this API to retrieve the file templates available to an entire instance:

Custom CI/CD templates are not available from these endpoints. For templates specific to a project, use the project templates API.

Users with the Guest role can’t access these templates. For more information, see project and group visibility.

List all Dockerfile templates

GET /api/v4/templates/dockerfiles

Lists all Dockerfile templates.

Parameters

NameTypeDescription
page
Query
IntegerCurrent page number
Default: 1
Example: 1
per_page
Query
IntegerNumber of items per page
Default: 20
Example: 20

Responses

CodeDescriptionSchema
200OKAPIEntitiesTemplatesList
400Bad Request—

Retrieve a Dockerfile template

GET /api/v4/templates/dockerfiles/{name}

Retrieves a specified Dockerfile template.

Parameters

NameTypeDescription
name
Path, required
StringThe name of the Dockerfile template

Responses

CodeDescriptionSchema
200OKAPIEntitiesTemplate
400Bad Request—
404Not Found—

List all .gitignore templates

GET /api/v4/templates/gitignores

Lists all .gitignore templates.

Parameters

NameTypeDescription
page
Query
IntegerCurrent page number
Default: 1
Example: 1
per_page
Query
IntegerNumber of items per page
Default: 20
Example: 20

Responses

CodeDescriptionSchema
200OKAPIEntitiesTemplatesList
400Bad Request—

Retrieve a .gitignore template

GET /api/v4/templates/gitignores/{name}

Retrieves a specified .gitignore template.

Parameters

NameTypeDescription
name
Path, required
StringThe name of the .gitignore template

Responses

CodeDescriptionSchema
200OKAPIEntitiesTemplate
400Bad Request—
404Not Found—

List all GitLab CI/CD YAML templates

GET /api/v4/templates/gitlab_ci_ymls

Lists all GitLab CI/CD YAML templates.

Parameters

NameTypeDescription
page
Query
IntegerCurrent page number
Default: 1
Example: 1
per_page
Query
IntegerNumber of items per page
Default: 20
Example: 20

Responses

CodeDescriptionSchema
200OKAPIEntitiesTemplatesList
400Bad Request—

Retrieve a GitLab CI/CD YAML template

GET /api/v4/templates/gitlab_ci_ymls/{name}

Retrieves a specified GitLab CI/CD YAML template.

Parameters

NameTypeDescription
name
Path, required
StringThe name of the GitLab CI/CD YAML template

Responses

CodeDescriptionSchema
200OKAPIEntitiesTemplate
400Bad Request—
404Not Found—

List all license templates

GET /api/v4/templates/licenses

Lists all available license templates.

Parameters

NameTypeDescription
popular
Query
BooleanIf passed, returns only popular licenses
page
Query
IntegerCurrent page number
Default: 1
Example: 1
per_page
Query
IntegerNumber of items per page
Default: 20
Example: 20

Responses

CodeDescriptionSchema
200OKAPIEntitiesLicense
400Bad Request—

Retrieve a license template

GET /api/v4/templates/licenses/{name}

Retrieves a specified license template. You can pass parameters to replace the license placeholder.

Parameters

NameTypeDescription
name
Path, required
StringThe name of the license template
project
Query
StringThe copyrighted project name
fullname
Query
StringThe full-name of the copyright holder

Responses

CodeDescriptionSchema
200OKAPIEntitiesLicense
400Bad Request—
404Not Found—

Schemas

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

APIEntitiesLicense

PropertyTypeDescription
conditionsArray of stringsExample: ["include-copyright"]
contentStringExample: GNU GENERAL PUBLIC LICENSE
descriptionStringExample: A simple license
html_urlStringExample: http://choosealicense.com/licenses/gpl-3.0
keyStringExample: gpl-3.0
limitationsArray of stringsExample: ["liability"]
nameStringExample: GNU General Public License v3.0
nicknameStringExample: GNU GPLv3
permissionsArray of stringsExample: ["commercial-use"]
popularBoolean—
source_urlString—

APIEntitiesTemplate

PropertyTypeDescription
contentStringExample: # Ruby gitignore template
nameStringExample: Ruby

APIEntitiesTemplatesList

PropertyTypeDescription
keyStringExample: mit
nameStringExample: MIT License