Skip to content

Retrieve a file from a repository

GET
/api/v4/projects/{id}/repository/files/{file_path}

Retrieves information about a specified file in a repository. This includes information like the name, size, and the file contents. File content is Base64 encoded.

id
required
string

The project ID

Example
gitlab-org/gitlab
file_path
required
string

The URL-encoded path to the file.

Example
lib%2Fclass%2Erb
ref
required
string
nullable

The name of branch, tag or commit

Example
main

OK

Bad Request

Not Found