# Get Asset by ID GET https://api.trebellar.app/api/v2/assets/{assetId} Retrieve detailed information about a specific asset including its hierarchical children, static properties, and location data. This operation returns the complete asset structure with all nested children if they exist. Reference: https://docs.trebellar.app/api-reference/api-resources/assets/get-asset-by-id ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Get Asset by ID version: endpoint_assets.getAssetById paths: /api/v2/assets/{assetId}: get: operationId: get-asset-by-id summary: Get Asset by ID description: >- Retrieve detailed information about a specific asset including its hierarchical children, static properties, and location data. This operation returns the complete asset structure with all nested children if they exist. tags: - - subpackage_assets parameters: - name: assetId in: path description: >- A unique identifier for an asset. Can be an AssetId or an ExternalId. ExternalIds are denoted by the "eid:" prefix. required: true schema: $ref: '#/components/schemas/GenericId' - name: X-Trebellar-Api-Key in: header required: true schema: type: string responses: '200': description: Asset retrieved successfully with complete hierarchical structure content: application/json: schema: $ref: '#/components/schemas/AssetOutput' '400': description: Invalid asset ID format provided content: {} '404': description: Asset with the specified ID does not exist or is not accessible content: {} components: schemas: GenericId: type: string 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' ``` ## 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.getAssetById("eid:sfo-001"); } main(); ``` ```python from trebellar import TrebellarApi client = TrebellarApi( base_url="https://api.trebellar.app", api_key= ) client.assets.get_asset_by_id( asset_id="eid:sfo-001" ) ``` ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.trebellar.app/api/v2/assets/eid%3Asfo-001" 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/eid%3Asfo-001") 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/eid%3Asfo-001") .header("X-Trebellar-Api-Key", "") .asString(); ``` ```php request('GET', 'https://api.trebellar.app/api/v2/assets/eid%3Asfo-001', [ 'headers' => [ 'X-Trebellar-Api-Key' => '', ], ]); echo $response->getBody(); ``` ```csharp var client = new RestClient("https://api.trebellar.app/api/v2/assets/eid%3Asfo-001"); 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/eid%3Asfo-001")! 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() ```