---
title: Migrate from the List Repos API
description: Migrate from the deprecated List Repos API (GET /api/2.0/repos) to the Workspace API and Get Repo API to find and manage Databricks Git folders.
canonical_url: https://docs.databricks.com/aws/en/repos/migrate-list-repos
---

# Migrate from the List Repos API

> [!WARNING]
> **Deprecated**
>
> The List Repos API (`GET /api/2.0/repos`) is deprecated. Use the [Workspace API](https://docs.databricks.com/api/workspace/workspace) and the [Get Repo API](https://docs.databricks.com/api/workspace/repos/get) instead.

Use the Workspace API to find Git folders by path. Call [`GET /api/2.0/repos/{repo_id}`](https://docs.databricks.com/api/workspace/repos/get) when you need Git metadata such as the branch, remote URL, or commit ID.

## <a id="choose-replacement" />Replacement endpoints

| Previous usage                                                    | Replacement                                                                                                                   |
| ----------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| Look up a Git folder by path                                      | [`GET /api/2.0/workspace/get-status`](https://docs.databricks.com/api/workspace/workspace/getstatus)                          |
| List Git folders in a directory                                   | [`GET /api/2.0/workspace/list`](https://docs.databricks.com/api/workspace/workspace/list)                                     |
| Read Git metadata (`url`, `provider`, `branch`, `head_commit_id`) | [`GET /api/2.0/repos/{repo_id}`](https://docs.databricks.com/api/workspace/repos/get) with `object_id` from the Workspace API |
| Check `CAN_MANAGE` permission                                     | [`GET /api/2.0/permissions/repos/{repo_id}`](https://docs.databricks.com/api/workspace/repos/getpermissions)                  |

## <a id="identify-git-folders" />Identify Git folders in Workspace API responses

An object from `workspace/get-status` or `workspace/list` is a Git folder when either condition is true:

* `object_type` is `"REPO"`.
* `object_type` is `"DIRECTORY"` and `directory_info.is_git_folder` is `true` (Git folders with Git CLI access).

## <a id="lookup-by-path" />Look up a Git folder by path

Call `GET /api/2.0/workspace/get-status` with the workspace path. Pass the returned `object_id` to `GET /api/2.0/repos/{repo_id}` if you need Git metadata.

### REST API

1. Get the object status and `object_id`:

   ```bash
   curl --request GET \
     "https://<workspace-instance>/api/2.0/workspace/get-status?path=/Workspace/Users/user@example.com/my-repo" \
     --header "Authorization: Bearer $DATABRICKS_TOKEN"
   ```

   Example response for a Git folder with Git CLI access:

   ```json
   {
     "object_type": "DIRECTORY",
     "path": "/Workspace/Users/user@example.com/my-repo",
     "object_id": 12345,
     "resource_id": "12345",
     "directory_info": {
       "is_git_folder": true
     }
   }
   ```

2. Optional. Get Git metadata with `object_id`:

   ```bash
   curl --request GET \
     "https://<workspace-instance>/api/2.0/repos/12345" \
     --header "Authorization: Bearer $DATABRICKS_TOKEN"
   ```

### CLI

```bash
REPO_ID=$(databricks workspace get-status "/Workspace/Users/user@example.com/my-repo" --output json | jq -r '.object_id')
databricks repos get "$REPO_ID"
```

## <a id="list-in-folder" />List Git folders in a directory

Call `GET /api/2.0/workspace/list` on a folder and filter for Git folders. To search subdirectories, recurse into directories where `object_type` is `"DIRECTORY"` and `directory_info.is_git_folder` is not `true`.

### REST API

```bash
curl --request GET \
  "https://<workspace-instance>/api/2.0/workspace/list?path=/Workspace/Users/user@example.com" \
  --header "Authorization: Bearer $DATABRICKS_TOKEN"
```

Filter `objects` for entries where `object_type` is `"REPO"` or `directory_info.is_git_folder` is `true`. Empty directories omit `objects`. Pass each matching `object_id` to `GET /api/2.0/repos/{repo_id}` only when you need Git metadata.

### CLI

Requires Databricks CLI version `1.12.0` or later.

```bash
databricks workspace list "/Workspace/Users/user@example.com" --output json \
  | jq '.[] | select(.object_type == "REPO" or .directory_info.is_git_folder == true) | {id: .object_id, path: .path}'
```

## <a id="permissions" />Permissions

`GET /api/2.0/repos` returns only Git folders where the caller has `CAN_MANAGE`. `workspace/get-status`, `workspace/list`, and `GET /api/2.0/repos/{repo_id}` do not filter for `CAN_MANAGE`.

To check whether the caller has `CAN_MANAGE`, call [`GET /api/2.0/permissions/repos/{repo_id}`](https://docs.databricks.com/api/workspace/repos/getpermissions). If you use a scope-restricted token, include read access to the `access-management` scope, such as `access-management:read`. See [Narrow API scopes with scope modifiers](https://docs.databricks.com/aws/en/dev-tools/auth/scope-modifiers.md).

With the required token scope, the endpoint returns HTTP `200` when the caller has `CAN_MANAGE`. An HTTP `403` (`PERMISSION_DENIED`) response can indicate insufficient token scopes or missing `CAN_MANAGE` permission. Verify the token's scopes before treating a denial as evidence that the caller lacks `CAN_MANAGE`.

## <a id="additional-resources" />Additional resources

* [Repos REST API reference](https://docs.databricks.com/api/workspace/repos)
* [Workspace REST API reference](https://docs.databricks.com/api/workspace/workspace)
* [CI/CD with Databricks Git folders](https://docs.databricks.com/aws/en/repos/ci-cd.md)
* [Create and manage Git folders](https://docs.databricks.com/aws/en/repos/git-operations-with-repos.md)
