Documentation Style Guide

This document defines the standards for GitLab's documentation content and files.

For broader information about the documentation, see the Documentation guidelines.

For programmatic help adhering to the guidelines, see linting.

See the GitLab handbook for further writing style guidelines that apply to all GitLab content, not just documentation.

Documentation is the single source of truth (SSOT)

Why a single source of truth

The documentation is the SSOT for all information related to the implementation, usage, and troubleshooting of GitLab products and features. It evolves continually, in keeping with new products and features, and with improvements for clarity, accuracy, and completeness.

This policy prevents information silos, ensuring that it remains easy to find information about GitLab products.

It also informs decisions about the kinds of content we include in our documentation.

The documentation is a continually evolving SSOT for all information related to the implementation, usage, and troubleshooting of GitLab products and features.

All information

Include problem-solving actions that may address rare cases or be considered 'risky', so long as proper context is provided in the form of fully detailed warnings and caveats. This kind of content should be included as it could be helpful to others and, when properly explained, its benefits outweigh the risks. If you think you have found an exception to this rule, contact the Technical Writing team.

We will add all troubleshooting information to the documentation, no matter how unlikely a user is to encounter a situation. For the Troubleshooting sections, people in GitLab Support can merge additions themselves.

All media types

Include any media types/sources if the content is relevant to readers. You can freely include or link presentations, diagrams, videos, etc.; no matter who it was originally composed for, if it is helpful to any of our audiences, we can include it.

No special types

In the software industry, it is a best practice to organize documentation in different types. For example, Divio recommends:

  1. Tutorials
  2. How-to guides
  3. Explanation
  4. Reference (for example, a glossary)

At GitLab, we have so many product changes in our monthly releases that we can't afford to continually update multiple types of information. If we have multiple types, the information will become outdated. Therefore, we have a single template for documentation.

We currently do not distinguish specific document types, although we are open to reconsidering this policy once the documentation has reached a future stage of maturity and quality. If you are reading this, then despite our continual improvement efforts, that point hasn't been reached.

There is a temptation to summarize the information on another page. This will cause the information to live in two places. Instead, link to the SSOT and explain why it is important to consume the information.

Organize by topic, not by type

Beyond top-level audience-type folders (e.g. administration), we organize content by topic, not by type, so that it can be located as easily as possible within the single-source-of-truth (SSOT) section for the subject matter.

For example, do not create groupings of similar media types (e.g. glossaries, FAQs, or sets of all articles or videos).

Such grouping of content by type makes it difficult to browse for the information you need and difficult to maintain up-to-date content. Instead, organize content by its subject (e.g. everything related to CI goes together) and cross-link between any related content.

Docs-first methodology

We employ a docs-first methodology to help ensure that the docs remain a complete and trusted resource, and to make communicating about the use of GitLab more efficient.

New information that would be useful toward the future usage or troubleshooting of GitLab should not be written directly in a forum or other messaging system, but added to a docs MR and then referenced, as described above. Note that among any other doc changes, you can always add a Troubleshooting section to a doc if none exists, or un-comment and use the placeholder Troubleshooting section included as part of our doc template, if present.

The more we reflexively add useful information to the docs, the more (and more successfully) the docs will be used to efficiently accomplish tasks and solve problems.

If you have questions when considering, authoring, or editing docs, ask the Technical Writing team on Slack in #docs or in GitLab by mentioning the writer for the applicable DevOps stage. Otherwise, forge ahead with your best effort. It does not need to be perfect; the team is happy to review and improve upon your content. Please review the Documentation guidelines before you begin your first documentation MR.

Having a knowledge base in any form that is separate from the documentation would be against the docs-first methodology because the content would overlap with the documentation.

Markdown

All GitLab documentation is written using Markdown.

The documentation website uses GitLab Kramdown as its Markdown rendering engine. For a complete Kramdown reference, see the GitLab Markdown Kramdown Guide.

The gitlab-kramdown Ruby gem will support all GFM markup in the future. That is, all markup that is supported for display in the GitLab application itself. For now, use regular Markdown markup, following the rules in the linked style guide.

Note that Kramdown-specific markup (e.g., {:.class}) will not render properly on GitLab instances under /help.

Hard-coded HTML is valid, although it's discouraged to be used while we have /help. HTML is permitted as long as:

Markdown Rules

