Asset Types
When managing assets in Zendesk, an admin must first define the asset type, which becomes an object in Zendesk. The asset type definition consists of standard and custom fields that describe the data you need to store for this type of asset. After an asset type is created, records of individual assets of that type can be added to Zendesk.
Asset types are defined in a hierarchical structure with a maximum depth of 3. Each child asset type inherits the parent asset types' fields. This eliminates the need to recreate the same field repeatedly for different asset types. Including the pre-defined asset types Zendesk provides, you can have a total of 50 asset types.
JSON format
ITAM Asset Types are represented as JSON objects with the following properties:
| Name | Type | Read-only | Mandatory | Description |
|---|---|---|---|---|
| created_at | string | true | false | The time the asset type was created |
| description | string | false | false | A description of the asset type |
| external_id | string | false | false | An id you can use to link asset types to external data |
| field_keys | array | false | false | Custom field keys associated with the asset type |
| hierarchy_depth | integer | true | false | The depth within the hierarchy tree. Valid values: 1, 2, and 3 |
| id | string | true | false | Automatically assigned upon creation |
| name | string | true | true | A unique display name for the asset type |
| parent_id | string | false | true | The id of the parent asset type within the hierarchy tree |
| updated_at | string | true | false | The time of the asset type's last update |
| url | string | true | false | Direct link to the specific asset type |
List Asset Types
GET /api/v2/it_asset_management/asset_types
Lists all asset types.
Allowed For
- Agents
Code Samples
Curl
curl --request GET https://example.zendesk.com/api/v2/it_asset_management/asset_types \--header "Content-Type: application/json" \-u {email_address}/token:{api_token}
Go
import ("fmt""io""net/http")func main() {url := "https://example.zendesk.com/api/v2/it_asset_management/asset_types"method := "GET"req, err := http.NewRequest(method, url, nil)if err != nil {fmt.Println(err)return}req.Header.Add("Content-Type", "application/json")req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"client := &http.Client {}res, err := client.Do(req)if err != nil {fmt.Println(err)return}defer res.Body.Close()body, err := io.ReadAll(res.Body)if err != nil {fmt.Println(err)return}fmt.Println(string(body))}
Java
import com.squareup.okhttp.*;OkHttpClient client = new OkHttpClient();HttpUrl.Builder urlBuilder = HttpUrl.parse("https://example.zendesk.com/api/v2/it_asset_management/asset_types").newBuilder();String userCredentials = "your_email_address" + "/token:" + "your_api_token";String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());Request request = new Request.Builder().url(urlBuilder.build()).method("GET", null).addHeader("Content-Type", "application/json").addHeader("Authorization", basicAuth).build();Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');var config = {method: 'GET',url: 'https://example.zendesk.com/api/v2/it_asset_management/asset_types',headers: {'Content-Type': 'application/json','Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"},};axios(config).then(function (response) {console.log(JSON.stringify(response.data));}).catch(function (error) {console.log(error);});
Python
import requestsfrom requests.auth import HTTPBasicAuthurl = "https://example.zendesk.com/api/v2/it_asset_management/asset_types"headers = {"Content-Type": "application/json",}email_address = 'your_email_address'api_token = 'your_api_token'# Use basic authenticationauth = HTTPBasicAuth(f'{email_address}/token', api_token)response = requests.request("GET",url,auth=auth,headers=headers)print(response.text)
Ruby
require "net/http"require "base64"uri = URI("https://example.zendesk.com/api/v2/it_asset_management/asset_types")request = Net::HTTP::Get.new(uri, "Content-Type": "application/json")email = "your_email_address"api_token = "your_api_token"credentials = "#{email}/token:#{api_token}"encoded_credentials = Base64.strict_encode64(credentials)request["Authorization"] = "Basic #{encoded_credentials}"response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|http.request(request)end
curl - Get assets
curl https://{subdomain}.zendesk.com/api/v2/it_asset_management/asset_types.json \-v -u {email_address}/token:{api_token}
Example response(s)
200 OK
// Status 200 OK{"asset_types": [{"description": null,"external_id": null,"field_keys": ["imei","phone_number"],"hierarchy_depth": 2,"id": "01K9BT5X539BKC8SEF430HAJHJ","name": "Mobile","parent_id": "01K9BT5SXPR60963HJVPWTZQHD","url": "https://{subdomain}.zendesk.com/api/v2/it_asset_management/asset_types/01K9BT5X539BKC8SEF430HAJHJ.json"},{"description": null,"external_id": null,"field_keys": [],"hierarchy_depth": 2,"id": "01K9BT5X2VZQH191VYA3GQN7NY","name": "Desktop","parent_id": "01K9BT5SXPR60963HJVPWTZQHD","url": "https://{subdomain}.zendesk.com/api/v2/it_asset_management/asset_types/01K9BT5X2VZQH191VYA3GQN7NY.json"},{"description": null,"external_id": null,"field_keys": [],"hierarchy_depth": 2,"id": "01K9BT5X0115ZVH1X6T37WYMTE","name": "Laptop","parent_id": "01K9BT5SXPR60963HJVPWTZQHD","url": "https://{subdomain}.zendesk.com/api/v2/it_asset_management/asset_types/01K9BT5X0115ZVH1X6T37WYMTE.json"},{"description": null,"external_id": "hardware","field_keys": ["last_sync_timestamp","operating_system","os_version","ip_address","mac_address","storage_capacity","free_storage","enrollment_status","udid","encryption_status","device_ownership_type","managed","compliance_state","cpu_type","ram_total","firmware_version","last_sign_in_timestamp"],"hierarchy_depth": 1,"id": "01K9BT5SXPR60963HJVPWTZQHD","name": "Hardware","parent_id": "01K9BT5SQ70KHAKHDCDR0C5EB6","url": "https://{subdomain}.zendesk.com/api/v2/it_asset_management/asset_types/01K9BT5SXPR60963HJVPWTZQHD.json"}]}
Show Asset Type
GET /api/v2/it_asset_management/asset_types/{asset_type_id}
Returns an asset type with the specified id.
Allowed For
- Agents
Parameters
| Name | Type | In | Required | Description |
|---|---|---|---|---|
| asset_type_id | string | Path | true | The id of the asset type |
Code Samples
Curl
curl --request GET https://example.zendesk.com/api/v2/it_asset_management/asset_types/01K9AMAY0ST7VTVSG7SDAMR4P1 \--header "Content-Type: application/json" \-u {email_address}/token:{api_token}
Go
import ("fmt""io""net/http")func main() {url := "https://example.zendesk.com/api/v2/it_asset_management/asset_types/01K9AMAY0ST7VTVSG7SDAMR4P1"method := "GET"req, err := http.NewRequest(method, url, nil)if err != nil {fmt.Println(err)return}req.Header.Add("Content-Type", "application/json")req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"client := &http.Client {}res, err := client.Do(req)if err != nil {fmt.Println(err)return}defer res.Body.Close()body, err := io.ReadAll(res.Body)if err != nil {fmt.Println(err)return}fmt.Println(string(body))}
Java
import com.squareup.okhttp.*;OkHttpClient client = new OkHttpClient();HttpUrl.Builder urlBuilder = HttpUrl.parse("https://example.zendesk.com/api/v2/it_asset_management/asset_types/01K9AMAY0ST7VTVSG7SDAMR4P1").newBuilder();String userCredentials = "your_email_address" + "/token:" + "your_api_token";String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());Request request = new Request.Builder().url(urlBuilder.build()).method("GET", null).addHeader("Content-Type", "application/json").addHeader("Authorization", basicAuth).build();Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');var config = {method: 'GET',url: 'https://example.zendesk.com/api/v2/it_asset_management/asset_types/01K9AMAY0ST7VTVSG7SDAMR4P1',headers: {'Content-Type': 'application/json','Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"},};axios(config).then(function (response) {console.log(JSON.stringify(response.data));}).catch(function (error) {console.log(error);});
Python
import requestsfrom requests.auth import HTTPBasicAuthurl = "https://example.zendesk.com/api/v2/it_asset_management/asset_types/01K9AMAY0ST7VTVSG7SDAMR4P1"headers = {"Content-Type": "application/json",}email_address = 'your_email_address'api_token = 'your_api_token'# Use basic authenticationauth = HTTPBasicAuth(f'{email_address}/token', api_token)response = requests.request("GET",url,auth=auth,headers=headers)print(response.text)
Ruby
require "net/http"require "base64"uri = URI("https://example.zendesk.com/api/v2/it_asset_management/asset_types/01K9AMAY0ST7VTVSG7SDAMR4P1")request = Net::HTTP::Get.new(uri, "Content-Type": "application/json")email = "your_email_address"api_token = "your_api_token"credentials = "#{email}/token:#{api_token}"encoded_credentials = Base64.strict_encode64(credentials)request["Authorization"] = "Basic #{encoded_credentials}"response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|http.request(request)end
curl - Get asset type by id
curl https://{subdomain}.zendesk.com/api/v2/it_asset_management/asset_types/{asset_type_id}.json \-v -u {email_address}/token:{api_token}
Example response(s)
200 OK
// Status 200 OK{"asset_type": {"description": null,"external_id": null,"field_keys": ["imei","phone_number"],"hierarchy_depth": 2,"id": "01K9BT5X539BKC8SEF430HAJHJ","name": "Mobile","parent_id": "01K9BT5SXPR60963HJVPWTZQHD","url": "https://{subdomain}.zendesk.com/api/v2/it_asset_management/asset_types/01K9BT5X539BKC8SEF430HAJHJ.json"}}
Create Asset Type
POST /api/v2/it_asset_management/asset_types
Creates an asset type.
Allowed For
- Admins
Example body
{"asset_type": {"name": "Tablet","parent_id": "01K9BX5R6EAV3CH1J560S8SKHR"}}
Code Samples
Curl
curl --request POST https://example.zendesk.com/api/v2/it_asset_management/asset_types \--header "Content-Type: application/json" \-u {email_address}/token:{api_token} \--data-raw '{"asset_type": {"name": "Tablet","parent_id": "01K9BX5R6EAV3CH1J560S8SKHR"}}'
Go
import ("fmt""io""net/http""strings")func main() {url := "https://example.zendesk.com/api/v2/it_asset_management/asset_types"method := "POST"payload := strings.NewReader(`{"asset_type": {"name": "Tablet","parent_id": "01K9BX5R6EAV3CH1J560S8SKHR"}}`)req, err := http.NewRequest(method, url, payload)if err != nil {fmt.Println(err)return}req.Header.Add("Content-Type", "application/json")req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"client := &http.Client {}res, err := client.Do(req)if err != nil {fmt.Println(err)return}defer res.Body.Close()body, err := io.ReadAll(res.Body)if err != nil {fmt.Println(err)return}fmt.Println(string(body))}
Java
import com.squareup.okhttp.*;OkHttpClient client = new OkHttpClient();HttpUrl.Builder urlBuilder = HttpUrl.parse("https://example.zendesk.com/api/v2/it_asset_management/asset_types").newBuilder();RequestBody body = RequestBody.create(MediaType.parse("application/json"),"""{\"asset_type\": {\"name\": \"Tablet\",\"parent_id\": \"01K9BX5R6EAV3CH1J560S8SKHR\"}}""");String userCredentials = "your_email_address" + "/token:" + "your_api_token";String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());Request request = new Request.Builder().url(urlBuilder.build()).method("POST", body).addHeader("Content-Type", "application/json").addHeader("Authorization", basicAuth).build();Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');var data = JSON.stringify({"asset_type": {"name": "Tablet","parent_id": "01K9BX5R6EAV3CH1J560S8SKHR"}});var config = {method: 'POST',url: 'https://example.zendesk.com/api/v2/it_asset_management/asset_types',headers: {'Content-Type': 'application/json','Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"},data : data,};axios(config).then(function (response) {console.log(JSON.stringify(response.data));}).catch(function (error) {console.log(error);});
Python
import requestsimport jsonfrom requests.auth import HTTPBasicAuthurl = "https://example.zendesk.com/api/v2/it_asset_management/asset_types"payload = json.loads("""{"asset_type": {"name": "Tablet","parent_id": "01K9BX5R6EAV3CH1J560S8SKHR"}}""")headers = {"Content-Type": "application/json",}email_address = 'your_email_address'api_token = 'your_api_token'# Use basic authenticationauth = HTTPBasicAuth(f'{email_address}/token', api_token)response = requests.request("POST",url,auth=auth,headers=headers,json=payload)print(response.text)
Ruby
require "net/http"require "base64"uri = URI("https://example.zendesk.com/api/v2/it_asset_management/asset_types")request = Net::HTTP::Post.new(uri, "Content-Type": "application/json")request.body = %q({"asset_type": {"name": "Tablet","parent_id": "01K9BX5R6EAV3CH1J560S8SKHR"}})email = "your_email_address"api_token = "your_api_token"credentials = "#{email}/token:#{api_token}"encoded_credentials = Base64.strict_encode64(credentials)request["Authorization"] = "Basic #{encoded_credentials}"response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|http.request(request)end
curl - Create asset
For clarity, the example places the JSON in a separate file and imports it into the cURL statement
my_asset_type.json
{"asset_type": {"name": "Tablet","parent_id": "01K9BXE24BP175Y9ZDJW2FV0KQ"}}
curl - Create asset snippet
curl https://{subdomain}.zendesk.com/api/v2/it_asset_management/assets.json \-d @my_asset_type.json \-H "Content-Type: application/json" -v -u {email_address}/token:{api_token} -X POST
Example response(s)
201 Created
// Status 201 Created{"asset_type": {"description": null,"external_id": null,"field_keys": ["imei","phone_number"],"hierarchy_depth": 2,"id": "01K9BT5X539BKC8SEF430HAJHJ","name": "Mobile","parent_id": "01K9BT5SXPR60963HJVPWTZQHD","url": "https://{subdomain}.zendesk.com/api/v2/it_asset_management/asset_types/01K9BT5X539BKC8SEF430HAJHJ.json"}}
Update Asset Type
PATCH /api/v2/it_asset_management/asset_types/{asset_type_id}
Updates an existing asset type.
Allowed For
- Admins
Parameters
| Name | Type | In | Required | Description |
|---|---|---|---|---|
| asset_type_id | string | Path | true | The id of the asset type |
Code Samples
Curl
curl --request PATCH https://example.zendesk.com/api/v2/it_asset_management/asset_types/01K9AMAY0ST7VTVSG7SDAMR4P1 \--header "Content-Type: application/json" \-u {email_address}/token:{api_token}
Go
import ("fmt""io""net/http")func main() {url := "https://example.zendesk.com/api/v2/it_asset_management/asset_types/01K9AMAY0ST7VTVSG7SDAMR4P1"method := "PATCH"req, err := http.NewRequest(method, url, nil)if err != nil {fmt.Println(err)return}req.Header.Add("Content-Type", "application/json")req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"client := &http.Client {}res, err := client.Do(req)if err != nil {fmt.Println(err)return}defer res.Body.Close()body, err := io.ReadAll(res.Body)if err != nil {fmt.Println(err)return}fmt.Println(string(body))}
Java
import com.squareup.okhttp.*;OkHttpClient client = new OkHttpClient();HttpUrl.Builder urlBuilder = HttpUrl.parse("https://example.zendesk.com/api/v2/it_asset_management/asset_types/01K9AMAY0ST7VTVSG7SDAMR4P1").newBuilder();RequestBody body = RequestBody.create(MediaType.parse("application/json"),"""""");String userCredentials = "your_email_address" + "/token:" + "your_api_token";String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());Request request = new Request.Builder().url(urlBuilder.build()).method("PATCH", body).addHeader("Content-Type", "application/json").addHeader("Authorization", basicAuth).build();Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');var config = {method: 'PATCH',url: 'https://example.zendesk.com/api/v2/it_asset_management/asset_types/01K9AMAY0ST7VTVSG7SDAMR4P1',headers: {'Content-Type': 'application/json','Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"},};axios(config).then(function (response) {console.log(JSON.stringify(response.data));}).catch(function (error) {console.log(error);});
Python
import requestsfrom requests.auth import HTTPBasicAuthurl = "https://example.zendesk.com/api/v2/it_asset_management/asset_types/01K9AMAY0ST7VTVSG7SDAMR4P1"headers = {"Content-Type": "application/json",}email_address = 'your_email_address'api_token = 'your_api_token'# Use basic authenticationauth = HTTPBasicAuth(f'{email_address}/token', api_token)response = requests.request("PATCH",url,auth=auth,headers=headers)print(response.text)
Ruby
require "net/http"require "base64"uri = URI("https://example.zendesk.com/api/v2/it_asset_management/asset_types/01K9AMAY0ST7VTVSG7SDAMR4P1")request = Net::HTTP::Patch.new(uri, "Content-Type": "application/json")email = "your_email_address"api_token = "your_api_token"credentials = "#{email}/token:#{api_token}"encoded_credentials = Base64.strict_encode64(credentials)request["Authorization"] = "Basic #{encoded_credentials}"response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|http.request(request)end
curl - Update asset type by id
For clarity, the example places the JSON in a separate file and imports it into the cURL statement
updated_asset_type.json
{"asset_type": {"name": "Tablet","parent_id": "01K9BXMJ33GM9567ZWQ2M3X66X"}}
curl - Update asset type by id snippet
curl https://{subdomain}.zendesk.com/api/v2/it_asset_management/asset_types/{asset_type_id}.json \-d @updated_asset_type.json \-H "Content-Type: application/json" -X PATCH \-v -u {email_address}/token:{api_token}
Example response(s)
200 OK
// Status 200 OK{"asset_type": {"description": null,"external_id": null,"field_keys": ["imei","phone_number"],"hierarchy_depth": 2,"id": "01K9BT5X539BKC8SEF430HAJHJ","name": "Mobile","parent_id": "01K9BT5SXPR60963HJVPWTZQHD","url": "https://{subdomain}.zendesk.com/api/v2/it_asset_management/asset_types/01K9BT5X539BKC8SEF430HAJHJ.json"}}
Delete Asset Type
DELETE /api/v2/it_asset_management/asset_types/{asset_type_id}
Deletes an asset type with the specified id.
Allowed For
- Admins
Parameters
| Name | Type | In | Required | Description |
|---|---|---|---|---|
| asset_type_id | string | Path | true | The id of the asset type |
Code Samples
Curl
curl --request DELETE https://example.zendesk.com/api/v2/it_asset_management/asset_types/01K9AMAY0ST7VTVSG7SDAMR4P1 \--header "Content-Type: application/json" \-u {email_address}/token:{api_token}
Go
import ("fmt""io""net/http")func main() {url := "https://example.zendesk.com/api/v2/it_asset_management/asset_types/01K9AMAY0ST7VTVSG7SDAMR4P1"method := "DELETE"req, err := http.NewRequest(method, url, nil)if err != nil {fmt.Println(err)return}req.Header.Add("Content-Type", "application/json")req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"client := &http.Client {}res, err := client.Do(req)if err != nil {fmt.Println(err)return}defer res.Body.Close()body, err := io.ReadAll(res.Body)if err != nil {fmt.Println(err)return}fmt.Println(string(body))}
Java
import com.squareup.okhttp.*;OkHttpClient client = new OkHttpClient();HttpUrl.Builder urlBuilder = HttpUrl.parse("https://example.zendesk.com/api/v2/it_asset_management/asset_types/01K9AMAY0ST7VTVSG7SDAMR4P1").newBuilder();String userCredentials = "your_email_address" + "/token:" + "your_api_token";String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());Request request = new Request.Builder().url(urlBuilder.build()).method("DELETE", null).addHeader("Content-Type", "application/json").addHeader("Authorization", basicAuth).build();Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');var config = {method: 'DELETE',url: 'https://example.zendesk.com/api/v2/it_asset_management/asset_types/01K9AMAY0ST7VTVSG7SDAMR4P1',headers: {'Content-Type': 'application/json','Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"},};axios(config).then(function (response) {console.log(JSON.stringify(response.data));}).catch(function (error) {console.log(error);});
Python
import requestsfrom requests.auth import HTTPBasicAuthurl = "https://example.zendesk.com/api/v2/it_asset_management/asset_types/01K9AMAY0ST7VTVSG7SDAMR4P1"headers = {"Content-Type": "application/json",}email_address = 'your_email_address'api_token = 'your_api_token'# Use basic authenticationauth = HTTPBasicAuth(f'{email_address}/token', api_token)response = requests.request("DELETE",url,auth=auth,headers=headers)print(response.text)
Ruby
require "net/http"require "base64"uri = URI("https://example.zendesk.com/api/v2/it_asset_management/asset_types/01K9AMAY0ST7VTVSG7SDAMR4P1")request = Net::HTTP::Delete.new(uri, "Content-Type": "application/json")email = "your_email_address"api_token = "your_api_token"credentials = "#{email}/token:#{api_token}"encoded_credentials = Base64.strict_encode64(credentials)request["Authorization"] = "Basic #{encoded_credentials}"response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|http.request(request)end
curl - Delete asset type by id
curl https://{subdomain}.zendesk.com/api/v2/it_asset_management/asset_types/{asset_type_id}.json \-X DELETE \-v -u {email_address}/token:{api_token}
Example response(s)
204 No Content
// Status 204 No Contentnull