---
title: "Get a tree object"
method: GET
path: "/projects/{projectId}/git/trees/{repositoryTreeId}"
tags: ["Repository"]
---

# Get a tree object

`GET /projects/{projectId}/git/trees/{repositoryTreeId}`

Retrieve, by hash, the tree state represented by a commit.
The returned object's `tree` field contains a list of files and
directories present in the tree.

Directories in the tree can be recursively retrieved by this endpoint
through their hashes. Files in the tree can be retrieved by the
[Get a blob object](#tag/Git-Repo%2Fpaths%2F~1projects~1%7BprojectId%7D~1git~1blobs~1%7BrepositoryBlobId%7D%2Fget)
endpoint.

## Path parameters

- `projectId` string, required
- `repositoryTreeId` string, required

## Response `default`

- Tree
  - `id` string, required — The identifier of Tree
  - `sha` string, required — The identifier of the tree
  - `tree` object[], required — The tree items
    - `path` string, required — The path of the item
    - `mode` '040000' | '100644' | '100755' | '120000' | '160000', required — The mode of the item
    - `type` string, required — The type of the item (blob or tree)
    - `sha` string, nullable, required — The sha of the item

---

[API](https://skmtc.net/upsun/apis/upsun-com-rest-api.md) · [All operations](https://skmtc.net/upsun/apis/upsun-com-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/upsun/upsun-com-rest-api/revisions/6cc88fde6435/schema)
