Use this API to retrieve project-specific templates, in addition to the templates common to the entire instance:

These endpoints supersede the instance template endpoints, which are scheduled for removal in API version 5. File templates for groups are also supported.

List all templates of a particular type

GET /api/v4/projects/{id}/templates/{type}

Lists all templates of a specified type for a project.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
type
Path, required
StringType of the template
Allowed values: dockerfiles, gitignores, gitlab_ci_ymls, licenses, issues, merge_requests
Minimum length: 1
page
Query
IntegerPage number of results to retrieve
Default: 1
Example: 1
per_page
Query
IntegerNumber of items to list per page
Default: 20
Example: 20

Responses

CodeDescriptionSchema
200OKArray of APIEntitiesTemplatesList
400Bad Request—
401Unauthorized—
404Not found—

Retrieve a template of a particular type

GET /api/v4/projects/{id}/templates/{type}/{name}

Retrieves a template of a specified type for a project.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
type
Path, required
StringType of the template
Allowed values: dockerfiles, gitignores, gitlab_ci_ymls, licenses, issues, merge_requests
Minimum length: 1
name
Path, required
StringKey of the template, as obtained from the collection endpoint
Example: MIT
source_template_project_id
Query
IntegerID of the project where the template is stored. Useful when multiple templates from different projects have the same name. If omitted, the match from the closest ancestor is returned
Example: 1
project
Query
StringProject name to use when expanding placeholders in the template. Affects only licenses
Example: GitLab
fullname
Query
StringFull name of the copyright holder to use when expanding placeholders in the template. Affects only licenses
Example: GitLab B.V.

Responses

CodeDescriptionSchema
200OKAPIEntitiesLicense
400Bad Request—
401Unauthorized—
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—

APIEntitiesTemplatesList

PropertyTypeDescription
keyStringExample: mit
nameStringExample: MIT License