Group wikis API

  • Tier: Premium, Ultimate
  • Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated

Use this API to manage group wikis. An API for project wikis is also available.

Comments on a wiki page are called notes. To interact with them, use the notes API.

List wiki pages

Lists all wiki pages for a specified group.

GET /groups/:id/wikis
AttributeTypeRequiredDescription
idinteger or stringYesThe ID or URL-encoded path of the group.
with_contentbooleanNoInclude pages’ content.
curl \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/groups/1/wikis?with_content=1"

Example response:

[
  {
    "content" : "Here is an instruction how to deploy this project.",
    "format" : "markdown",
    "slug" : "deploy",
    "title" : "deploy",
    "encoding": "UTF-8"
  },
  {
    "content" : "Our development process is described here.",
    "format" : "markdown",
    "slug" : "development",
    "title" : "development",
    "encoding": "UTF-8"
  },{
    "content" : "*  [Deploy](deploy)\n*  [Development](development)",
    "format" : "markdown",
    "slug" : "home",
    "title" : "home",
    "encoding": "UTF-8"
  }
]

Retrieve a wiki page

Retrieves a wiki page for a specified group.

GET /groups/:id/wikis/:slug
AttributeTypeRequiredDescription
idinteger or stringYesThe ID or URL-encoded path of the group.
slugstringYesURL-encoded slug (a unique string) of the wiki page, such as dir%2Fpage_name.
render_htmlbooleanNoReturn the rendered HTML of the wiki page.
versionstringNoWiki page version SHA.
curl \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/groups/1/wikis/home"

Example response:

{
  "content" : "home page",
  "format" : "markdown",
  "slug" : "home",
  "title" : "home",
  "encoding": "UTF-8"
}

Create a wiki page

Creates a wiki page for a specific project with the given title, slug, and content.

POST /projects/:id/wikis
AttributeTypeRequiredDescription
idinteger or stringYesThe ID or URL-encoded path of the group.
contentstringYesThe content of the wiki page.
titlestringYesThe title of the wiki page.
formatstringNoThe format of the wiki page. Available formats are: markdown (default), rdoc, asciidoc, and org.
curl --request POST \
     --data "format=rdoc&title=Hello&content=Hello world" \
     --header "PRIVATE-TOKEN: <your_access_token>" \
     --url "https://gitlab.example.com/api/v4/groups/1/wikis"

Example response:

{
  "content" : "Hello world",
  "format" : "markdown",
  "slug" : "Hello",
  "title" : "Hello",
  "encoding": "UTF-8"
}

Update a wiki page

Updates a wiki page. At least one parameter is required to update the wiki page.

PUT /groups/:id/wikis/:slug
AttributeTypeRequiredDescription
idinteger or stringYesThe ID or URL-encoded path of the group.
contentstringYes, if title is not providedThe content of the wiki page.
titlestringYes, if content is not providedThe title of the wiki page.
formatstringNoThe format of the wiki page. Available formats are markdown (default), rdoc, asciidoc, and org.
slugstringYesURL encoded slug (a unique string) of the wiki page. For example: dir%2Fpage_name.
curl --request PUT \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/groups/1/wikis/foo" \
  --data "format=rdoc" \
  --data "title=Docs" \
  --data "content=documentation"

Example response:

{
  "content" : "documentation",
  "format" : "markdown",
  "slug" : "Docs",
  "title" : "Docs",
  "encoding": "UTF-8"
}

Delete a wiki page

Deletes a wiki page from a specific project with a specified slug.

DELETE /groups/:id/wikis/:slug
AttributeTypeRequiredDescription
idinteger or stringYesThe ID or URL-encoded path of the group.
slugstringYesURL-encoded slug (a unique string) of the wiki page, such as dir%2Fpage_name.
curl --request DELETE \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/groups/1/wikis/foo"

If successful, a 204 No Content HTTP response with an empty body is expected.

Upload an attachment to the wiki repository

Uploads a file to the attachment folder inside the wiki’s repository for a specific project. The attachment folder is the uploads folder.

POST /groups/:id/wikis/attachments
AttributeTypeRequiredDescription
idinteger or stringYesThe ID or URL-encoded path of the group.
filestringYesThe attachment to be uploaded.
branchstringNoThe name of the branch. Defaults to the wiki repository default branch.

To upload a file from your file system, use the --form argument. This causes cURL to post data using the header Content-Type: multipart/form-data. The file= parameter must point to a file on your file system and be preceded by @. For example:

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/groups/1/wikis/attachments" \
  --form "file=@dk.png"

Example response:

{
  "file_name" : "dk.png",
  "file_path" : "uploads/6a061c4cf9f1c28cb22c384b4b8d4e3c/dk.png",
  "branch" : "main",
  "link" : {
    "url" : "uploads/6a061c4cf9f1c28cb22c384b4b8d4e3c/dk.png",
    "markdown" : "![dk](uploads/6a061c4cf9f1c28cb22c384b4b8d4e3c/dk.png)"
  }
}