Generate an ID

The single POST endpoint, the request body shape, request encodings, and the response and error formats shared by every ID type.

Generate an ID

Everything the ID Generator does runs through one endpoint. The type field selects the flavour; the per-type options that go alongside it are documented on ID types.

POSThttps://id.hep.gg/Auth required
Generate one ID. The type field selects the generator.

Request

The endpoint accepts a JSON body (Content-Type: application/json) or a form-urlencoded body (Content-Type: application/x-www-form-urlencoded). Bodies up to 32 MB are accepted, though a real request is tiny. Credentials must be in the body; query parameters are not read.

Body fields
username
stringrequired
Your key's username, issued from the dashboard. Lowercased server-side.
token
stringrequired
The secret token for that key. Matched exactly.
type
stringrequired
The generator to run. One of uuid, nanoid, 2fa, license, words (alias word), snowflake, keypair, cuid.

Each type takes its own additional fields, for example length for nanoid or style for words. See ID types for the full list per type.

Response

A successful call returns 200 with JSON.

Most types
{ "id": "V1StGXR8_Z5jdHi6B-myT" }

The keypair type is the only one that returns a second field, privateID. See keypair.

keypair
{
  "id": "<public key, hex>",
  "privateID": "<secret key, hex>"
}

Errors

Errors are returned as JSON in the shape { "error": "..." }.

Status codes
401
erroroptional
Missing or invalid credentials. See Authentication.
400
erroroptional
A required option is missing, an option is out of range, or the type is not supported. The error message names the problem, for example Please specify the length or ID Type foo not supported.

An unknown type returns 400 with { "error": "ID Type <type> not supported." }.

Example

curl
curl -X POST https://id.hep.gg/ \
  -H "Content-Type: application/json" \
  -d '{
    "username": "my-bot",
    "token": "<your-token>",
    "type": "nanoid",
    "length": 12
  }'