---
url: /en-us/standard/blocks/header.md
---
* Type ID: `0`
* Type: Array

**Header is the first block of the file.** It records the file's identity, the specification version, and a statistics snapshot from the most recent full save. Readers rely on it to confirm that this is a UInk file.

::: tip Levels
Core. All readers and writers must support it.
:::

## Structure

Header is a fixed-length array `array(7)`:

| Index | Field | Type | MessagePack encoding | Payload length |
| --- | --- | --- | --- | --- |
| 0 | `type` | uint16 | uint16 | 2 bytes |
| 1 | `version` | uint16 | uint16 | 2 bytes |
| 2 | `guid` | string(36) | str8 | 36 bytes |
| 3 | `deviceNum` | uint32 | uint32 | 4 bytes |
| 4 | `workspaceNum` | uint32 | uint32 | 4 bytes |
| 5 | `pageNum` | uint32 | uint32 | 4 bytes |
| 6 | `time` | uint64 | uint64 | 8 bytes |

## Fields

| Field | Description |
| --- | --- |
| `type` | Always `0` |
| `version` | Specification version number; `11` for 1.1. See [Versions and Changes](../version) |
| `guid` | UUID generated when the file is first created, in the format `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` |
| `deviceNum` | Number of Devices at the most recent full save; `1` when the implicit singleton is used |
| `workspaceNum` | Number of Workspaces at the most recent full save; `1` when the implicit singleton is used |
| `pageNum` | Sum of the page counts of all Workspaces at the most recent full save; a page spanning several Devices or layers counts once, and blank pages count too |
| `time` | Unix UTC timestamp, in seconds, of when the most recent full save completed |

## Rules

* **HDR-1** Writers must write `array(7)` exactly as in the table above: the field order, numeric widths and the str8 encoding of `guid` must not change, and the MessagePack smallest integer encoding must not be used in place of the fixed widths.
* **HDR-2** Readers must verify the array length, `type = 0`, the `version` range (VER-3) and the 36-character UUID format. Numeric fields may accept other encodings that convert losslessly, per TYPE-5.
* **HDR-3** `guid` identifies one logical file. Incremental writes, full saves, moving and renaming must not change it; "Save As" to a new logical file must generate a new UUID (VER-7).
* **HDR-4** The statistics fields are a snapshot. Incremental writes must not modify the Header (SAVE-20); a full save recalculates all statistics fields.
* **HDR-5** Readers recompute state from the objects actually read. They must not reject a file because the snapshot disagrees with the actual content, and must not preallocate memory based on the counts in the snapshot.

## Example

```json
[0, 11, "5fe30f46-be92-49b6-b921-a60706febf10", 2, 1, 12, 1700000000]
```

## Fallback

When the Header is invalid (any HDR-2 check fails), readers must refuse to parse the file as UInk. There is no fallback.

## Related

* [Versions and Changes](../version)
* [Block Types and Encoding](../type)
* [Saving, Appending and Recovery](../incremental)
