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

# Get Locations - Sub Locations Hierarchy

> Fetches all locations for a given workspace in a nested tree structure. Only users with proper permissions can access this data.



## OpenAPI

````yaml GET /api/v1/mgt/workspaces/{workspaceId}/locations
openapi: 3.1.0
info:
  title: Xenia Team API - Get Locations (Tree Format)
  description: >-
    Returns locations in a hierarchical tree structure for a given workspace.
    Each location may contain nested `Sublocations`.
  version: 1.0.0
servers:
  - url: https://api.xenia.team
security: []
paths:
  /api/v1/mgt/workspaces/{workspaceId}/locations:
    get:
      tags:
        - Locations
      summary: Get Hierarchical Locations
      description: >-
        Fetches all locations for a given workspace in a nested tree structure.
        Only users with proper permissions can access this data.
      parameters:
        - name: workspaceId
          in: path
          required: true
          description: UUID of the workspace.
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Locations retrieved successfully in hierarchical format.
          content:
            application/json:
              example:
                data:
                  - id: 46715d09-1628-4b1a-a12d-f9e0bbcdbc3c
                    HotelId: cb363f7e-c52a-4478-911d-f6a6f791090e
                    name: long title to display in dropdown for testing
                    description: null
                    avatar:
                      color: '#F8BBD0'
                    ParentId: null
                    LevelId: null
                    slugCode: long-title-to-display-in-dropdown-for-testing
                    isQREnable: false
                    locationNumber: 211
                    attachments: []
                    deletedTimestamp: '0'
                    CreatedBy: dfea8b8a-5b22-4668-b68d-dc641eb3a101
                    UpdatedBy: dfea8b8a-5b22-4668-b68d-dc641eb3a101
                    DeletedBy: null
                    timezone: America/Chicago
                    coordinates:
                      type: Point
                      coordinates:
                        - -87.6297982
                        - 41.8781136
                    address: Chicago, IL
                    createdAt: '2025-04-23T13:15:53.544Z'
                    updatedAt: '2025-06-13T19:21:20.489Z'
                    deletedAt: null
                    Members:
                      - photo: '@@#7C77B9'
                        fullName: invited user 3
                        id: 183f639a-8358-485f-9abe-221d0efcbe8e
                        firstName: invited
                        lastName: user 3
                        emailId: invite3@yopmail.com
                        phoneNo: null
                        deletedAt: null
                        timezone: Asia/Karachi
                        RoleId: 4ccf0b65-fb99-40da-92d6-3f98730df8b2
                        defaultLocationId: null
                        type: user
                    Level: null
                    assetCount: 0
                    Sublocations:
                      - id: df9469b4-311b-4d61-9db9-b81e10f7eca3
                        HotelId: cb363f7e-c52a-4478-911d-f6a6f791090e
                        name: Sub location
                        description: ''
                        avatar:
                          color: '#B3E5FC'
                        ParentId: 46715d09-1628-4b1a-a12d-f9e0bbcdbc3c
                        LevelId: null
                        slugCode: sub-location
                        isQREnable: false
                        locationNumber: 212
                        attachments: []
                        deletedTimestamp: '0'
                        CreatedBy: dfea8b8a-5b22-4668-b68d-dc641eb3a101
                        UpdatedBy: dfea8b8a-5b22-4668-b68d-dc641eb3a101
                        DeletedBy: null
                        timezone: Asia/Karachi
                        coordinates:
                          type: Point
                          coordinates:
                            - null
                            - null
                        address: null
                        createdAt: '2025-05-05T12:55:48.186Z'
                        updatedAt: '2025-05-05T12:56:29.512Z'
                        deletedAt: null
                        Members: []
                        Level: null
                        assetCount: 0
                extra_meta:
                  message: ''
        '400':
          description: Bad Request - Invalid workspace ID format.
        '401':
          description: Unauthorized - Missing or invalid authentication.
        '403':
          description: Forbidden - Insufficient permissions to access locations.
        '404':
          description: Not Found - Workspace does not exist.
        '500':
          description: Internal Server Error.
      security:
        - clientKey: []
          clientSecret: []
components:
  securitySchemes:
    clientKey:
      type: apiKey
      in: header
      name: x-client-key
    clientSecret:
      type: apiKey
      in: header
      name: x-client-secret

````