Skip to content
Start here

List devices (deprecated)

Deprecated
client.ZeroTrust.Devices.List(ctx, query) (*SinglePage[Device], error)
GET/accounts/{account_id}/devices

List WARP devices. Not supported when multi-user mode is enabled for the account.

Deprecated: please use one of the following endpoints instead:

  • GET /accounts/{account_id}/devices/physical-devices
  • GET /accounts/{account_id}/devices/registrations
Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
ParametersExpand Collapse
query DeviceListParams
AccountID param.Field[string]
ReturnsExpand Collapse
type Device struct{…}
ID stringoptional

Registration ID. Equal to Device ID except for accounts which enabled multi-user mode.

maxLength36
Created Timeoptional

When the device was created.

formatdate-time
Deleted booloptional

True if the device was deleted.

DeviceType DeviceDeviceTypeoptional
One of the following:
const DeviceDeviceTypeWindows DeviceDeviceType = "windows"
const DeviceDeviceTypeMac DeviceDeviceType = "mac"
const DeviceDeviceTypeLinux DeviceDeviceType = "linux"
const DeviceDeviceTypeAndroid DeviceDeviceType = "android"
const DeviceDeviceTypeIos DeviceDeviceType = "ios"
const DeviceDeviceTypeChromeos DeviceDeviceType = "chromeos"
IP stringoptional

IPv4 or IPv6 address.

Key stringoptional

The device's public key.

LastSeen Timeoptional

When the device last connected to Cloudflare services.

formatdate-time
MacAddress stringoptional

The device mac address.

Manufacturer stringoptional

The device manufacturer name.

Model stringoptional

The device model name.

Name stringoptional

The device name.

OSDistroName stringoptional

The Linux distro name.

OSDistroRevision stringoptional

The Linux distro revision.

OSVersion stringoptional

The operating system version.

OSVersionExtra stringoptional

Additional operating system version details. For Windows, the UBR (Update Build Revision). For Mac or iOS, the Product Version Extra. For Linux, the distribution name and version.

RevokedAt Timeoptional

When the device was revoked.

formatdate-time
SerialNumber stringoptional

The device serial number.

Updated Timeoptional

When the device was updated.

formatdate-time
User DeviceUseroptional
ID stringoptional

UUID.

maxLength36
Email stringoptional

The contact email address of the user.

maxLength90
Name stringoptional

The enrolled device user's name.

Version stringoptional

The WARP client version.

List devices (deprecated)

package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/option"
  "github.com/cloudflare/cloudflare-go/zero_trust"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  page, err := client.ZeroTrust.Devices.List(context.TODO(), zero_trust.DeviceListParams{
    AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": [
    {
      "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
      "created": "2017-06-14T00:00:00Z",
      "deleted": true,
      "device_type": "windows",
      "ip": "1.1.1.1",
      "key": "yek0SUYoOQ10vMGsIYAevozXUQpQtNFJFfFGqER/BGc=",
      "last_seen": "2017-06-14T00:00:00Z",
      "mac_address": "00-00-5E-00-53-00",
      "manufacturer": "My phone corp",
      "model": "MyPhone(pro-X)",
      "name": "My mobile device",
      "os_distro_name": "ubuntu",
      "os_distro_revision": "1.0.0",
      "os_version": "10.0.0",
      "os_version_extra": "(a) or 6889 or Ubuntu 24.04",
      "revoked_at": "2017-06-14T00:00:00Z",
      "serial_number": "EXAMPLEHMD6R",
      "updated": "2017-06-14T00:00:00Z",
      "user": {
        "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
        "email": "user@example.com",
        "name": "John Appleseed"
      },
      "version": "1.0.0"
    }
  ],
  "success": true,
  "result_info": {
    "count": 1,
    "page": 1,
    "per_page": 20,
    "total_count": 2000
  }
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": [
    {
      "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
      "created": "2017-06-14T00:00:00Z",
      "deleted": true,
      "device_type": "windows",
      "ip": "1.1.1.1",
      "key": "yek0SUYoOQ10vMGsIYAevozXUQpQtNFJFfFGqER/BGc=",
      "last_seen": "2017-06-14T00:00:00Z",
      "mac_address": "00-00-5E-00-53-00",
      "manufacturer": "My phone corp",
      "model": "MyPhone(pro-X)",
      "name": "My mobile device",
      "os_distro_name": "ubuntu",
      "os_distro_revision": "1.0.0",
      "os_version": "10.0.0",
      "os_version_extra": "(a) or 6889 or Ubuntu 24.04",
      "revoked_at": "2017-06-14T00:00:00Z",
      "serial_number": "EXAMPLEHMD6R",
      "updated": "2017-06-14T00:00:00Z",
      "user": {
        "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
        "email": "user@example.com",
        "name": "John Appleseed"
      },
      "version": "1.0.0"
    }
  ],
  "success": true,
  "result_info": {
    "count": 1,
    "page": 1,
    "per_page": 20,
    "total_count": 2000
  }
}