Sample - GitHub REST API
GET/repos/{owner}/{repo}/git/trees/{tree_sha}

Get a tree

Returns a single tree using the SHA1 value or ref name for that tree.

If truncated is true in the response then the number of items in the tree array exceeded our maximum limit. If you need to fetch more items, use the non-recursive method of fetching trees, and fetch one sub-tree at a time.

[!NOTE] The limit for the tree array is 100,000 entries with a maximum size of 7 MB when using the recursive parameter.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

4 parameters
ownerstringrequired
The account owner of the repository. The name is not case sensitive.
repostringrequired
The name of the repository without the `.git` extension. The name is not case sensitive.
tree_shastringrequired
The SHA1 value or ref (branch or tag) name of the tree.
recursivestringoptional
Setting this parameter to any value returns the objects or subtrees referenced by the tree specified in `:tree_sha`. For example, setting `recursive` to any of the following will enable returning objects or subtrees: `0`, `1`, `"true"`, and `"false"`. Omit this parameter to prevent recursively returning objects or subtrees.

4 status codes
200Response
shastringrequired
urlstringoptional
truncatedbooleanrequired
treearray<object>required
Objects specifying a tree structure
404Resource not found
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
409Conflict
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
422Validation failed, or the endpoint has been spammed.
messagestringrequired
documentation_urlstringrequired
errorsarray<object>optional

Error handling

A 404 is returned: Resource not found. A 409 is returned: Conflict. A 422 is returned: Validation failed, or the endpoint has been spammed.