IDv1 documentation

Which shape for what you build

Pick the shape by what the thing is, not by what an app calls it, so the same kind of thing has the same shape everywhere and a code is easy to place on sight.

What it isShapeCalled in appsExample
A personaccountuser, member, ownerJo4712
Something that holds thingslistlist, category, board, collection, folder, project12ABCD
One thing keptitemitem, clip, listing, noteAb12Cd
A thing in the world with a code printed on itproductproduct, tag, stickerAbCd12
Something that happens, many times a dayeventevent, visit, session, tracek3Rw9Q

The first four are the standard version. An event is the expanded version, under Advanced.

The shapes

  • Account, LLnnnn: two letters from the person’s name, a capital and a small one (Leo is Le0125), then four digits drawn until the code is free. A name without two Latin letters takes them from the email address, and failing that at random.
  • Product, LLLLnn: four letters and two digits. It is printed and scanned, never typed. Whoever signs up with a product’s code may keep it as their account’s code, so it is an account’s shape too.
  • List, nnLLLL: two digits and four letters. New lists draw capitals; older lists may hold small letters, and every check reads both.
  • Item, LLnnXX: two letters, two digits, then two letters or digits that are not both digits, or it would be an account.

No code can have two shapes, so codeKind always gives one answer.

How many

KindCountExactly
Accounts52² × 10⁴27,040,000
Products52⁴ × 10², before the blocked words731,161,600
Lists, drawn with capitals10² × 26⁴45,697,600
Items52² × 10² × (62² − 10²)1,012,377,600
Events, expanded version62⁶ less the four shapes as read54,298,494,784
Every six-character code62⁶56,800,235,584

ID_SPACE holds the standard counts, and idUsage(kind, used) says how much of a kind is used and how much is left:

import { ID_SPACE, idUsage } from '@0001-labs/idv1'

ID_SPACE.lists              // 45_697_600
idUsage('accounts', 1352)   // { used: 1352, space: 27040000, left: 27038648, percent: 0.005 }

Codes that are never drawn

  • Blocked words. A product’s letters, and an event’s, are drawn again when they spell a rude or awkward word in any language the apps speak, capitals aside (BLOCKED_CODE_WORDS), and a product’s digits when they are awkward (BLOCKED_CODE_DIGITS).
  • Kept codes. A few account codes are kept for one person or role in every app and never drawn for anyone else (RESERVED_ACCOUNT_CODES); reservedAccountCode(email) gives the kept code before an app draws one.
  • A code does not change by itself. An app may give an account a chosen code, as when it should match the code its owner has elsewhere.