Reference: Gateway examples for Discover

Tanium Gateway provides a GraphQL API integration point for Tanium solutions, including Discover. Discover queries and mutations retrieve information about Discover labels and interfaces, create or delete labels, or update labels applied to interfaces.

Discover requests have the following feature-specific dependencies at the specified minimum versions:

  • Discover 4.8.298 or later is required to submit a request involving Discover interfaces or labels (mutation.discoverInterfaceAddLabel, mutation.discoverInterfaceRemoveLabel, mutation.discoverLabelCreate, mutation.discoverLabelDelete, query.discoverInterface, query.discoverInterfaces, query.discoverLabel, query.discoverLabels).

For more information about how to view additional Gateway example syntax, see Reference: Filter syntax and Reference: Gateway examples.

Discover query filter syntax

Discover queries that request labels or interfaces using discoverLabels or discoverInterfaces support the path and value filter fields.

For more information on syntax, see FieldFilter in the Documentation Explorer pane of the query explorer.

Single column

You can filter on field values. Define a filter object using one of the following syntaxes:

JSON
discoverInterfaces (
  filter: {
    path: "field-path",
    op: "operator-value",
    value: "field-value"
  }
)
JSON
discoverLabels (
  filter: {
    path: "field-path",
    op: "operator-value",
    value: "field-value"
  }
)

Use dot notation for sub-fields not at the root level.

For example, the following query retrieves labels with a createdTime value greater than 2022 and returns the labels:

JSON
query exampleGetLabels {
  discoverLabels(
    filter: {
      path: "createdTime",
      op: GT,
      value: "2023-01-01"
    }
  ) {
    edges {
      node {
        name
        type
        createdTime
        modifiedTime
      }
    }
  }
}

Multiple columns

You can filter on multiple Discover-related columns. Define a filter object using one of the following syntaxes:

JSON
discoverInterfaces (
  filter: {
    any: boolean,
    filters: [
      {
        path: "field-path-1",
        op: "operator-1",
        value: "filter-value-1"
      },
      {
        path: "field-path-2",
        op: "operator-2",
        value: "filter-value-2"
      },
      {
        path: "field-path-n",
        op: "operator-n",
        value: "filter-value-n"
      }
    ]
  }
)
JSON
discoverLabels (
  filter: {
    any: boolean,
    filters: [
      {
        path: "field-path-1",
        op: "operator-1",
        value: "filter-value-1"
      },
      {
        path: "field-path-2",
        op: "operator-2",
        value: "filter-value-2"
      },
      {
        path: "field-path-n",
        op: "operator-n",
        value: "filter-value-n"
      }
    ]
  }
)

Use dot notation for sub-fields not at the root level.

For example, the following query retrieves interfaces associated with the label Example_label and an osPlatform of Linux, and returns matching interfaces:

JSON
query exampleGetInterfaces {
  discoverInterfaces(
    filter: {
      any: false,
      filters: [
        {
          path: "labels.name",
          op: EQ,
          value: "Example_label"
        },
        {
          path: "osPlatform",
          op: EQ,
          value: "Linux"
        }
      ]
    }
  ) {
    edges {
      node {
        id
        labels
        osPlatform
      }
    }
  }
}

Add labels to interfaces

