Reference: Export data through the Asset REST API

To retrieve data from Asset, use an Asset view and send the data in JSON format through the Asset REST API.

Tip: This reference includes a scenario to retrieve data through a ServiceNow view. You can adapt these steps to retrieve data through any view in Asset.

Before you begin

  • These steps require Tanium Gateway to manage API tokens. For more information, see Asset requirements.

  • To create a view in Asset, you require a role with the Asset Report write permission. The predefined Asset Administrator, Asset Operator, and Asset User roles contain this permission.

  • The steps use cURL to test the API from a local machine. To follow these steps verbatim, ensure that cURL is installed and available on your Windows, Linux, or macOS machine. You can also use your preferred API tool to access the API.

  • These steps require you to create a new Asset API user in Tanium Console. Ensure the user account exists in your IdP. For more information, see Tanium Console User Guide: User authentication.

Create a dedicated ServiceNow view

Create a view to filter endpoint data in Asset so that you only export attributes that you want.

Note: These steps create a view for the ServiceNow Service Graph Connector pull integration. You can adapt these steps to create views for other integrations.
  1. From the Main menu, go to Modules > Asset > Views.
  2. If the ServiceNow (reserved) view does not appear in the grid, click Create Views, and select Create ServiceNow View.

    Asset creates the ServiceNow (reserved) view and updates the grid on the Views page.

  3. In the row of the ServiceNow (reserved) view, click Create Copy duplicate.

    The Create View page loads with data prefilled from the ServiceNow (reserved) view.

  4. Update the name of the view. For example, ServiceNow SGC.
  5. In the Select Columns from Asset Tables section, select the columns that you want to include in the view. These example steps include the Computer Name and OS Platform columns.
  6. Add any filters as desired.
    Note: Available filters depend on which columns you add to the view. For example, if you include the SIU Product Usage > Usage column, the SIU Product Usage Filter section appears. You can then add a filter in the SIU Product Usage Filter section to remove assets whose SIU product usage is not installed. To do so, select the Usage attribute, set the operator to does not contain, enter a value of not installed, and then click Apply check.
  7. Click Submit to save the view.

    Asset saves the view and loads the Views page.

  8. Test the view. On the Views page, hover over a view and click Test View check2, which runs the view for a single asset. The resulting message states whether the view can run successfully or contains errors such as pending attributes.
  9. Record the ID of the new view.
    1. From the grid on the Views page, click Edit edit2 in the row of the new view.
    2. In the URL field of your browser, record the number that appears at the end of the URL.
      Example browser that shows URL of the new Asset view

Create a user account with the Asset API User role

Create a specific Asset API User account for which to retrieve data through the Asset API.

Note: For continuity, create a service account that is not assigned to any particular person. The service account should have enough permissions to read data from Asset views and create and rotate tokens for Asset API access. Before you create a user account in Tanium Console, make sure an account exists in your IdP and any multifactor authentication is configured.
Note: Alternatively, you can use a persona to represent a restricted account. However, if the Tanium user account is deleted, any API tokens that are associated with the account are no longer valid. For more information about API tokens, see Tanium Console User Guide: Managing API tokens.
  1. From the Main menu, go to Administration > Permissions > Users and click New User.
  2. Specify a User Name that matches an account in your IdP.
  3. Set the Display Name to Asset API User.
  4. In the Roles section, click Manage Roles.
  5. Select the Asset Report Reader and Gateway User roles, then click Apply.
  6. Click Save.
Note: Do not assign any user groups or computer groups to the user.

For more information about how to create user accounts in Tanium Console, see Tanium Console User Guide: Create a user.

Verify permissions and create an API token

Sign in to Tanium Console with the new user account to verify that you can see views in Asset and generate API tokens.

  1. Sign in to Console as Asset API User.
  2. From the Main menu, go to Modules > Asset > Views.

    If you cannot access the page, verify the Asset API User role has the Asset Report Reader role.

  3. Verify that you can see the view you created.

    If the view does not appear, sign in to Console as a user with the Asset Report Reader permission, create the view as described in Create a dedicated ServiceNow view, and then try this step again.

    Example Views page that shows a 'ServiceNow SGC' view
  4. Generate an API token for use by the Asset API User. You require a single API token per ServiceNow environment for each integration.
    Note: Do not use a single token to establish sessions for multiple processes. When a token rotates for any process, that token stops working for any other processes that use the token. If you have three different environments for which you need to configure the Service Graph Connector, you can reuse the Asset API User account, but you need to create three API tokens, one for each environment.
    1. From the Main menu, go to Administration > Permissions > API Tokens and click New API Token.
    2. Enter Service Graph Connector or similar message for Notes and then specify an expiration time.
    3. Leave Persona set to Default.
    4. Enter the external IP addresses of the systems from which you will use this token to authenticate with the Tanium Server.
    5. Click Save.

      The View API Token dialog appears.

    6. Click Copy API Token copy-to-clipboard to copy the token string to your clipboard, and then click Close to return to the API Tokens page.

      For more information about how to create API tokens, see Tanium Console User Guide: Managing API tokens.

Retrieve data

Retrieve data through the Asset API integration independent of any third-party applications or partner connections. The following steps use cURL to test the API integration from Windows, Linux, and macOS machines.

