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

# Saved Tree

`GET /saved/tree`

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/fastapi.md) · [All operations](https://skmtc.dev/stardrift/apis/fastapi/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/stardrift/fastapi/revisions/00746572572a/schema)