GitLab ensures that the Markdown used across all documentation is consistent, as well as easy to review and maintain, by testing documentation changes with markdownlint. This lint test fails when any document has an issue with Markdown formatting that may cause the page to render incorrectly within GitLab. It will also fail when a document is using non-standard Markdown (which may render correctly, but is not the current standard for GitLab documentation).

Markdown rule MD044/proper-names (capitalization)

A rule that could cause confusion is MD044/proper-names, as it might not be immediately clear what caused markdownlint to fail, or how to correct the failure. This rule checks a list of known words, listed in the .markdownlint.json file in each project, to verify that proper capitalization and backticks are used. Words in backticks will be ignored by markdownlint.

In general, product names should follow the exact capitalization of the official names of the products, protocols, etc.

Some examples that will fail if incorrect capitalization is used:

Additionally, commands, parameters, values, filenames, etc. must be included in backticks. For example:

Structure

Organize by topic, not by type

Because we want documentation to be a SSOT, we should organize by topic, not by type.

Folder structure overview

The documentation is separated by top-level audience folders user, administration, and development (contributing) folders.

Beyond that, we primarily follow the structure of the GitLab user interface or API.

Our goal is to have a clear hierarchical structure with meaningful URLs like docs.gitlab.com/user/project/merge_requests/. With this pattern, you can immediately tell that you are navigating to user-related documentation about Project features; specifically about Merge Requests. Our site's paths match those of our repository, so the clear structure also makes documentation easier to update.

The table below shows what kind of documentation goes where.

Directory What belongs here
doc/user/ User related documentation. Anything that can be done within the GitLab UI goes here, including usage of the /admin interface.
doc/administration/ Documentation that requires the user to have access to the server where GitLab is installed. The admin settings that can be accessed via GitLab's interface exist under doc/user/admin_area/.
doc/api/ API related documentation.
doc/development/ Documentation related to the development of GitLab, whether contributing code or docs. Related process and style guides should go here.
doc/legal/ Legal documents about contributing to GitLab.
doc/install/ Contains instructions for installing GitLab.
doc/update/ Contains instructions for updating GitLab.
doc/topics/ Indexes per topic (doc/topics/topic-name/index.md): all resources for that topic.

Working with directories and files

  1. When you create a new directory, always start with an index.md file. Do not use another file name and do not create README.md files.
  2. Do not use special characters and spaces, or capital letters in file names, directory names, branch names, and anything that generates a path.
  3. When creating a new document and it has more than one word in its name, make sure to use underscores instead of spaces or dashes (-). For example, a proper naming would be import_projects_from_github.md. The same rule applies to images.
  4. For image files, do not exceed 100KB.
  5. Do not upload video files to the product repositories. Link or embed videos instead.
  6. There are four main directories, user, administration, api and development.
  7. The doc/user/ directory has five main subdirectories: project/, group/, profile/, dashboard/ and admin_area/.
  8. doc/user/project/ should contain all project related documentation.
  9. doc/user/group/ should contain all group related documentation.
  10. doc/user/profile/ should contain all profile related documentation. Every page you would navigate under /profile should have its own document, i.e. account.md, applications.md, emails.md, etc.
  11. doc/user/dashboard/ should contain all dashboard related documentation.
  12. doc/user/admin_area/ should contain all admin related documentation describing what can be achieved by accessing GitLab's admin interface (not to be confused with doc/administration where server access is required).
    1. Every category under /admin/application_settings should have its own document located at doc/user/admin_area/settings/. For example, the Visibility and Access Controls category should have a document located at doc/user/admin_area/settings/visibility_and_access_controls.md.
  13. The doc/topics/ directory holds topic-related technical content. Create doc/topics/topic-name/subtopic-name/index.md when subtopics become necessary. General user- and admin- related documentation, should be placed accordingly.
  14. The directories /workflow/, /university/, and /articles/ have been deprecated and the majority their docs have been moved to their correct location in small iterations.

If you are unsure where a document or a content addition should live, this should not stop you from authoring and contributing. You can use your best judgment and then ask the reviewer of your MR to confirm your decision, and/or ask a technical writer at any stage in the process. The technical writing team will review all documentation changes, regardless, and can move content if there is a better place for it.

Avoid duplication

Do not include the same information in multiple places. Link to a SSOT instead.

References across documents

Structure within documents

Language

Text

