> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.trebellar.app/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.trebellar.app/_mcp/server. # Add Asset Tag POST https://api.trebellar.app/api/v2/assets/tags/add Content-Type: application/json Create a new asset tag Reference: https://docs.trebellar.app/api-reference/api-resources/assets/add-asset-tag ## Authentication - `X-Trebellar-Api-Key` header (required) — API Key authentication via header - `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer `, where token is your auth token. ## Request ### Body (application/json) This endpoint expects an AddAssetTagRequest. - `assetTag` (AddAssetTagRequestAssetTag, required) ## Response ### 200 Asset tag added successfully - `data` (AddAssetTagResponseData, required) ## Errors ### 500 Internal Server Error Unable to add asset tag - `code` (double, required) - `message` (string, required) - `error` (string, optional) - `details` (map from string to any, optional) ## Types ### AddAssetTagRequestAssetTag - `id` (string, required) - `name` (string, required) - `description` (string, required) - `assetTypes` (list of enum, required) - Allowed values: `STRUCTURE`, `FLOOR`, `SPACE`, `DESK`, `SENSOR`, `UNKNOWN`, `OTHER` - `color` (string, optional) - `icon` (string, optional) - `category` (string, optional) - `metadata` (string, optional) ### AddAssetTagResponseData - `id` (string, required) - `assetTypes` (list of enum, required) - Allowed values: `STRUCTURE`, `FLOOR`, `SPACE`, `DESK`, `SENSOR`, `UNKNOWN`, `OTHER` - `description` (string, required) - `color` (string, required) - `icon` (string, required) - `name` (string, required) - `category` (string, required) - `metadata` (string, optional) ## Examples **Request** ```json { "assetTag": { "id": "string", "name": "string", "description": "string", "assetTypes": [ "STRUCTURE" ] } } ``` **Response** ```json { "data": { "id": "string", "assetTypes": [ "STRUCTURE" ], "description": "string", "color": "string", "icon": "string", "name": "string", "category": "string", "metadata": "string" } } ``` **SDK Code** ```typescript import { TrebellarApiClient } from "@trebellar/api-sdk"; async function main() { const client = new TrebellarApiClient({ apiKey: "YOUR_API_KEY_HERE", }); await client.assets.addAssetTag({ assetTag: { id: "string", name: "string", description: "string", assetTypes: [ "STRUCTURE", ], }, }); } main(); ``` ```python from trebellar import TrebellarApi from trebellar.assets import AddAssetTagRequestAssetTag client = TrebellarApi( api_key="YOUR_API_KEY_HERE", ) client.assets.add_asset_tag( asset_tag=AddAssetTagRequestAssetTag( id="string", name="string", description="string", asset_types=[ "STRUCTURE" ], ), ) ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.trebellar.app/api/v2/assets/tags/add" payload := strings.NewReader("{\n \"assetTag\": {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"assetTypes\": [\n \"STRUCTURE\"\n ]\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("X-Trebellar-Api-Key", "") req.Header.Add("Content-Type", "application/json") 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/tags/add") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["X-Trebellar-Api-Key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"assetTag\": {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"assetTypes\": [\n \"STRUCTURE\"\n ]\n }\n}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.trebellar.app/api/v2/assets/tags/add") .header("X-Trebellar-Api-Key", "") .header("Content-Type", "application/json") .body("{\n \"assetTag\": {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"assetTypes\": [\n \"STRUCTURE\"\n ]\n }\n}") .asString(); ``` ```php request('POST', 'https://api.trebellar.app/api/v2/assets/tags/add', [ 'body' => '{ "assetTag": { "id": "string", "name": "string", "description": "string", "assetTypes": [ "STRUCTURE" ] } }', 'headers' => [ 'Content-Type' => 'application/json', 'X-Trebellar-Api-Key' => '', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.trebellar.app/api/v2/assets/tags/add"); var request = new RestRequest(Method.POST); request.AddHeader("X-Trebellar-Api-Key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"assetTag\": {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"assetTypes\": [\n \"STRUCTURE\"\n ]\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "X-Trebellar-Api-Key": "", "Content-Type": "application/json" ] let parameters = ["assetTag": [ "id": "string", "name": "string", "description": "string", "assetTypes": ["STRUCTURE"] ]] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.trebellar.app/api/v2/assets/tags/add")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data 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() ```