Skip to content
Start here

List devices

client.ZeroTrust.Devices.Devices.List(ctx, params) (*CursorPagination[DeviceDeviceListResponse], error)
GET/accounts/{account_id}/devices/physical-devices

Lists WARP devices.

Security

API Token

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

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
ParametersExpand Collapse
params DeviceDeviceListParams
AccountID param.Field[string]

Path param

ID param.Field[[]string]Optional

Query param: Filter by a one or more device IDs.

ActiveRegistrations param.Field[DeviceDeviceListParamsActiveRegistrations]Optional

Query param: Include or exclude devices with active registrations. The default is “only” - return only devices with active registrations.

const DeviceDeviceListParamsActiveRegistrationsInclude DeviceDeviceListParamsActiveRegistrations = "include"
const DeviceDeviceListParamsActiveRegistrationsOnly DeviceDeviceListParamsActiveRegistrations = "only"
const DeviceDeviceListParamsActiveRegistrationsExclude DeviceDeviceListParamsActiveRegistrations = "exclude"
Cursor param.Field[string]Optional

Query param: Opaque token indicating the starting position when requesting the next set of records. A cursor value can be obtained from the result_info.cursor field in the response.

Include param.Field[string]Optional

Query param: Comma-separated list of additional information that should be included in the device response. Supported values are: “last_seen_registration.policy”.

LastSeenUser param.Field[DeviceDeviceListParamsLastSeenUser]Optional

Query param

Email stringOptional

Filter by the last seen user’s email.

PerPage param.Field[int64]Optional

Query param: The maximum number of devices to return in a single response.

formatuint64
SeenAfter param.Field[string]Optional

Query param: Filter by the last_seen timestamp - returns only devices last seen after this timestamp.

SeenBefore param.Field[string]Optional

Query param: Filter by the last_seen timestamp - returns only devices last seen before this timestamp.

SortBy param.Field[DeviceDeviceListParamsSortBy]Optional

Query param: The device field to order results by.

const DeviceDeviceListParamsSortByName DeviceDeviceListParamsSortBy = "name"
const DeviceDeviceListParamsSortByID DeviceDeviceListParamsSortBy = "id"
const DeviceDeviceListParamsSortByClientVersion DeviceDeviceListParamsSortBy = "client_version"
const DeviceDeviceListParamsSortByLastSeenUserEmail DeviceDeviceListParamsSortBy = "last_seen_user.email"
const DeviceDeviceListParamsSortByLastSeenAt DeviceDeviceListParamsSortBy = "last_seen_at"
const DeviceDeviceListParamsSortByActiveRegistrations DeviceDeviceListParamsSortBy = "active_registrations"
const DeviceDeviceListParamsSortByCreatedAt DeviceDeviceListParamsSortBy = "created_at"
SortOrder param.Field[DeviceDeviceListParamsSortOrder]Optional

Query param: Sort direction.

const DeviceDeviceListParamsSortOrderAsc DeviceDeviceListParamsSortOrder = "asc"
const DeviceDeviceListParamsSortOrderDesc DeviceDeviceListParamsSortOrder = "desc"
ReturnsExpand Collapse
type DeviceDeviceListResponse struct{…}

A WARP Device.

ID string

The unique ID of the device.

ActiveRegistrations int64

The number of active registrations for the device. Active registrations are those which haven’t been revoked or deleted.

CreatedAt string

The RFC3339 timestamp when the device was created.

LastSeenAt string

The RFC3339 timestamp when the device was last seen.

Name string

The name of the device.

UpdatedAt string

The RFC3339 timestamp when the device was last updated.

ClientVersion stringOptional

Version of the WARP client.

DeletedAt stringOptional

The RFC3339 timestamp when the device was deleted.

DeviceType stringOptional

The device operating system.

HardwareID stringOptional

A string that uniquely identifies the hardware or virtual machine (VM).

LastSeenRegistration DeviceDeviceListResponseLastSeenRegistrationOptional

The last seen registration for the device.

Policy DeviceDeviceListResponseLastSeenRegistrationPolicyOptional

A summary of the device profile evaluated for the registration.

ID string

