# Cuid Generator API

> Cuid Generator creates collision-resistant unique identifiers (CUIDs) on demand for distributed applications. Pass an optional count to receive an array of unique ID strings, with paid plans adding structural format and sortability details.

**Endpoint:** `GET https://api.apiverve.com/v1/cuidgenerator`  
**Category:** Data Generation  
**Cost:** 1 credit per call  
**Canonical page:** https://apiverve.com/marketplace/cuidgenerator

## Overview

Cuid Generator creates CUIDs, collision-resistant unique identifiers designed for distributed applications where several servers create IDs at the same time. Ask for one ID or a batch of up to 100 and get them back as an array of strings, each starting with the letter c and safe to use in URLs, file names and database keys.

A CUID starts with a timestamp for sorting, so IDs generated later generally sort after earlier ones, which keeps database indexes and logs in rough creation order. Teams use them as primary keys, client-side record IDs before a sync, and request or job identifiers, and as a shorter alternative to a UUID when they want a sortable id.

The Free plan returns the IDs and the count. Paid plans add a description of the CUID component layout and flags stating that the IDs are collision resistant and sortable, which helps when the response is logged or shown to someone checking which unique identifier format a system uses.

## Authentication

Every call carries your key in an `x-api-key` header. The same key works across the whole
APIVerve catalog — there are no per-API subscriptions. Responses always use the same three
top-level keys: `status`, `error`, and `data`.

## Example request

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

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `count` | integer | No | Number of Cuids to generate. default 1. range 1-100 |

## Response fields

- `cuids` — array · Array of generated collision-resistant unique identifier strings
- `count` — number · Total count of CUIDs generated in this request
- `format` — string · Description of CUID component composition and structure format · (premium)
- `collision_resistant` — boolean · Indicates whether generated CUIDs provide collision resistance guarantee · (premium)
- `sortable` — boolean · Indicates whether CUIDs are naturally sortable by timestamp component · (premium)

## Sample response

```json
{
  "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
  }
}
```

## 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

## SDKs

- **npm** — `npm install @apiverve/cuidgenerator` (https://www.npmjs.com/package/@apiverve/cuidgenerator)
- **NuGet** — `dotnet add package APIVerve.API.CuidGenerator` (https://www.nuget.org/packages/APIVerve.API.CuidGenerator)
- **Source** — https://github.com/apiverve/cuidgenerator-api

## More

- Full reference: https://docs.apiverve.com/ref/cuidgenerator
- Get an API key: https://dashboard.apiverve.com
- Full catalog: https://apiverve.com/marketplace
