---
title: "List Mine"
method: GET
path: "/api/workspaces"
tags: ["Workspaces"]
---

# List Mine

`GET /api/workspaces`

## Request

- Base URL: `https://api.kolens.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.kolens.ai/api/workspaces`
- Auth: HTTP bearer

List the caller's workspaces.

Phase 2 wiring (EPIC #114): on first call this lazily creates the
user's "Personal" workspace via ``ensure_personal_workspace``. We
chose lazy-on-list rather than a global request middleware because:

1. It only runs for endpoints that already resolve a user_id, so
   OAuth flows and health probes are untouched.
2. The frontend always hits ``/api/workspaces`` to render the
   switcher on dashboard load, so the latency cost is amortised.
3. ``ensure_personal_workspace`` is idempotent and race-safe (it
   checks for an existing Personal workspace by name+owner before
   inserting), so multiple concurrent requests converge to one row.

## Headers

- `x-kolens-user-id` string, nullable
- `x-kolens-user-email` string, nullable

## Response `200`

Successful Response

- WorkspaceListOut
  - `workspaces` WorkspaceOut[], required
    - `id` string, required
    - `name` string, required
    - `slug` string, required
    - `owner_user_id` string, required
    - `plan` string, required
    - `role` 'admin' | 'billing' | 'member', nullable
    - `member_count` integer, nullable
    - `is_personal` boolean, nullable
    - `created_at` string, date-time, required
    - `updated_at` string, date-time, required

## Other responses

- `422`: Validation Error

---

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