---
metadata:
  - name: generator
    content: Diplodoc Platform v5.54.2
alternate:
  - https://sourcecraft.dev/portal/docs/en/api-ref/Repository/ListTreeByID.md
  - https://sourcecraft.dev/portal/docs/ru/api-ref/Repository/ListTreeByID.md
  - href: ru/api-ref/Repository/ListTreeByID.md
    type: text/markdown
    title: Markdown version
  - href: ../../llms.txt
    type: text/markdown
    title: llms.txt
---
> **Documentation Index:** Fetch the complete configuration index at https://sourcecraft.dev/portal/docs/ru/llms.txt

<div class="openapi">

# List Repository File Tree (By Repo ID)

<!-- markdownlint-disable-file -->

## Request

<div class="openapi__requests">

<div class="openapi__request__wrapper" style="--method: var(--dc-openapi-methods-get);margin-bottom: 12px">

<div class="openapi__request">

GET {.openapi__method}
```text translate=no
https://api.sourcecraft.tech/repos/id:{repo_id}/trees
```

</div>

</div>

</div>

### Path parameters

#|
|| **Name** | **Description** ||
||

_repo_id_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} ``
{.table-cell}
||
|#{.json-schema-properties}

### Query parameters

#|
|| **Name** | **Description** ||
||

_page_size_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string&lt;uint64&gt;

The maximum number of tree entries to return. The service may return fewer than
this value

_Example:_{.json-schema-reset .json-schema-example} ``
{.table-cell}
||
||

_page_token_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

A page token, received from a previous call.
Provide this to retrieve the subsequent page.

When paginating, all other parameters must match
the call that provided the page token.

_Example:_{.json-schema-reset .json-schema-example} ``
{.table-cell}
||
||

_path_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

Path within repository to get the tree for. If not specified, returns the root tree

_Example:_{.json-schema-reset .json-schema-example} ``
{.table-cell}
||
||

_recursive_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: boolean

Whether to retrieve tree entries recursively. If false, only immediate children are returned
{.table-cell}
||
||

_revision_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

Git reference (branch, tag, or commit SHA). If empty, the default branch (usually main) will be used.
Examples: `mybranch`, `tags:v1.0.0`

_Example:_{.json-schema-reset .json-schema-example} ``
{.table-cell}
||
|#{.json-schema-properties}

## Responses

<div class="openapi__response__code__200">

## 200 OK

A successful response.

<div class="openapi-entity">

### Body

{% cut "application/json" %}

```json translate=no
{
  "trees": [
    {
      "name": "example",
      "path": "example",
      "type": "file"
    }
  ],
  "next_page_token": "example"
}
```

{% endcut %}

#|
|| **Name** | **Description** ||
||

_next_page_token_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

A token, which can be sent as `page_token` to retrieve the next page.
If this field is omitted, there are no subsequent pages.

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_trees_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: [TreeEntry](#entity-TreeEntry)[]

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
[
  {
    "name": "example",
    "path": "example",
    "type": "file"
  }
]
```

{% endcut %}
{.table-cell}
||
|#{.json-schema-properties}

</div>

<div class="openapi-entity">

### TreeEntry.Type {#entity-TreeEntry.Type}

**Type**: string

_Enum:_{.json-schema-reset .json-schema-value} `file`, `executable`, `dir`, `symlink`, `submodule`

</div>

<div class="openapi-entity">

### TreeEntry {#entity-TreeEntry}

#|
|| **Name** | **Description** ||
||

_name_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_path_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_type_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: [TreeEntry.Type](#entity-TreeEntry.Type)

_Enum:_{.json-schema-reset .json-schema-value} `file`, `executable`, `dir`, `symlink`, `submodule`
{.table-cell}
||
|#{.json-schema-properties}

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{
  "name": "example",
  "path": "example",
  "type": "file"
}
```

{% endcut %}

</div>

</div>

<div class="openapi__response__code__default">

## default

Both Client Errors (4xx) and Server Errors (5xx) are serialized into this scheme

<div class="openapi-entity">

### Body

{% cut "application/json" %}

```json translate=no
{
  "error_code": "example",
  "message": "example",
  "request_id": "example",
  "details": null
}
```

{% endcut %}

#|
|| **Name** | **Description** ||
||

_details_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: unknown

_Example:_{.json-schema-reset .json-schema-example} `null`
{.table-cell}
||
||

_error_code_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_message_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_request_id_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
|#{.json-schema-properties}

</div>

</div>

</div>

[*Deprecated]: No longer supported, please use an alternative and newer version.