atproto—crates

Tl.

Timestamp identifiers · 0.15.0 · MIT

atptid

atptid generates and parses TIDs, the timestamp identifiers AT Protocol uses as record keys. A TID is thirteen base32-sortable characters holding a microsecond timestamp and a random clock identifier. atptid makes one or a batch, reads one back to its timestamp, validates one, or makes one from a timestamp.

§ 01

Install

atptid is a binary in the atproto-record crate, behind its clap feature. Homebrew has prebuilt binaries for macOS and Linux.

Homebrew or crates.ioListing 1
brew tap ngerakines/tap
brew install atptid

# or
cargo install atproto-record --version 0.15.0 --features clap --bin atptid

Leave out --features clap and Cargo warns that atptid requires it, then exits 0 without installing anything. atptid --version prints atptid 0.15.0.

§ 02

Modes

atptid doesn’t have subcommands. What it does depends on its one optional argument and three flags.

The five modes
ModeCommandPrints
GenerateatptidOne new TID.
Batchatptid -n 5That many new TIDs, one per line.
Parseatptid <tid>The TID’s timestamp in microseconds since the Unix epoch.
Validateatptid -q <tid>Nothing. It exits 0 for a valid TID and 1 otherwise.
From timeatptid -t <timestamp>A new TID for that microsecond timestamp, with a random clock identifier.
Arguments and options at 0.15.0
ArgumentDoes
[INPUT]A TID to parse, or a microsecond timestamp to make a TID from.
-n, --count <COUNT>How many TIDs to generate. It applies only without an input.
-q, --quietValidate the input as a TID without printing anything, and exit 1 if it isn’t one. It never reads the input as a timestamp, needs an input, and can’t be combined with -t.
-t, --timestampRead the input as a microsecond timestamp, never as a TID.
-h, --helpPrint help. --help adds the modes and the rule below.
-V, --versionPrint the version.

§ 03

A TID or a timestamp

Without a flag, atptid decides what the input is. An input that decodes as a TID is parsed as one. Anything else made only of digits is read as a microsecond timestamp.

The two overlap. The TID alphabet includes the digits 2 to 7, so a thirteen-digit string like 2345672345672 is a valid TID, and atptid parses it. -t settles it the other way. -q only ever validates a TID, so an all-digit input that isn’t one fails it.

A TID holds 53 bits of timestamp. A timestamp above 9007199254740991 is refused rather than wrapped.

§ 04

Worked examples

Every output below is what atptid 0.15.0 printed on 2026-12-01. Generated TIDs differ on every run.

Generate and parseListing 2
$ atptid
3n3mehgf2onf7

$ atptid -n 3
3n3mehgfdakmw
3n3mehgfdd2k4
3n3mehgfdddd6

# Back to microseconds since the epoch.
$ atptid 3mgn37sytoc2c
1773066846693000

$ atptid -q 3mgn37sytoc2c; echo $?
0
From a timestampListing 3
# 2026-03-09 14:46:12 UTC, in microseconds.
$ atptid 1773067572000000
3mgn3vgphc2tj

$ atptid -t 1773067572000000
3mgn3vgphc2rk

# Thirteen digits that decode as a TID are parsed as one,
# unless -t says otherwise.
$ atptid 2345672345672
37490937333860

$ atptid -t 2345672345672
2246cmjj44c2t
What it refusesListing 4
$ atptid nottid
error-atproto-record-tid-1 Invalid TID length: expected 13, got 6

$ atptid -q 1773067572000000; echo $?
1

$ atptid -t 9999999999999999999
Timestamp out of range: 9999999999999999999 exceeds 9007199254740991 microseconds, the largest a TID can hold

$ atptid -q -t 1
error: the argument '--quiet' cannot be used with '--timestamp'

The two TIDs from 1773067572000000 differ only at the end. The last characters carry the random clock identifier, which is new on every run.