This API is only for [extensions installed by a policy](https://support.google.com/chrome/a/answer/1375694).

<br />

> [!NOTE]
> **Important:** This API works **only on ChromeOS**.

<br />

<br />

## Description

Use the `chrome.enterprise.deviceAttributes` API to read device attributes. Note: This API is only available to extensions force-installed by enterprise policy.

<br />

<br />

## Permissions

`enterprise.deviceAttributes`  

<br />

<br />

## Availability

Chrome 46+ browser.\* since Chrome 148 ChromeOS only [Requires policy](https://support.google.com/chrome/a/answer/9296680)

<br />

<br />

<br />

## Methods

### getDeviceAnnotatedLocation()

Chrome 66+ browser.\* since Chrome 148

```typescript
browser.enterprise.deviceAttributes.getDeviceAnnotatedLocation(): Promise<string>
```

Fetches the administrator-annotated Location. If the current user is not affiliated or no Annotated Location has been set by the administrator, returns an empty string.

#### Returns

- Promise\<string\>
  Chrome 96+ browser.\* since Chrome 148

  Returns a Promise which resolves with the Annotated Location of the device.

### getDeviceAssetId()

Chrome 66+ browser.\* since Chrome 148

```typescript
browser.enterprise.deviceAttributes.getDeviceAssetId(): Promise<string>
```

Fetches the administrator-annotated Asset Id. If the current user is not affiliated or no Asset Id has been set by the administrator, returns an empty string.

#### Returns

- Promise\<string\>
  Chrome 96+ browser.\* since Chrome 148

  Returns a Promise which resolves with the Asset ID of the device.

### getDeviceHostname()

Chrome 82+ browser.\* since Chrome 148

```typescript
browser.enterprise.deviceAttributes.getDeviceHostname(): Promise<string>
```

Fetches the device's hostname as set by DeviceHostnameTemplate policy. If the current user is not affiliated or no hostname has been set by the enterprise policy, returns an empty string.

#### Returns

- Promise\<string\>
  Chrome 96+ browser.\* since Chrome 148

  Returns a Promise which resolves with the hostname of the device.

### getDeviceSerialNumber()

Chrome 66+ browser.\* since Chrome 148

```typescript
browser.enterprise.deviceAttributes.getDeviceSerialNumber(): Promise<string>
```

Fetches the device's serial number. Please note the purpose of this API is to administrate the device (e.g. generating Certificate Sign Requests for device-wide certificates). This API may not be used for tracking devices without the consent of the device's administrator. If the current user is not affiliated, returns an empty string.

#### Returns

- Promise\<string\>
  Chrome 96+ browser.\* since Chrome 148

  Returns a Promise which resolves with the serial number of the device.

### getDirectoryDeviceId()

```typescript
browser.enterprise.deviceAttributes.getDirectoryDeviceId(): Promise<string>
```

Fetches the value of [the device identifier of the directory API](https://developers.google.com/admin-sdk/directory/v1/guides/manage-chrome-devices), that is generated by the server and identifies the cloud record of the device for querying in the cloud directory API. If the current user is not affiliated, returns an empty string.

#### Returns

- Promise\<string\>
  Chrome 96+ browser.\* since Chrome 148

  Returns a Promise which resolves with the device identifier of the directory API.

<br />