Docs/APIs/Cuid Generator

Cuid Generator

Generate collision-resistant unique identifiers

OperationalCredits 1 per callp50 176msData GenerationStar

Overview

Each ID follows the original CUID layout, built from five parts concatenated in order: the letter `c`; the current time in milliseconds written in base 36; a four-character base-36 counter; a four-character fingerprint; and two four-character random blocks.

The counter increments for every ID the serving instance creates and wraps back to zero after 36^4 values, so IDs made in the same millisecond on the same instance still differ. The fingerprint is derived from the server process ID and the length of its hostname, which separates IDs made by different instances at the same moment. The random blocks come from the JavaScript runtime's standard random number generator, which is not a cryptographic source: treat CUIDs as unique identifiers, not as secrets or unguessable tokens. Use a password or token generator for those.

Because the timestamp comes first and is the same length for any current date, IDs sort roughly by creation time. Ordering within the same millisecond is reliable only for IDs from the same instance, since separate instances keep separate counters.

`count` sets how many IDs are returned, from 1 to 100, defaulting to 1, and `cuids` holds them in generation order. `format`, `collision_resistant` and `sortable` are fixed descriptive values that are the same on every response; they are null on the Free plan.

Live Test Cuid Generator API →

Endpoint

One host, one path per API. The block below shows this call in four languages; every one of them is the same HTTP request. Making requests covers the timeouts, retries and parameter rules that apply to all of them. The SDKs wrap the same call in a typed client.

GEThttps://api.apiverve.com/v1/cuidgenerator
curl "https://api.apiverve.com/v1/cuidgenerator?count=10" \
  -H "x-api-key: your_api_key_here"

Replace your_api_key_here with the key from your dashboard. When the inputs arrive as a list rather than one at a time, batch requests run up to 200 of them through this same API in a single call.

Authentication

Send your key in the x-api-key header. That is the only auth step — there is no token exchange and no per-endpoint scope to configure. Authentication covers creating, rotating and revoking keys.

401 is the only auth verdict

A 401 means the key is missing, invalid or expired. A 403 means the key is valid but not permitted here — blocked by a key restriction or an IP allow-list. Running out of credits is a 429.

Parameters

Sent in the query string. Premium parameters are accepted on every plan but only take effect on plans that include them.

ParameterTypeDescription
countOptionalintegerNumber of Cuids to generate
default 1 · range 1–100

Response

Every API returns the same three top-level keys, so one response handler covers your whole integration: status, error and data. Only data changes shape. Response format covers the envelope, the other output formats and how premium fields are withheld.

Sample response
{
  "status": "ok",
  "error": null,
  "data": {
    "cuids": [
      "cmj95ed27000000145v116use",
      "cmj95ed2700010014uuounuyc",
      "cmj95ed27000200147pwbz35y",
      "cmj95ed27000300142h9ivqrz",
      "cmj95ed27000400149ingh73n",
      "cmj95ed2700050014mg9alsah",
      "cmj95ed27000600149utx0fy3",
      "cmj95ed270007001467kspfhp",
      "cmj95ed2700080014n7ykgwxf",
      "cmj95ed2700090014rrnfehcn"
    ],
    "count": 10,
    "format": "c + timestamp + counter + fingerprint + random",
    "collision_resistant": true,
    "sortable": true
  }
}

Response fields

Paths are relative to data. Premium fields are absent rather than zeroed on plans that do not include them, so check for presence instead of comparing to 0.

FieldTypeExampleDescription
cuidsarray[cmj95ed27000000145v116use, ...]Array of generated collision-resistant unique identifier strings
countnumber10Total count of CUIDs generated in this request
formatPremiumstring"c + timestamp + counter + fingerprint + random"Description of CUID component composition and structure format
collision_resistantPremiumbooleantrueIndicates whether generated CUIDs provide collision resistance guarantee
sortablePremiumbooleantrueIndicates whether CUIDs are naturally sortable by timestamp component

Errors

Read the HTTP status first, then error for the specific reason. The body names the parameter that has to change. Error handling covers the full status list and which of them are worth retrying.

StatusMeaningWhat to do
400Input was rejectedRead error; it names the parameter.
401Key missing or invalidCheck the header name and the key value.
403Key valid, but not permittedA key restriction or IP allow-list; see key scoping.
429Rate limited, or out of creditsRead error to tell them apart; see rate limits.

Use cases

Distributed Databases
Generate safe unique keys across distributed database systems and shards
Horizontal Scaling
Create identifiers that work reliably across horizontally scaled applications
Event Sourcing
Generate sortable event identifiers for event sourcing and CQRS patterns
Multi-tenant Systems
Create unique identifiers across multiple tenants and isolated environments

Other ways to use Cuid Generator

Set up Cuid Generator on APIVerve, or reach the same source a different way. Your APIVerve account and credits work on all of them — one key, one balance.

Give it to an AI agentConnect over MCP and your agent calls it as a native tool — Claude, Cursor, ChatGPT.VerveKit →Reference →
Google Sheets or ExcelA =VERVE() formula fills a column — no script, no export, recalculates in place.VerveSheets →Reference →

More in Data Generation:

Was this page helpful?