# Instance metadata

> Read runtime host and process metadata, Provision version information, and your own public instance fields.

Source: https://console.getchrovia.com/en/docs/sdk-instance-metadata

**Entitlement:** `instanceMetadata`. **API:** `chrovia.instanceMetadata`, an object rather than a function or Promise. Use a Provision Service Worker; page access also needs `unrestrictedApi`.

## Add public fields

Runtime host fields are collected by the browser. Application-owned metadata belongs under `internal.instance_metadata.public`:

```json
{
  "internal": {
    "instance_metadata": {
      "public": {
        "instance_id": "workspace-01",
        "label": "Workspace 01",
        "region": "test"
      }
    }
  }
}
```

Merge and sign the [EP](https://console.getchrovia.com/en/docs/sdk-extended-preferences) as required before launch. The application's `public.instance_id` is not the kernel lease `instanceId` and does not change lease identity.

```js
const metadata = globalThis.chrovia?.instanceMetadata;
if (metadata) {
  console.log({
    label: metadata.public?.label,
    pid: metadata.process?.id,
    packageVersion: metadata.provision?.manifest?.version,
  });
}
```

## Object shape

| Section | Fields |
| --- | --- |
| `host` | `machineId`, `serialNumber`, `hostname`, `userName` |
| `os` | `name`, `version`, `architecture` |
| `hardware` | `logicalProcessors`, `physicalMemory` (bytes) |
| `directories` | `userData`, `downloads`, `desktop`, `appData`, `localAppData`, `home`, `temp` |
| `process` | `id` (browser process ID) |
| `provision` | `manifest` from the Provision root |
| `public` | Your configured JSON object |

Unavailable or empty values/sections are omitted. Use optional access and do not assume every platform has a serial number or `localAppData`. Metadata can be `undefined` if not available even with the capability.

## Boundaries

This describes runtime host information, not a fingerprint identity generated from `fingerprint_override`. `directories.downloads` reports the platform default downloads path, not necessarily the Profile's effective configured save path. Set download behavior through [profile preferences](https://console.getchrovia.com/en/docs/sdk-extended-preferences), not by changing metadata.

Treat host IDs and filesystem paths as sensitive. `public` means exposed data, not a place for tokens or passwords. Restart to pick up configuration changes; mutating the returned JS object is not a persistent write API.