The ID of the device settings profile.

Default bool

Whether the device settings profile is the default profile for the account.

Deleted bool

Whether the device settings profile was deleted.

Name string

The name of the device settings profile.

UpdatedAt string

The RFC3339 timestamp of when the device settings profile last changed for the registration.

LastSeenUser DeviceDeviceListResponseLastSeenUserOptional

The last user to use the WARP device.

ID stringOptional

UUID.

maxLength36
Email stringOptional

The contact email address of the user.

maxLength90
Name stringOptional

The enrolled device user’s name.

MacAddress stringOptional

The device MAC address.

Manufacturer stringOptional

The device manufacturer.

Model stringOptional

The model name of the device.

OSVersion stringOptional

The device operating system version number.

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.

SerialNumber stringOptional

The device serial number.

List devices

package main

import (
  "context"
  "fmt"

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

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  page, err := client.ZeroTrust.Devices.Devices.List(context.TODO(), zero_trust.DeviceDeviceListParams{
    AccountID: cloudflare.F("account_id"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}
{
  "errors": [
    {
      "code": 0,
      "message": "message"
    }
  ],
  "messages": [
    {
      "code": 0,
      "message": "message"
    }
  ],
  "result": [
    {
      "id": "fc9ab6ab-3b94-4319-9941-459462b3d73e",
      "active_registrations": 1,
      "created_at": "2025-02-14T13:17:00Z",
      "last_seen_at": "2025-02-14T13:17:00Z",
      "name": "My Device",
      "updated_at": "2025-02-14T13:17:00Z",
      "client_version": "1.0.0",
      "deleted_at": "2025-02-14T13:17:00Z",
      "device_type": "linux",
      "hardware_id": "hardware_id",
      "last_seen_registration": {
        "policy": {
          "id": "11ffb86f-3f0c-4306-b4a2-e62f872b166a",
          "default": true,
          "deleted": true,
          "name": "name",
          "updated_at": "2025-02-14T13:17:00Z"
        }
      },
      "last_seen_user": {
        "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
        "email": "user@example.com",
        "name": "John Appleseed"
      },
      "mac_address": "f5:01:73:cf:12:23",
      "manufacturer": "ACME",
      "model": "Mark VII",
      "os_version": "os_version",
      "os_version_extra": "os_version_extra",
      "public_ip": "1.1.1.1",
      "serial_number": "ABS765ASD8A"
    }
  ],
  "success": true,
  "result_info": {
    "count": 1,
    "cursor": "ais86dftf.asdf7ba8",
    "per_page": 10,
    "total_count": null
  }
}
Returns Examples
{
  "errors": [
    {
      "code": 0,
      "message": "message"
    }
  ],
  "messages": [
    {
      "code": 0,
      "message": "message"
    }
  ],
  "result": [
    {
      "id": "fc9ab6ab-3b94-4319-9941-459462b3d73e",
      "active_registrations": 1,
      "created_at": "2025-02-14T13:17:00Z",
      "last_seen_at": "2025-02-14T13:17:00Z",
      "name": "My Device",
      "updated_at": "2025-02-14T13:17:00Z",
      "client_version": "1.0.0",
      "deleted_at": "2025-02-14T13:17:00Z",
      "device_type": "linux",
      "hardware_id": "hardware_id",
      "last_seen_registration": {
        "policy": {
          "id": "11ffb86f-3f0c-4306-b4a2-e62f872b166a",
          "default": true,
          "deleted": true,
          "name": "name",
          "updated_at": "2025-02-14T13:17:00Z"
        }
      },
      "last_seen_user": {
        "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
        "email": "user@example.com",
        "name": "John Appleseed"
      },
      "mac_address": "f5:01:73:cf:12:23",
      "manufacturer": "ACME",
      "model": "Mark VII",
      "os_version": "os_version",
      "os_version_extra": "os_version_extra",
      "public_ip": "1.1.1.1",
      "serial_number": "ABS765ASD8A"
    }
  ],
  "success": true,
  "result_info": {
    "count": 1,
    "cursor": "ais86dftf.asdf7ba8",
    "per_page": 10,
    "total_count": null
  }
}