API Docs

Snowflakes

Snowflakes are the globally unique identifiers used throughout the Osmium protocol. They are represented as unsigned 64-bit integers and are safe to store as strings in clients that cannot represent every 64-bit value exactly.

Generic types

Fields annotate the entity a Snowflake identifies. Snowflake<Community> and Snowflake<User> have the same wire representation; the generic parameter documents the expected entity.

TypeMeaning
Snowflake<User>A user identifier
Snowflake<Community>A community identifier
Snowflake<Message>A message identifier

Format

On the wire, a Snowflake is a fixed64 or uint64 value. Keep it as an integer in languages with native 64-bit integer support, or serialize it as a decimal string at API boundaries.

Osmium Epoch

Osmium Snowflakes use 1735689600000 (2025-01-01 00:00:00 UTC) as their timestamp epoch. Add this value, in milliseconds, to the Snowflake timestamp component to get a Unix timestamp.

Convert Snowflake to DateTime

Ready to convert
00000000000000000000000000000000000000000042 bits timestamp
000005 bits worker ID
000005 bits process ID
00000000000012 bits increment

The timestamp is milliseconds since the Osmium epoch. The remaining bits make each ID unique.