Skip to content

List all repository trees in a project

GET
/api/v4/projects/{id}/repository/tree

Lists all repository files and directories in a specified project. This endpoint can be accessed without authentication if the repository is publicly accessible. This command provides essentially the same features as the git ls-tree command.

id
required
One of:
string

The ID or URL-encoded path of the project

Example
1
ref
string
nullable

The name of a repository branch or tag, if not given the default branch is used

Example
main
path
string
nullable

The path of the tree

Example
files/html
recursive
boolean
nullable

Used to get a recursive tree

page
integer
default: 1 nullable

Current page number

Example
1
per_page
integer
default: 20 nullable

Number of items per page

Example
20
pagination
string
default: legacy nullable
Allowed values: legacy keyset none

Specify the pagination method (“none” is only valid if “recursive” is true)

page_token
string
nullable

Record from which to start the keyset pagination

Example
a1e8f8d745cc87e3a9248358d9352bb7f9a0aeba

OK

Media type application/json
object
id
string
name
string
type
string
path
string
mode
string
Example
{
"id": "a1e8f8d745cc87e3a9248358d9352bb7f9a0aeba",
"name": "html",
"type": "tree",
"path": "files/html",
"mode": "040000"
}

Bad Request

Not Found