(mutation.discoverInterfaceAddLabel

Add Discover labels to Discover interfaces

The discoverInterfaceAddLabel mutation requires Discover 4.8.298 or later and the Discover Tag write permission.

The following mutation manually adds one or more standard labels to one or more specified interfaces. This mutation does not support automatic evaluation to apply labels.

JSON
mutation exampleAddInterfaceLabel($labelNames: [String!]!, $interfaceIDs: [ID!]!) {
  discoverInterfaceAddLabel(
    input: {
      names: $labelNames,
      interfaceIDs: $interfaceIDs
    }
  ) {
    success
    error {
      message
    }
    cursor
  }
}

Include the interface variables in the Variables panel or in your variables dictionary:

JSON
{
  "labelNames": [
    "example_label",
    "example_label_2"
  ],
  "interfaceIDs": [
    12345,
    67890
  ]
}

Example response:

JSON
{
  "data": {
    "discoverInterfaceAddLabel": {
      "success": true,
      "error": null,
      "cursor": null
    }
  }
}

If your mutation request returns a cursor, the label is not yet added to the interfaces that you specify. You can pass the cursor as input to a subsequent discoverInterfaceAddLabel mutation to determine the status of the initial request.

JSON
mutation exampleAddInterfaceLabel ($labelNames: [String!]!, $interfaceIDs: [ID!]!){
  discoverInterfaceAddLabel (
    input: {
      labelNames: $labelNames,
      interfaceIDs: $interfaceIDs
      cursor: "Mg=="
    }
  ) {
    success
    error {
      message
    }
    cursor
  }
}

Create a label

mutation.discoverLabelCreate

Create a Discover label

The discoverLabelCreate mutation requires Discover 4.8.298 or later and the Discover Tag Write permission. If you define at least one Discover location, this also requires the Discover Location Permissions Write permission.

Note: Using Gateway, you can create a standard-type Discover label that you use to manually mark interfaces. You cannot create an automatic-type label that applies to interfaces based on configured criteria. To configure an automatic label to apply to interfaces, see Automatically label interfaces.

The following mutation creates a standard-type label.

JSON
mutation exampleCreateInterfaceLabel($labelName: String!) {
  discoverLabelCreate(
    input: {
      name: $labelName
    }
  ) {
    label {
      name
      type
      createdTime
      modifiedTime
    }
    error {
      message
    }
  }
}

Include the name variable in the Variables panel or in your variables dictionary:

JSON
{
  "labelName": "Example_label"
}

Example response:

JSON
{
  "data": {
    "discoverLabelCreate": {
      "label": {
        "name": "Example_label",
        "type": "STANDARD",
        "createdTime": "2023-03-29T13:42:22.760Z",
        "modifiedTime": "2023-03-29T13:42:22.760Z"
      },
      "error": null
    }
  }
}

Delete a label by name

mutation.discoverLabelDelete

Delete a Discover label by name

The discoverLabelDelete mutation requires Discover 4.8.298 or later and the Discover Tag write permission. If you define at least one Discover location, this also requires the Discover Location Permissions write permission.

The following mutation deletes a label. If you delete a label, the label is removed from all the related interfaces.

JSON
mutation exampleDeleteInterfaceLabel($labelName: String!) {
  discoverLabelDelete(
    ref: {
      name: $labelName
    }
  ) {
    name
    error {
      message
    }
  }
}

Include the name variable in the Variables panel or in your variables dictionary:

JSON
{
  "labelName": "Example_label"
}

Example response:

JSON
{
  "data": {
    "discoverLabelDelete": {
      "name": "Example_label",
      "error": null
    }
  }
}

Get interface by ID

query.discoverInterface

Get a Discover interface by ID

The discoverInterface query requires Discover 4.8.298 or later and the Discover Asset read permission. If you define at least one Discover location, this also requires either the User Group read permission (returns only matching interfaces to which the user group membership allows access) or the Discover Location Permissions write permission (returns all matching interfaces).

Discover versions earlier than 4.11 do not support the locallyAdministeredMacAddress field to determine whether a MAC address is locally administered.

The following query retrieves the Discover interface with the ID of 123.

JSON
query exampleGetSpecificInterface($id: ID!) {
  discoverInterface(
    ref: {
      id: $id
    }
  ) {
    id
    macAddress
    manufacturer
    locallyAdministeredMacAddress
    hostnames
    ipAddresses
    labels {
      name
      type
      createdTime
      modifiedTime
    }
    osPlatform
    openPorts
    discoveryMethods
    lastSeenTime
    computerId
    natIPAddresses
    osGeneration
    profiles {
      name
    }
    firstSeenTime
    firstManagedTime
    lastManagedTime
    lastDiscoveredTime
    isManaged
    isUnmanageable
    isIgnored
    satellites {
      id
      name
    }
  }
}

Include the ID variable in the Variables panel or in your variables dictionary:

JSON
{
  "id": "123"
}

Example response:

JSON
{
  "data": {
    "discoverInterface": {
      "id": "123",
      "macAddress": "01-23-45-67-89-AB",
      "manufacturer": "Microsoft Corporation",
      "locallyAdministeredMacAddress": false,
      "hostnames": [
        "USB-81.lan.oxfordcs.com"
      ],
      "ipAddresses": [
        "192.2.2.0"
      ],
      "labels": [
        {
          "name": "M11_Unmanaged_not_Unmanageable",
          "type": "AUTOMATIC",
          "createdTime": "2022-03-15T13:08:37.177Z",
          "modifiedTime": "2022-03-15T13:08:37.177Z"
        },
        {
          "name": "Client Install Pending Fixed",
          "type": "AUTOMATIC",
          "createdTime": "2024-06-25T17:39:34.843Z",
          "modifiedTime": "2024-06-25T17:39:34.843Z"
        },
        {
          "name": "cM_4351_repro",
          "type": "AUTOMATIC",
          "createdTime": "2024-09-30T17:33:10.861Z",
          "modifiedTime": "2024-09-30T17:33:10.861Z"
        },
        {
          "name": "dain_test",
          "type": "STANDARD",
          "createdTime": "2024-11-21T18:44:53.944Z",
          "modifiedTime": "2024-11-21T18:44:53.944Z"
        }
      ],
      "osPlatform": "Windows",
      "openPorts": [
        135,
        139,
        445,
        3389,
        5357,
        49152,
        49153,
        49154,
        49155,
        49156,
        49167
      ],
      "discoveryMethods": [
        "ARP",
        "CONNECTED",
        "PING",
        "NMAP"
      ],
      "lastSeenTime": "2026-03-25T18:39:06.401Z",
      "computerId": null,
      "natIPAddresses": [
        "198.50.20.200"
      ],
      "osGeneration": null,
      "profiles": [
        {
          "name": "Bad CIDR profile"
        },
        {
          "name": "FXF - Discover Test"
        },
        {
          "name": "SS-NMAP-HomeLab"
        }
      ],
      "firstSeenTime": "2022-09-28T14:16:10.000Z",
      "firstManagedTime": null,
      "lastManagedTime": null,
      "lastDiscoveredTime": "2026-03-25T18:39:06.397Z",
      "isManaged": false,
      "isUnmanageable": false,
      "isIgnored": false,
      "satellites": []
    }
  }
}

Get multiple interfaces

query.discoverInterfaces

Get multiple Discover interfaces

The discoverInterfaces query requires Discover 4.8.298 or later and the Discover Asset read permission. If you define at least one Discover location, this also requires either the User Group read permission (returns only matching interfaces to which the user group membership allows access) or the Discover Location Permissions write permission (returns all matching interfaces).

Discover versions earlier than 4.11 do not support the locallyAdministeredMacAddress field to determine whether a MAC address is locally administered.

The following query retrieves the first 2 Discover interfaces.

JSON
query exampleGetInterfaces($first: Int) {
  discoverInterfaces(first: $first) {
    edges {
      node {
        id
        macAddress
        manufacturer
        locallyAdministeredMacAddress
        hostnames
        ipAddresses
        labels {
          name
          type
          createdTime
          modifiedTime
        }
        osPlatform
        openPorts
        discoveryMethods
        lastSeenTime
        computerId
        natIPAddresses
        osGeneration
        profiles {
          name
        }
        firstSeenTime
        firstManagedTime
        lastManagedTime
        lastDiscoveredTime
        isManaged
        isUnmanageable
        isIgnored
        satellites {
          id
          name
        }
      }
    }
  }
}

Include the pagination variable in the Variables panel or in your variables dictionary:

JSON
{
  "first": 2
}

Example response:

JSON
{
  "data": {
    "discoverInterfaces": {
      "edges": [
        {
          "node": {
            "id": "1234",
            "macAddress": "01-23-45-67-89-AB",
            "manufacturer": "VMware, Inc.",
            "locallyAdministeredMacAddress": false,
            "hostnames": [],
            "ipAddresses": [
              "192.0.20.10"
            ],
            "labels": [
              {
                "name": "Example label 1",
                "type": "AUTOMATIC",
                "createdTime": "2020-05-20T14:48:30.259Z",
                "modifiedTime": "2025-07-07T19:58:02.976Z"
              },
              {
                "name": "Example label 2",
                "type": "AUTOMATIC",
                "createdTime": "2022-03-15T13:08:37.177Z",
                "modifiedTime": "2022-03-15T13:08:37.177Z"
              },
              {
                "name": "Example label 3",
                "type": "STANDARD",
                "createdTime": "2026-03-17T13:10:32.462Z",
                "modifiedTime": "2026-03-17T13:10:32.462Z"
              }
            ],
            "osPlatform": "Windows",
            "openPorts": null,
            "discoveryMethods": [
              "ARP",
              "CONNECTED",
              "PING",
              "NMAP",
              "SATELLITE_NMAP",
              "NDP"
            ],
            "lastSeenTime": "2026-03-25T18:39:06.401Z",
            "computerId": null,
            "natIPAddresses": [
              "198.50.100.10"
            ],
            "osGeneration": "10",
            "profiles": [
              {
                "name": "Example profile 1"
              },
              {
                "name": "Example profile 2"
              },
              {
                "name": "Example profile 3"
              }
            ],
            "firstSeenTime": "2021-07-20T01:28:49.000Z",
            "firstManagedTime": "2023-08-14T12:09:41.000Z",
            "lastManagedTime": "2024-01-12T16:47:20.796Z",
            "lastDiscoveredTime": "2026-03-25T16:39:05.325Z",
            "isManaged": false,
            "isUnmanageable": false,
            "isIgnored": false,
            "satellites": [
              {
                "id": "b58a6c1a-79c6-46e5-903d-7975974ef349",
                "name": "satellite-ubuntu24-intel-test1"
              }
            ]
          }
        },
        {
          "node": {
            "id": "4567",
            "macAddress": "CD-EF-01-23-45-67",
            "manufacturer": "VMware, Inc.",
            "locallyAdministeredMacAddress": false,
            "hostnames": [],
            "ipAddresses": [
              "192.10.20.30"
            ],
            "labels": [
              {
                "name": "Example label 2",
                "type": "AUTOMATIC",
                "createdTime": "2022-03-15T13:08:37.177Z",
                "modifiedTime": "2022-03-15T13:08:37.177Z"
              },
              {
                "name": "Example label 4",
                "type": "AUTOMATIC",
                "createdTime": "2024-03-28T19:05:55.605Z",
                "modifiedTime": "2024-03-28T19:05:55.605Z"
              },
              {
                "name": "Example label 5",
                "type": "AUTOMATIC",
                "createdTime": "2024-06-25T17:39:34.843Z",
                "modifiedTime": "2024-06-25T17:39:34.843Z"
              }
            ],
            "osPlatform": "Windows",
            "openPorts": [
              22,
              135,
              139,
              445,
              3389,
              5357
            ],
            "discoveryMethods": [
              "ARP",
              "CONNECTED",
              "PING",
              "NMAP",
              "NDP"
            ],
            "lastSeenTime": "2026-03-25T18:39:06.401Z",
            "computerId": null,
            "natIPAddresses": [
              "20.70.20.190"
            ],
            "osGeneration": "10",
            "profiles": [
              {
                "name": "Example profile 2"
              },
              {
                "name": "Example profile 4"
              },
              {
                "name": "Example profile 5"
              }
            ],
            "firstSeenTime": "2022-08-05T16:48:40.000Z",
            "firstManagedTime": null,
            "lastManagedTime": null,
            "lastDiscoveredTime": "2026-03-25T18:39:06.397Z",
            "isManaged": false,
            "isUnmanageable": false,
            "isIgnored": false,
            "satellites": []
          }
        }
      ]
    }
  }
}

Get label by name

query.discoverLabel

Get a Discover label by name

The discoverLabel query requires Discover 4.8.298 or later and the Discover Asset read permission.

The following query retrieves the Discover label with the name of Example_label.

JSON
query exampleGetSpecificLabel($name: String!) {
  discoverLabel(
    ref: {
      name: $name
    }
  ) {
    name
    type
    createdTime
    modifiedTime
    interfaceCounts {
      managed
      unmanaged
      total
      unmanageable
    }
  }
}

Include the name variable in the Variables panel or in your variables dictionary:

JSON
{
  "name": "Example_label"
}

Example response:

JSON
{
  "data": {
    "discoverLabel": {
      "name": "Example label 1",
      "type": "AUTOMATIC",
      "createdTime": "2024-07-23T18:51:58.230Z",
      "modifiedTime": "2024-07-23T18:51:58.230Z",
      "interfaceCounts": {
        "managed": 0,
        "unmanaged": 0,
        "total": 0,
        "unmanageable": 0
      }
    }
  }
}

Get multiple labels

query.discoverLabels

Get multiple Discover labels

The discoverLabels query requires Discover 4.8.298 or later and the Discover Asset read permission.

The following query retrieves the first 2 Discover labels.

JSON
query exampleGetLabels($first: Int) {
  discoverLabels(first: $first) {
    edges {
      node {
        name
        type
        createdTime
        interfaceCounts {
          managed
          unmanaged
          total
          unmanageable
        }
        modifiedTime
      }
    }
  }
}

Include the pagination variable in the Variables panel or in your variables dictionary:

JSON
{
  "first": 2
}

Example response:

JSON
{
  "data": {
    "discoverLabels": {
      "edges": [
        {
          "node": {
            "name": "Example label 1",
            "type": "AUTOMATIC",
            "createdTime": "2024-07-23T18:51:58.230Z",
            "interfaceCounts": {
              "managed": 0,
              "unmanaged": 0,
              "total": 0,
              "unmanageable": 0
            },
            "modifiedTime": "2024-07-23T18:51:58.230Z"
          }
        },
        {
          "node": {
            "name": "Example label 2",
            "type": "AUTOMATIC",
            "createdTime": "2020-05-20T14:48:30.268Z",
            "interfaceCounts": {
              "managed": 0,
              "unmanaged": 0,
              "total": 0,
              "unmanageable": 0
            },
            "modifiedTime": "2020-05-20T14:48:30.268Z"
          }
        }
      ]
    }
  }
}

Remove labels from interfaces

mutation.discoverInterfaceRemoveLabel

Remove Discover labels from Discover interfaces

The discoverInterfaceRemoveLabel mutation requires Discover 4.8.298 or later and the Discover Tag write permission.

The following mutation manually removes one or more standard labels from one or more specified interfaces.

JSON
mutation exampleRemoveInterfaceLabel($labelNames: [String!]!, $interfaceIDs: [ID!]!) {
  discoverInterfaceRemoveLabel(
    input: {
      names: $labelNames,
      interfaceIDs: $interfaceIDs
    }
  ) {
    success
    error {
      message
    }
    cursor
  }
}

Include the interface variables in the Variables panel or in your variables dictionary:

JSON
{
  "labelNames": [
    "example_label",
    "example_label_2"
  ],
  "interfaceIDs": [
    12345,
    67890
  ]
}

Example response:

JSON
{
  "data": {
    "discoverInterfaceRemoveLabel": {
      "success": true,
      "error": null,
      "cursor": null
    }
  }
}

If your mutation request returns a cursor, the label is not yet removed from the interfaces that you specify. You can pass the cursor as input to a subsequent discoverInterfaceRemoveLabel mutation to determine the status of the initial request.

JSON
mutation exampleRemoveInterfaceLabel($labelNames: [String!]!, $interfaceIDs: [ID!]!) {
  discoverInterfaceRemoveLabel (
    input: {
      labelNames: $labelNames,
      interfaceIDs: $interfaceIDs
      cursor: "Mg=="
    }
  ) {
    success
    error {
      message
    }
    cursor
  }
}