---
title: "GET /api/collection/tree"
method: GET
path: "/api/collection/tree"
tags: ["/api/collection"]
---

# GET /api/collection/tree

`GET /api/collection/tree`

Similar to `GET /`, but returns Collections in a tree structure, e.g.

  ```
  [{:name     "A"
  :below    #{:card :dataset}
  :children [{:name "B"}
             {:name     "C"
              :here     #{:dataset :card}
              :below    #{:dataset :card}
              :children [{:name     "D"
                          :here     #{:dataset}
                          :children [{:name "E"}]}
                         {:name     "F"
                          :here     #{:card}
                          :children [{:name "G"}]}]}]}
  {:name "H"}]
  ```

  The here and below keys indicate the types of items at this particular level of the tree (here) and in its
  subtree (below).

  TODO: for historical reasons this returns Saved Questions AS 'card' AND Models as 'dataset'; we should fix this at
  some point in the future.

  By default, looks at the `analytics` (if enabled) and regular (`nil`) namespaces. You can optionally pass a
  `namespace` argument, or one or many `namespaces`, to specify the particular collection namespaces you wish to look
  at. For example, `namespaces=analytics&namespaces=` would match the default behavior.

  When `shallow` is true, takes an optional `collection-id` and returns only the requested collection (or
  the root, if `collection-id` is `nil`).

## Query parameters

- `exclude-archived` boolean, nullable, required
- `exclude-other-user-collections` boolean, nullable, required
- `include-library` boolean, nullable, required
- `namespace` string, nullable
- `namespaces` string[], nullable
- `shallow` boolean, nullable, required
- `collection-id` integer, nullable — value must be an integer greater than zero.

## Response `2XX`

Successful response

## Other responses

- `4XX` — Client error response
- `5XX` — Server error response

---

[API](https://skmtc.net/metabase/apis/metabase-api.md) · [All operations](https://skmtc.net/metabase/apis/metabase-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/metabase/metabase-api/versions/08b5a2bafb4f/schema)
