---
id: "xid"
kind: "datatype"
status: "draft"
is_pii: false
categories: ["identifiers"]
langs: ["common"]
quality: 80
url: "http://registry.apicrafter.io/datatype/xid"
---

# xid globally unique ID (`xid`)

> **Draft.** Draft records have not been reviewed yet and may be incomplete or wrong; do not treat them as authoritative for legal or compliance decisions.

96-bit identifier of the Go library rs/xid. It uses the MongoDB ObjectId layout (a 4-byte time in seconds, a 3-byte machine ID, a 2-byte process ID and a 3-byte counter) and writes the 12 bytes as 20 characters of lowercase base32hex (digits and the letters a to v), which keeps the sort order. The last character holds a single bit, so it is 0 or g.

- Personal data (PII): no
- Categories: Universal unique identifiers (identifiers)
- Countries: global
- Languages: Common to most languages (common)
- Classification: identifier

## Detection

Regular expression (Python `re`):

```
^[0-9a-v]{19}[0g]$
```

## Examples

- `9m4e2mr0ui3e8a215n4g` — Example of the rs/xid README
- `a1vhuttsv1mdf6a3i08g` — The 12 bytes of the MongoDB ObjectId 507f1f77bcf86cd799439011 written as an xid
- `9M4E2MR0UI3E8A215N4G` (invalid example) — Uppercase
- `9m4e2mr0ui3e8a215n4w` (invalid example) — w is not a base32hex character

## Translations

- ru: Глобально уникальный идентификатор xid

## Sources

- doc: <https://github.com/rs/xid>

## Quality

Score 80/100. Missing: mapping (Wikidata, Schema.org, ...), detector coverage.

JSON: <http://registry.apicrafter.io/api/v1/datatypes/xid.json> · Edit: <https://github.com/apicrafter/metacrafter-registry/edit/main/data/datatypes/any/identifiers/xid.yaml>