```md ## Header

Paragraph.

Emphasis

Punctuation

Check the general punctuation rules for the GitLab documentation on the table below. Check specific punctuation rules for lists below.

Rule Example
Always end full sentences with a period. For a complete overview, read through this document.
Always add a space after a period when beginning a new sentence For a complete overview, check this doc. For other references, check out this guide.
Do not use double spaces. ---
Do not use tabs for indentation. Use spaces instead. You can configure your code editor to output spaces instead of tabs when pressing the tab key. ---
Use serial commas ("Oxford commas") before the final 'and/or' in a list. You can create new issues, merge requests, and milestones.
Always add a space before and after dashes when using it in a sentence (for replacing a comma, for example). You should try this - or not.
Always use lowercase after a colon. Related Issues: a way to create a relationship between issues.

Placeholder text

Often in examples, a writer will provide a command or configuration that is complete apart from a value specific to the reader.

In these cases, use < and > to call out where a reader must replace text with their own value.

For example:

cp <your_source_directory> <your_destination_directory>

Lists

Ordered vs. unordered lists

Only use ordered lists when their items describe a sequence of steps to follow.

Do:

These are the steps to do something:

1. First, do the first step.
1. Then, do the next step.
1. Finally, do the last step.

Don't:

This is a list of available features:

1. Feature 1
1. Feature 2
1. Feature 3

Markup

Punctuation

```md The list is as follows:

Examples:

Do:

Don't:

Do:

Don't (vary use of periods; majority rules):

Nesting inside a list item

It is possible to nest items under a list item, so that they render with the same indentation as the list item. This can be done with:

Items nested in lists should always align with the first character of the list item. In unordered lists (using -), this means two spaces for each level of indentation:

- Unordered list item 1

  A line nested using 2 spaces to align with the `U` above.

- Unordered list item 2

  > A quote block that will nest
  > inside list item 2.

- Unordered list item 3

  ```text
  a codeblock that will next inside list item 3
  ```

- Unordered list item 4

  ![an image that will nest inside list item 4](image.png)

For ordered lists, use three spaces for each level of indentation:

1. Ordered list item 1

   A line nested using 3 spaces to align with the `O` above.

1. Ordered list item 2

   > A quote block that will nest
   > inside list item 2.

1. Ordered list item 3

   ```text
   a codeblock that will next inside list item 3
   ```

1. Ordered list item 4

   ![an image that will nest inside list item 4](image.png)

You can nest full lists inside other lists using the same rules as above. If you wish to mix types, that is also possible, as long as you don't mix items at the same level:

1. Ordered list item one.
1. Ordered list item two.
   - Nested unordered list item one.
   - Nested unordered list item two.
1. Ordered list item three.

- Unordered list item one.
- Unordered list item two.
  1. Nested ordered list item one.
  1. Nested ordered list item two.
- Unordered list item three.

Quotes

Valid for Markdown content only, not for frontmatter entries:

For other punctuation rules, please refer to the GitLab UX guide.

Headings

Don't:

