---
title: "Saved Tree"
method: GET
path: "/saved/tree"
tags: ["saved"]
---

# Saved Tree

`GET /saved/tree`

## Request

- Base URL: `https://stardrift.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://stardrift.ai/saved/tree`
- Auth: none declared

Group a user's saved places into the geocity Country → Region → City →
District tree (Pass 2), built from each canonical place's persisted ladder —
NOT recomputed from Photon. Deduped by canonical place (a place saved from N
reels counts once). `threshold` / `min_top_child` tune how aggressively dense
buckets split (see api/utils/geocity/tree.py). Backend-only in v1.

## Query parameters

- `threshold` integer
- `min_top_child` integer

## Response `200`

Successful Response

- SavedTreeOut: The Saved tab grouped into a coordinate-derived Country → Region → City → District hierarchy (geocity Pass 2), deduped by canonical place. Each node carries the `place_ids` of its subtree members so clients can join nodes back to `/saved` items (via `SavedItemOut.place_id`) and render cards per node.
  - `places` integer, required
  - `tree` TreeNode[], required
    - `label` string, required
    - `rung` 'countrycode' | 'country' | 'region' | 'macro' | 'city' | 'district', required: Ladder tiers, coarse → fine. The order here defines tree depth.
    - `count` integer, required
    - `place_ids` string[]
    - `children` TreeNode[]

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/stardrift/apis/stardrift-api.md) - [All operations](https://skmtc.dev/stardrift/apis/stardrift-api/llms.txt) - [OpenAPI document](https://skmtc.dev/stardrift/apis/stardrift-api/revisions/be9ed1e6c38a?raw)
