Generators nanoid
Generatedgenerators_nanoidValid by construction but non-reproducible — a fresh call returns new values.
Generate nanoids — compact, URL-safe random IDs. Default 21 chars over a 64-symbol URL-safe alphabet; both configurable. Use count for many. Non-reproducible unless seeded (tests only).
Parameters
lengthintegeroptionalID length in characters.
alphabetstringoptionalSymbol set to draw from (>=2 chars).
countintegeroptionalHow many to generate.
seedintegeroptionalReproducible (insecure) output for testing.
Call it
curl -X POST https://api.snipget.ai/v1/generators/nanoid \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{"length":21,"count":1}'FAQ
Why use this instead of asking the AI to make up an ID?
A language model will happily invent an ID, but it can repeat one, drift from the format you asked for, or use characters that break in a URL. This builds each ID from a proper random source so it is the right length, URL-safe, and effectively never collides.
What is a nanoid good for?
Short, URL-safe IDs for things like records, share links, invite codes, or filenames. At the default 21 characters it is compact but still has plenty of randomness to stay unique.
Can I get the same ID back if I call it again?
No. Each call returns brand new values by design, so you cannot reproduce a previous one. Generate it once and save it where you need it. There is a seed option, but it is for tests only and is not safe for anything that needs to stay secret.
Can I change the length or the characters it uses?
Yes. Set length for longer or shorter IDs, and pass a custom alphabet (at least two characters) if you want to limit it to, say, only lowercase letters and digits. Leave them off to get the standard 21-character URL-safe ID.
What happens if I send something invalid?
Bad generator parameters (for example, an alphabet with fewer than two characters) are request mistakes: the call is rejected with an INVALID_INPUT error naming the problem, and rejected calls are not billed.