md [Geo Troubleshooting](https://docs.gitlab.com/ee/administration/geo/replication/troubleshooting.html) [Geo Troubleshooting](/ee/administration/geo/replication/troubleshooting.md)

Do:

md [Geo Troubleshooting](../../geo/replication/troubleshooting.md)

Don't:

md [merge requests](../../merge_requests/) [issues](../../issues/tags.html) [issue tags](../../issues/tags.html#stages)

Do:

md [merge requests](../../merge_requests/index.md) [issues](../../issues/tags.md) [issue tags](../../issues/tags.md#stages)

Don't link directly to:

These will fail for:

Instead:

Example:

For more information, see the [confidential issue](../../user/project/issues/confidential_issues.md) `https://gitlab.com/gitlab-org/gitlab-foss/issues/<issue_number>`.

To indicate the steps of navigation through the UI:

Images

Inside the document:

Remove image shadow

All images displayed on the GitLab Docs site have a box shadow by default. To remove the box shadow, use the image class .image-noshadow applied directly to an HTML img tag:

<img src="path/to/image.jpg" alt="Alt text (required)" class="image-noshadow">

Videos

Adding GitLab's existing YouTube video tutorials to the documentation is highly encouraged, unless the video is outdated. Videos should not replace documentation, but complement or illustrate it. If content in a video is fundamental to a feature and its key use cases, but this is not adequately covered in the documentation, add this detail to the documentation text or create an issue to review the video and do so.

Do not upload videos to the product repositories. Link or embed them instead.

To link out to a video, include a YouTube icon so that readers can quickly and easily scan the page for videos before reading:

<i class="fa fa-youtube-play youtube" aria-hidden="true"></i>
For an overview, see [Video Title](link-to-video).

You can link any up-to-date video that is useful to the GitLab user.

Embed videos

Introduced in GitLab 12.1.

The GitLab Docs site supports embedded videos.

You can only embed videos from GitLab's official YouTube account. For videos from other sources, link them instead.

In most cases, it is better to link to video instead, because an embed takes up a lot of space on the page and can be distracting to readers.

To embed a video, follow the instructions below and make sure you have your MR reviewed and approved by a technical writer.

  1. Copy the code below and paste it into your Markdown file. Leave a blank line above and below it. Do NOT edit the code (don't remove or add any spaces, etc).
  2. On YouTube, visit the video URL you want to display. Copy the regular URL from your browser (https://www.youtube.com/watch?v=VIDEO-ID) and replace the video title and link in the line under <div class="video-fallback">.
  3. On YouTube, click Share, then Embed.
  4. Copy the <iframe> source (src) URL only (https://www.youtube.com/embed/VIDEO-ID), and paste it, replacing the content of the src field in the iframe tag.
leave a blank line here
<div class="video-fallback">
  See the video: <a href="https://www.youtube.com/watch?v=MqL6BMOySIQ">Video title</a>.
</div>
<figure class="video-container">
  <iframe src="https://www.youtube.com/embed/MqL6BMOySIQ" frameborder="0" allowfullscreen="true"> </iframe>
</figure>
leave a blank line here

This is how it renders on the GitLab Docs site:

See the video: What is GitLab.

Notes:

  • The figure tag is required for semantic SEO and the video_container class is necessary to make sure the video is responsive and displays nicely on different mobile devices.
  • The <div class="video-fallback"> is a fallback necessary for GitLab's /help, as GitLab's Markdown processor does not support iframes. It's hidden on the docs site but will be displayed on GitLab's /help.

Code blocks

~~~md ruby Ruby code

js JavaScript code

md [Markdown code example](example.md)

text Code or text for which no specific highlighting class is available. ~~~

Alert boxes

Whenever you need to call special attention to particular sentences, use the following markup for highlighting.

Note that the alert boxes only work for one paragraph only. Multiple paragraphs, lists, headers, etc will not render correctly. For multiple lines, use blockquotes instead.

Alert boxes only render on the GitLab Docs site (https://docs.gitlab.com). Within GitLab itself, they will appear as plain Markdown text (like the examples above the rendered versions, below).

Note

Notes catch the eye of most readers, and therefore should be used very sparingly. In most cases, content considered for a note should be included:

When to use

Use a note when there is a reason that most or all readers who browse the section should see the content. That is, if missed, it’s likely to cause major trouble for a minority of users or significant trouble for a majority of users.

Weigh the costs of distracting users to whom the content is not relevant against the cost of users missing the content if it were not expressed as a note.

NOTE: **Note:**
This is something to note.

How it renders on the GitLab Docs site:

NOTE: Note: This is something to note.

Tip

TIP: **Tip:**
This is a tip.

How it renders on the GitLab Docs site:

TIP: Tip: This is a tip.

Caution

CAUTION: **Caution:**
This is something to be cautious about.

How it renders on the GitLab Docs site:

CAUTION: Caution: This is something to be cautious about.

Danger

DANGER: **Danger:**
This is a breaking change, a bug, or something very important to note.

How it renders on the GitLab Docs site:

DANGER: Danger: This is a breaking change, a bug, or something very important to note.

Blockquotes

For highlighting a text within a blue blockquote, use this format:

> This is a blockquote.

which renders on the GitLab Docs site as:

This is a blockquote.

If the text spans across multiple lines it's OK to split the line.

For multiple paragraphs, use the symbol > before every line:

> This is the first paragraph.
>
> This is the second paragraph.
>
> - This is a list item
> - Second item in the list

Which renders to:

This is the first paragraph.

This is the second paragraph.

  • This is a list item
  • Second item in the list

Terms

To maintain consistency through GitLab documentation, the following guides documentation authors on agreed styles and usage of terms.

Describing UI elements

The following are styles to follow when describing UI elements on a screen:

Verbs for UI elements

The following are recommended verbs for specific uses.

Recommended Used for Alternatives
"click" buttons, links, menu items "hit", "press", "select"
"check" checkboxes "enable", "click", "press"
"select" dropdowns "pick"
"expand" expandable sections "open"

Other Verbs

Recommended Used for Alternatives
"go" making a browser go to location "navigate", "open"

GitLab versions and tiers

Tagged and released versions of GitLab documentation are available:

The version introducing a new feature is added to the top of the topic in the documentation to provide a helpful link back to how the feature was developed.

Text for documentation requiring version text

```md

Introduced in GitLab 11.3. ```

```md

Introduced in GitLab 11.3. ```

```md

Introduced in GitLab Starter 11.3. ```

Removing version text

Over time, version text will reference a progressively older version of GitLab. In cases where version text refers to versions of GitLab four or more major versions back, consider removing the text.

For example, if the current major version is 11.x, version text referencing versions of GitLab 7.x and older are candidates for removal.

NOTE: Note: This guidance applies to any text that mentions a GitLab version, not just "Introduced in... " text. Other text includes deprecation notices and version-specific how-to information.

Product badges

When a feature is available in EE-only tiers, add the corresponding tier according to the feature availability:

To exclude GitLab.com tiers (when the feature is not available in GitLab.com), add the keyword "only":

For GitLab.com only tiers (when the feature is not available for self-hosted instances):

The tier should be ideally added to headers, so that the full badge will be displayed. However, it can be also mentioned from paragraphs, list items, and table cells. For these cases, the tier mention will be represented by an orange question mark that will show the tiers on hover.

For example:

The absence of tiers' mentions mean that the feature is available in GitLab Core, GitLab.com Free, and all higher tiers.

How it works

Introduced by !244, the special markup **(STARTER)** will generate a span element to trigger the badges and tooltips (<span class="badge-trigger starter">). When the keyword "only" is added, the corresponding GitLab.com badge will not be displayed.

Specific sections

Certain styles should be applied to specific sections. Styles for specific sections are outlined below.

GitLab Restart

There are many cases that a restart/reconfigure of GitLab is required. To avoid duplication, link to the special document that can be found in doc/administration/restart_gitlab.md. Usually the text will read like:

Save the file and [reconfigure GitLab](../../administration/restart_gitlab.md)
for the changes to take effect.

If the document you are editing resides in a place other than the GitLab CE/EE doc/ directory, instead of the relative link, use the full path: https://docs.gitlab.com/ce/administration/restart_gitlab.html. Replace reconfigure with restart where appropriate.

Installation guide

Ruby: In step 2 of the installation guide, we install Ruby from source. Whenever there is a new version that needs to be updated, remember to change it throughout the codeblock and also replace the sha256sum (it can be found in the downloads page of the Ruby website).

Configuration documentation for source and Omnibus installations

GitLab currently officially supports two installation methods: installations from source and Omnibus packages installations.

Whenever there is a setting that is configurable for both installation methods, prefer to document it in the CE docs to avoid duplication.

Configuration settings include:

  1. Settings that touch configuration files in config/.
  2. NGINX settings and settings in lib/support/ in general.

When there is a list of steps to perform, usually that entails editing the configuration file and reconfiguring/restarting GitLab. In such case, follow the style below as a guide:

**For Omnibus installations**

1. Edit `/etc/gitlab/gitlab.rb`:

   ```ruby
   external_url "https://gitlab.example.com"
   ```

1. Save the file and [reconfigure] GitLab for the changes to take effect.

---

**For installations from source**

1. Edit `config/gitlab.yml`:

   ```yaml
   gitlab:
     host: "gitlab.example.com"
   ```

1. Save the file and [restart] GitLab for the changes to take effect.

[reconfigure]: path/to/administration/restart_gitlab.md#omnibus-gitlab-reconfigure
[restart]: path/to/administration/restart_gitlab.md#installations-from-source

In this case:

Feature flags

Sometimes features are shipped with feature flags, either:

When documenting feature flags for a feature, include:

NOTE: Note: The Product Manager for the relevant group must review and approve the addition or removal of any mentions of using feature flags before the doc change is merged.

The following is sample text for adding feature flag documentation for a feature:

### Disabling the feature

This feature comes with the `:feature_flag` feature flag enabled by default. However, in some cases
this feature is incompatible with old configuration. To turn off the feature while configuration is
migrated, ask a GitLab administrator with Rails console access to run the following command:

```ruby
Feature.disable(:feature_flag)
```

For guidance on developing with feature flags, see Feature flags in development of GitLab.

API

Here is a list of must-have items. Use them in the exact order that appears on this document. Further explanation is given below.

GET /projects/:id/repository/branches

API topic template

The following can be used as a template to get started:

## Descriptive title

One or two sentence description of what endpoint does.

```text
METHOD /endpoint
```

| Attribute   | Type     | Required | Description           |
|:------------|:---------|:---------|:----------------------|
| `attribute` | datatype | yes/no   | Detailed description. |
| `attribute` | datatype | yes/no   | Detailed description. |

Example request:

```sh
curl --header "PRIVATE-TOKEN: <your_access_token>" 'https://gitlab.example.com/api/v4/endpoint?parameters'
```

Example response:

```json
[
  {
  }
]
```

Fake tokens

There may be times where a token is needed to demonstrate an API call using cURL or a variable used in CI. It is strongly advised not to use real tokens in documentation even if the probability of a token being exploited is low.

You can use the following fake tokens as examples.

Token type Token value
Private user token <your_access_token>
Personal access token n671WNGecHugsdEDPsyo
Application ID 2fcb195768c39e9a94cec2c2e32c59c0aad7a3365c10892e8116b5d83d4096b6
Application secret 04f294d1eaca42b8692017b426d53bbc8fe75f827734f0260710b83a556082df
CI/CD variable Li8j-mLUVA3eZYjPfd_H
Specific Runner token yrnZW46BrtBFqM7xDzE7dddd
Shared Runner token 6Vk7ZsosqQyfreAxXTZr
Trigger token be20d8dcc028677c931e04f3871a9b
Webhook secret token 6XhDroRcYPM5by_h-HLY
Health check token Tu7BgjR9qeZTEyRzGG2P
Request profile token 7VgpS4Ax5utVD2esNstz

Method description

Use the following table headers to describe the methods. Attributes should always be in code blocks using backticks (`).

| Attribute | Type | Required | Description |
|:----------|:-----|:---------|:------------|

Rendered example:

Attribute Type Required Description
user string yes The GitLab username

cURL commands

Methods Description
--header "PRIVATE-TOKEN: <your_access_token>" Use this method as is, whenever authentication needed
--request POST Use this method when creating new objects
--request PUT Use this method when updating existing objects
--request DELETE Use this method when removing existing objects

cURL Examples

Below is a set of cURL examples that you can use in the API documentation.

Simple cURL command

Get the details of a group:

curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/groups/gitlab-org

cURL example with parameters passed in the URL

Create a new project under the authenticated user's namespace:

curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects?name=foo"

Post data using cURL's --data

Instead of using --request POST and appending the parameters to the URI, you can use cURL's --data option. The example below will create a new project foo under the authenticated user's namespace.

curl --data "name=foo" --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects"

Post data using JSON content

Note: In this example we create a new group. Watch carefully the single and double quotes.

curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" --header "Content-Type: application/json" --data '{"path": "my-group", "name": "My group"}' https://gitlab.example.com/api/v4/groups

Post data using form-data

Instead of using JSON or urlencode you can use multipart/form-data which properly handles data encoding:

curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" --form "title=ssh-key" --form "key=ssh-rsa AAAAB3NzaC1yc2EA..." https://gitlab.example.com/api/v4/users/25/keys

The above example is run by and administrator and will add an SSH public key titled ssh-key to user's account which has an id of 25.

Escape special characters

Spaces or slashes (/) may sometimes result to errors, thus it is recommended to escape them when possible. In the example below we create a new issue which contains spaces in its title. Observe how spaces are escaped using the %20 ASCII code.

curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/42/issues?title=Hello%20Dude"

Use %2F for slashes (/).

Pass arrays to API calls

The GitLab API sometimes accepts arrays of strings or integers. For example, to restrict the sign-up e-mail domains of a GitLab instance to *.example.com and example.net, you would do something like this:

curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" --data "domain_whitelist[]=*.example.com" --data "domain_whitelist[]=example.net" https://gitlab.example.com/api/v4/application/settings