# List Assets with Filtering GET https://api.trebellar.app/api/v2/assets Retrieve a list of assets with optional filtering by asset type. This operation returns all assets accessible to the authenticated user, optionally filtered to start from a specific asset type level (e.g., only structures, only floors, etc.). Each asset includes its basic properties and immediate children. Reference: https://docs.trebellar.app/api-reference/api-resources/assets/list-all ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: List Assets with Filtering version: endpoint_assets.listAll paths: /api/v2/assets: get: operationId: list-all summary: List Assets with Filtering description: >- Retrieve a list of assets with optional filtering by asset type. This operation returns all assets accessible to the authenticated user, optionally filtered to start from a specific asset type level (e.g., only structures, only floors, etc.). Each asset includes its basic properties and immediate children. tags: - - subpackage_assets parameters: - name: fromAssetType in: query required: false schema: $ref: '#/components/schemas/ApiV2AssetsGetParametersFromAssetType' - name: X-Trebellar-Api-Key in: header required: true schema: type: string responses: '200': description: Assets retrieved successfully, potentially filtered by type content: application/json: schema: $ref: '#/components/schemas/assets_listAll_Response_200' '404': description: No assets found matching the specified criteria content: {} components: schemas: ApiV2AssetsGetParametersFromAssetType: type: string enum: - value: ROOT - value: STRUCTURE - value: FLOOR - value: SPACE - value: DESK - value: SENSOR - value: UNKNOWN - value: SENSOR_GROUP AssetId: type: string AssetLabel: type: string PolygonLocationSchemaType: type: string enum: - value: Point - value: Line - value: Polygon Point: type: array items: type: number format: double Line: type: array items: $ref: '#/components/schemas/Point' Polygon: type: array items: $ref: '#/components/schemas/Point' PolygonLocationSchemaCoordinates2: type: array items: $ref: '#/components/schemas/Polygon' PolygonLocationSchemaCoordinates: oneOf: - $ref: '#/components/schemas/Point' - $ref: '#/components/schemas/Line' - $ref: '#/components/schemas/PolygonLocationSchemaCoordinates2' PolygonLocationSchema: type: object properties: type: $ref: '#/components/schemas/PolygonLocationSchemaType' description: Type of geographic location coordinates: $ref: '#/components/schemas/PolygonLocationSchemaCoordinates' required: - type - coordinates Coordinates: type: object properties: lat: type: number format: double lon: type: number format: double required: - lat - lon AssetURLResourceSchema: type: object properties: name: type: string url: type: string dataUri: type: string StructureAssetStatus: type: string enum: - value: active - value: mothball - value: reserve - value: pending_exit - value: pending_new - value: new - value: closed StructureStaticProperties: type: object properties: externalId: type: string seats: type: number format: double capacity: type: number format: double headcount: type: number format: double address: type: string coordinates: $ref: '#/components/schemas/Coordinates' holidays: type: array items: type: string rentableSqft: type: number format: double businessHoursStart: type: string businessHoursEnd: type: string businessDays: type: array items: type: string locationGroup: type: string photos: type: array items: $ref: '#/components/schemas/AssetURLResourceSchema' status: $ref: '#/components/schemas/StructureAssetStatus' timezone: type: string required: - timezone StructureOutput: type: object properties: id: $ref: '#/components/schemas/AssetId' label: $ref: '#/components/schemas/AssetLabel' parentId: type: string description: Parent asset ID parentIdPath: type: array items: type: string location: $ref: '#/components/schemas/PolygonLocationSchema' dynamicProperties: type: object additionalProperties: description: Any type description: Dynamic properties as JSON type: type: string enum: - type: stringLiteral value: STRUCTURE staticProperties: $ref: '#/components/schemas/StructureStaticProperties' children: type: array items: $ref: '#/components/schemas/AssetOutput' required: - id - label - type - staticProperties FloorStaticProperties: type: object properties: externalId: type: string seats: type: number format: double capacity: type: number format: double headcount: type: number format: double image: type: object additionalProperties: description: Any type description: Floor image data scale: type: object additionalProperties: description: Any type description: Floor scale data FloorOutput: type: object properties: id: $ref: '#/components/schemas/AssetId' label: $ref: '#/components/schemas/AssetLabel' parentId: type: string description: Parent asset ID parentIdPath: type: array items: type: string location: $ref: '#/components/schemas/PolygonLocationSchema' dynamicProperties: type: object additionalProperties: description: Any type description: Dynamic properties as JSON type: type: string enum: - type: stringLiteral value: FLOOR staticProperties: $ref: '#/components/schemas/FloorStaticProperties' children: type: array items: $ref: '#/components/schemas/AssetOutput' required: - id - label - type - staticProperties SpaceOutputStaticPropertiesBookable: oneOf: - type: boolean - type: string SpaceOutputStaticProperties: type: object properties: externalId: type: string seats: type: number format: double capacity: type: number format: double headcount: type: number format: double spaceType: type: string bookable: $ref: '#/components/schemas/SpaceOutputStaticPropertiesBookable' photos: type: array items: $ref: '#/components/schemas/AssetURLResourceSchema' description: type: string SpaceOutput: type: object properties: id: $ref: '#/components/schemas/AssetId' label: $ref: '#/components/schemas/AssetLabel' parentId: type: string description: Parent asset ID parentIdPath: type: array items: type: string location: $ref: '#/components/schemas/PolygonLocationSchema' dynamicProperties: type: object additionalProperties: description: Any type description: Dynamic properties as JSON type: type: string enum: - type: stringLiteral value: SPACE staticProperties: $ref: '#/components/schemas/SpaceOutputStaticProperties' description: Properties for space assets children: type: array items: $ref: '#/components/schemas/AssetOutput' required: - id - label - type - staticProperties DeskOutputStaticPropertiesBookable: oneOf: - type: boolean - type: string DeskOutputStaticProperties: type: object properties: externalId: type: string seats: type: number format: double capacity: type: number format: double headcount: type: number format: double bookable: $ref: '#/components/schemas/DeskOutputStaticPropertiesBookable' DeskOutput: type: object properties: id: $ref: '#/components/schemas/AssetId' label: $ref: '#/components/schemas/AssetLabel' parentId: type: string description: Parent asset ID parentIdPath: type: array items: type: string location: $ref: '#/components/schemas/PolygonLocationSchema' dynamicProperties: type: object additionalProperties: description: Any type description: Dynamic properties as JSON type: type: string enum: - type: stringLiteral value: DESK staticProperties: $ref: '#/components/schemas/DeskOutputStaticProperties' description: Properties for desk assets children: type: array items: $ref: '#/components/schemas/AssetOutput' required: - id - label - type - staticProperties SensorGroupOutput: type: object properties: id: $ref: '#/components/schemas/AssetId' label: $ref: '#/components/schemas/AssetLabel' parentId: type: string description: Parent asset ID parentIdPath: type: array items: type: string location: $ref: '#/components/schemas/PolygonLocationSchema' dynamicProperties: type: object additionalProperties: description: Any type description: Dynamic properties as JSON type: type: string enum: - type: stringLiteral value: SENSOR_GROUP staticProperties: type: object additionalProperties: description: Any type children: type: array items: $ref: '#/components/schemas/AssetOutput' required: - id - label - type - staticProperties SensorOutputSensorProperties: type: object properties: sensorId: type: string name: type: string required: - sensorId SensorOutput: type: object properties: id: $ref: '#/components/schemas/AssetId' label: $ref: '#/components/schemas/AssetLabel' parentId: type: string description: Parent asset ID parentIdPath: type: array items: type: string location: $ref: '#/components/schemas/PolygonLocationSchema' dynamicProperties: type: object additionalProperties: description: Any type description: Dynamic properties as JSON type: type: string enum: - type: stringLiteral value: SENSOR staticProperties: type: object additionalProperties: description: Any type sensorProperties: $ref: '#/components/schemas/SensorOutputSensorProperties' description: Sensor-specific properties children: type: array items: $ref: '#/components/schemas/AssetOutput' required: - id - label - type - staticProperties - sensorProperties AssetOutput: oneOf: - $ref: '#/components/schemas/StructureOutput' - $ref: '#/components/schemas/FloorOutput' - $ref: '#/components/schemas/SpaceOutput' - $ref: '#/components/schemas/DeskOutput' - $ref: '#/components/schemas/SensorGroupOutput' - $ref: '#/components/schemas/SensorOutput' assets_listAll_Response_200: type: object properties: data: type: array items: $ref: '#/components/schemas/AssetOutput' required: - data ``` ## SDK Code Examples ```typescript import { TrebellarApiClient } from "@trebellar/api-sdk"; async function main() { const client = new TrebellarApiClient({ environment: "https://api.trebellar.app", }); await client.assets.listAll({}); } main(); ``` ```python from trebellar import TrebellarApi client = TrebellarApi( base_url="https://api.trebellar.app", api_key= ) client.assets.list_all() ``` ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.trebellar.app/api/v2/assets" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("X-Trebellar-Api-Key", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api.trebellar.app/api/v2/assets") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["X-Trebellar-Api-Key"] = '' response = http.request(request) puts response.read_body ``` ```java HttpResponse response = Unirest.get("https://api.trebellar.app/api/v2/assets") .header("X-Trebellar-Api-Key", "") .asString(); ``` ```php request('GET', 'https://api.trebellar.app/api/v2/assets', [ 'headers' => [ 'X-Trebellar-Api-Key' => '', ], ]); echo $response->getBody(); ``` ```csharp var client = new RestClient("https://api.trebellar.app/api/v2/assets"); var request = new RestRequest(Method.GET); request.AddHeader("X-Trebellar-Api-Key", ""); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = ["X-Trebellar-Api-Key": ""] let request = NSMutableURLRequest(url: NSURL(string: "https://api.trebellar.app/api/v2/assets")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```