Note: If your instance uses a ServiceNow MID Server or similar intermediary system, run these tests from that server.
  1. On a Windows machine, open an administrator command prompt. On Linux or macOS machines, open a Terminal window.
  2. Run the following command to set a variable for the Tanium Server, where <YourInstanceName> is the domain name or IP address of the Tanium Server.
    • Windows:

      CODE
      set TS=<YourInstanceName>
    • Linux / macOS:

      CODE
      export TS=<YourInstanceName>
  3. Run the following command to set the session token, where <YourApiToken> is the API token string that you copied to your clipboard.
    • Windows:

      CODE
      set S=<YourApiToken>
    • Linux / macOS:

      CODE
      export S=<YourApiToken>
    Tip: Include the entire token string, including the token- prefix. For example, set S=token-744b6a6e9408c8fec82871c80ce0d8ec6d40c7c63b04d42325c4aea824.
  4. Run the following command to verify that you have the correct ID for the view that you created. Replace the ID at the end of the URL with the ID that you recorded.
    • Windows:

      CODE
      curl -k -X GET -4 -H "tanium_server: %TS%" -H "Content-Type:
                    application/json" -H "session: %S%"
                    "https://%TS%/plugin/products/asset/v1/views/2"
    • Linux / macOS:

      JSON
      curl -k -X GET -4 -H "tanium_server: ${TS}" -H "Content-Type:
                    application/json" -H "session: $S"
                    "https://${TS}/plugin/products/asset/v1/views/2"

    A successful response contains the definition of the view in JSON format:

    JSON
    {
       "data":{
          "definition":{
             "attributes":[
                {
                   "id":1,
                   "entityId":1,
                   "entityName":"Computer Name",
                   "tableName":"ci_item",
                   "displayName":"Computer Name",
                   "fieldName":"computer_name",
                   "dataType":"text"
                },
                {
                   "id":3,
                   "entityId":3,
                   "entityName":"OS Platform",
                   "tableName":"ci_item",
                   "displayName":"OS Platform",
                   "fieldName":"os_platform",
                   "dataType":"text"
                }
             ],
             "filter":{
                "$or":[
    
                ]
             }
          },
          "id":2,
          "viewName":"ServiceNow SGC",
          "description":"Reserved ServiceNow View; default view used by new ServiceNow destinations",
          "reserved":false,
          "username":"tanium",
          "createdAt":"2025-05-23T15:33:28.212Z",
          "updatedAt":"2025-05-23T15:33:28.212Z",
          "status":"ready"
       }
    }
  5. Run the following command to retrieve and validate data from 100 endpoints. Replace the ID associated with the viewId with the ID of your ServiceNow SCG view.
    • Windows:

      CODE
      curl -k -X GET -4 -H "tanium_server: %TS%" -H 'Content-Type:
                    application/json' -H "session: %S%"
                    "https://%TS%/plugin/products/asset/v1/assets?viewId=2&minimumAssetId=1&limit=100"
    • Linux / macOS:

      JSON
      curl -k -X GET -4 -H "tanium_server: ${TS}" -H 'Content-Type:
                    application/json' -H "session: $S"
                    "https://${TS}/plugin/products/asset/v1/assets?viewId=2&minimumAssetId=1&limit=100"

    A successful response contains details for up to 100 endpoints in JSON format. truncated example:

    JSON
    {
       "meta":{
          "nextAssetId":101,
          "endOfReader":false
       },
       "data":[
          {
             "computer_name":"test001",
             "os_platform":"AIX"
          },
          {
             "computer_name":"test002",
             "os_platform":"Linux"
          },
          {
             "computer_name":"test003",
             "os_platform":"Windows"
          }
       ]
    }
    The response includes two metadata properties to help paginate the data:
    • nextAssetId: The ID of the next asset to retrieve. In terms of pagination, use this value as the cursor to start the next page of data. When endOfReader is false, the nextAssetId field is omitted from the response.

    • endOfReader: A value of false indicates that more endpoint data is available. To retrieve all endpoint data, paginate until you reach the end of the results, indicated when endOfReader is true.

    The nextAssetId and endOfReader properties appear in the meta section at the beginning of the response. For example:

    JSON
    {"meta":{"nextAssetId":101,"endOfReader":false},"data":[{...
  6. Continue to run the GET command. In each command, set the minimumAssetId parameter to the value of the nextAssetId property that was returned in the previous response.
    • Windows:

      CODE
      curl -k -X GET -4 -H "tanium_server: %TS%" -H 'Content-Type:
                    application/json' -H "session: %S%"
                    "https://%TS%/plugin/products/asset/v1/assets?viewId=2&minimumAssetId=101&limit=100"
    • Linux / macOS:

      JSON
      curl -k -X GET -4 -H "tanium_server: ${TS}" -H 'Content-Type:
                    application/json' -H "session: $S"
                    "https://${TS}/plugin/products/asset/v1/assets?viewId=2&minimumAssetId=101&limit=100"

    When a response includes endOfReader: true and omits the nextAssetId property, there are no more assets to retrieve.

Note:

Large gaps in asset IDs might result in a 500 error and the meta section might still indicate more results and data is null. For example:

{"meta":{"nextAssetId":244,"message":{"code":"asset-additional-results-may-exist-1","text":"Additional results may exist. Try again with a larger minimumAssetId."},"endOfReader":false},"data":[]}

This can occur when the view uses filters to exclude endpoints that have no data for a specific column. If you encounter a 500 error, check to see if the response contains a meta section. If the meta section appears and endOfReader is false, try the request again with a larger minimumAssetId value.