Skip to content

Retrieve file blame history from a repository

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

Retrieves blame history for a specified file in a repository. Each blame range contains lines and their corresponding commit information.

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
range

Object that contains the blame range

object
range[start]
required
integer
>= 1

The first line of the range to blame

range[end]
required
integer
>= 1

The last line of the range to blame

OK

Media type application/json
object
commit
object
id
string
parent_ids
Array<string>
message
string
authored_date
string format: date-time
author_name
string
author_email
string
committed_date
string format: date-time
committer_name
string
committer_email
string
lines
Array<string>
Example
{
"commit": {
"id": "2695effb5807a22ff3d138d593fd856244e155e7",
"parent_ids": [
"2a4b78934375d7f53875269ffd4f45fd83a84ebe"
],
"message": "Initial commit",
"authored_date": "2012-05-28T04:42:42-07:00",
"author_name": "John Smith",
"author_email": "john@example.com",
"committed_date": "2012-05-28T04:42:42-07:00",
"committer_name": "Jack Smith",
"committer_email": "jack@example.com"
},
"lines": [
"lorem ipsum"
]
}

Bad Request

Not Found