> ## Documentation Index
> Fetch the complete documentation index at: https://traceroot.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# List Workspaces

> List the workspaces the authenticated user belongs to.

A user-credential-only discovery op (no ``project_id``). Use it, then
``list_projects``, to resolve the project a subsequent request scopes to.

Args:
    request (Request): Incoming request (rate-limit plumbing).
    response (Response): Outgoing response (rate-limit plumbing).
    auth (AccountStampedAuth): Account-scope user auth (session token or CLI
        access JWT); carries the resolved ``user_id`` and stamps the per-user
        rate-limit identity.

Returns:
    PublicWorkspaceListResponse: The user's workspaces (id, name, role).



## OpenAPI

````yaml /api-reference/openapi.json get /api/v1/public/workspaces
openapi: 3.1.0
info:
  title: TraceRoot Public API
  version: 0.1.0
servers:
  - description: TraceRoot Cloud
    url: https://app.traceroot.ai
  - description: Self-hosted
    url: '{baseUrl}'
    variables:
      baseUrl:
        default: http://localhost:8000
        description: Your TraceRoot backend URL
security: []
paths:
  /api/v1/public/workspaces:
    get:
      tags:
        - Account
      summary: List Workspaces
      description: >-
        List the workspaces the authenticated user belongs to.


        A user-credential-only discovery op (no ``project_id``). Use it, then

        ``list_projects``, to resolve the project a subsequent request scopes
        to.


        Args:
            request (Request): Incoming request (rate-limit plumbing).
            response (Response): Outgoing response (rate-limit plumbing).
            auth (AccountStampedAuth): Account-scope user auth (session token or CLI
                access JWT); carries the resolved ``user_id`` and stamps the per-user
                rate-limit identity.

        Returns:
            PublicWorkspaceListResponse: The user's workspaces (id, name, role).
      operationId: list_workspaces
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicWorkspaceListResponse'
          description: Successful Response
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Authentication failed
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Authentication service unavailable
      security:
        - BearerAuth: []
components:
  schemas:
    PublicWorkspaceListResponse:
      description: >-
        Account-scope discovery: the workspaces the user can access.


        Returned by ``list_workspaces`` — a user-credential-only op that needs
        no

        ``project_id``. Not paginated: a user's workspace membership is small
        and

        bounded.
      properties:
        data:
          items:
            $ref: '#/components/schemas/WorkspaceListItem'
          title: Data
          type: array
      required:
        - data
      title: PublicWorkspaceListResponse
      type: object
    ErrorResponse:
      description: >-
        The canonical public error envelope (matches the gateway's normalized
        shape).
      properties:
        detail:
          title: Detail
          type: string
      required:
        - detail
      title: ErrorResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    WorkspaceListItem:
      description: A workspace the authenticated user belongs to, with their role in it.
      properties:
        id:
          title: Id
          type: string
        name:
          title: Name
          type: string
        role:
          title: Role
          type: string
      required:
        - id
        - name
        - role
      title: WorkspaceListItem
      type: object
    ValidationError:
      properties:
        ctx:
          title: Context
          type: object
        input:
          title: Input
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
  securitySchemes:
    BearerAuth:
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.