# UUID Generator - v4, v7, ULID, NanoID & Short IDs in Bulk (`eliai/uuid-generator`) Actor

Generate up to 10,000 ids per batch: UUID v4, time-sortable UUID v7, ULID, NanoID, 8-char short codes — CSPRNG-backed, several kinds per run. $0.0004 per batch whatever its size vs $0.01/start measured incumbent. Unknown types never charged, never silently substituted. Release-tested formats.

- **URL**: https://apify.com/eliai/uuid-generator.md
- **Developed by:** [Broke to Built](https://apify.com/eliai) (community)
- **Categories:** Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.32 / 1,000 generated id batches

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## UUID Generator - Bulk UUID v4, UUID v7, ULID, NanoID and Short IDs

**Generate up to 10,000 unique ids per batch, in the five formats modern systems actually use** -
UUID v4 (random), UUID v7 (time-sortable, the current default for database keys), ULID (Crockford
base32, lexicographically sortable), NanoID (21-character URL-safe), and short (8-character base62).
Ask for several kinds in one run; each comes back as its own batch. $0.0004 per batch, whatever its
size.

Every id is generated with Node's cryptographic random source (`crypto.randomUUID` and
`crypto.randomBytes`). No `Math.random` ids, ever.

### What you get

Per requested id type, one batch record with these exact fields:

- `ok` - true when the batch generated
- `type` - `v4`, `v7`, `ulid`, `nanoid` or `short`
- `count` - how many ids are in this batch
- `sortable` - true for `v7` and `ulid` (their timestamp prefixes order by creation time)
- `uppercase` - whether the uppercase option was applied
- `generatedAt` - ISO 8601 timestamp of generation
- `ids` - the array of ids
- `error` - present instead of `ids` when you asked for a type we do not generate. Never charged.

### Example 1: a batch of time-sortable database keys

Input:

```json
{ "type": "v7", "count": 3 }
```

Output (real run, 2026-08-15):

```json
{
  "type": "v7",
  "ok": true,
  "count": 3,
  "uppercase": false,
  "sortable": true,
  "generatedAt": "2026-08-15T16:10:33.879Z",
  "ids": [
    "01a00630-7417-7e9c-9bc0-eb7f58745890",
    "01a00630-7417-7a61-b0d3-da9b72786170",
    "01a00630-7417-7a61-8966-6cc1472bee23"
  ]
}
```

Note the shared `01a00630-7417` prefix: that is the millisecond timestamp, which is what makes v7
sort by creation time and insert cleanly into a b-tree index.

### Example 2: several formats in one run

Input:

```json
{ "types": ["v7", "ulid", "nanoid"], "count": 3 }
```

Returns three batch records, one per type, each charged once. Real ids from that run
(2026-08-15):

```json
{ "type": "ulid",   "sortable": true,  "ids": ["01M0330X2CYE786KND5EK77PT7", "01M0330X2CE916HKEJ90HE55Y4", "01M0330X2C71A42GNNSYWBKEGM"] }
{ "type": "nanoid", "sortable": false, "ids": ["-Cr5izj5Jaj4EXELiLMeR", "uoipBpsYDknQl2mJhee-4", "zOvujSHTteNtQN7gclEoE"] }
```

The ULIDs share their leading timestamp characters the same way the v7s do.

**When `types` is filled, the single `type` field is ignored** - you get exactly the batches you
listed, and are charged for exactly those.

### Example 3: a type we do not generate

Input:

```json
{ "type": "v5" }
```

Output:

```json
{ "type": "v5", "ok": false, "error": "Unknown id type \"v5\". Valid: v4, v7, ulid, nanoid, short" }
```

It refuses rather than quietly handing back a v4. Asking for one thing and receiving another is the
worst possible failure for an id generator, so it is never done, and the refusal is not charged.

### Pricing

**$0.0004 per batch generated.** No start fee. One event covers one batch of one type, whether that
batch holds 1 id or 10,000 - so 10,000 UUID v7s cost $0.0004 total. Asking for three types in one run
is three batches and three charges. Unknown types are recorded and never charged.

Honest comparison, read from the Apify Store on 2026-08-07: `rl1987/uuid-generator` charges $0.01 per
start, `thescrapelab/guid-forge` $0.0005 start plus a per-item fee. Per-item pricing on an id
generator is the shape to watch - it is what turns a 10,000-id batch into real money.

Also honest: every language has a UUID library, and generating ids locally is free and instant. Pay
for this when you need ids inside a no-code pipeline, as a step in an Apify workflow, or as a tool an
AI agent can call - not because generating a UUID is hard.

### When NOT to use this

- **Namespace-deterministic ids (UUID v3 and v5).** Those hash a namespace and a name so that the
  same input always produces the same id. This generator does not do that, and will not approximate
  it. If you need v5, use a library.
- **UUID v1.** MAC-address-based v1 is not generated here, deliberately - it embeds the host's
  hardware address.
- **Ids that must be unguessable AND hide their creation time.** v7 and ULID leak the millisecond
  they were made, by design. For public tokens use NanoID or v4.
- **Session tokens, API keys, password reset links.** Use your framework's token generator, which
  handles storage, expiry and comparison. These are ids, not credentials - the 8-character `short`
  type especially is for human-facing codes, not security.
- **Strictly monotonic ids within a single millisecond.** See the limits below.

### Honest limits

- Types generated: `v4`, `v7`, `ulid`, `nanoid`, `short`. Not v1, v3 or v5.
- v7 and ULID sortability is millisecond-granular. Ids created within the same millisecond share a
  timestamp prefix, and their random tails are not monotonic within that millisecond (this matches
  the specification's basic mode). Across milliseconds, creation order sorts correctly.
- Up to 10,000 ids per batch; the ids are returned in your run's dataset.
- `uppercase` applies to the whole batch and will change NanoID and short ids semantically, since
  their alphabets are case-sensitive - two ids that differed only by case would collide after
  uppercasing. Use it for v4, v7 and ULID.

### FAQ

**What is UUID v7 and why would I use it instead of v4 for database keys?**
v7 puts a millisecond timestamp in its leading bits, so ids sort roughly by creation time. Inserts
land at the end of the index instead of scattering through it, which means less b-tree fragmentation
and faster inserts on large tables - and you get creation-time ordering for free. v4 is pure random
and scatters.

**When should I pick ULID over UUID v7?**
They sort the same way. ULID is 26 case-insensitive Crockford base32 characters with no dashes, which
is friendlier in URLs, filenames and double-click selection. Pick v7 when you already have UUID-typed
columns, ULID when the id is going to be seen and handled by people.

**Are NanoIDs safe to use in public URLs?**
Yes. 21 characters over a 64-symbol alphabet is about 126 bits of randomness, generated with
rejection sampling so the distribution is unbiased, from a cryptographic source. That is comparable
to a UUID v4 for collision resistance in a shorter string.

**How many ids can I generate in one call?**
10,000 per batch, and multiple batches per run via `types`. One batch is one $0.0004 charge no matter
how many ids it holds.

**Can I generate several id formats in a single run?**
Yes - `{"types": ["v4", "v7", "ulid"], "count": 100}` returns three records of 100 ids each. When
`types` is set, the single `type` field is ignored.

**Are these cryptographically random?**
Yes. v4 uses `crypto.randomUUID`; v7, ULID, NanoID and short all draw from `crypto.randomBytes` /
`randomFillSync`. No `Math.random` anywhere.

**What happens if I ask for a type you do not support?**
You get an `ok: false` record naming the valid types, and no charge. It never silently substitutes a
different format.

### Use from code or AI agents

```bash
curl -s "https://api.apify.com/v2/acts/EliAI~uuid-generator/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
  -X POST -H 'Content-Type: application/json' \
  -d '{"type": "v7", "count": 100}'
```

Agents: connect [Apify MCP](https://mcp.apify.com) and call the `EliAI/uuid-generator` tool.

- **Capability:** bulk id generation - UUID v4 and v7, ULID, NanoID, short - CSPRNG-backed, one batch record per type
- **Required input:** none (`type` defaults to v4); `types`, `count` and `uppercase` are optional
- **Returns:** one batch record per type; `ids` and `sortable` are the payload
- **Bounded:** 10,000 ids per batch; unknown types isolate as free records
- **Side effects:** none

# Actor input Schema

## `type` (type: `string`):

Which kind of unique ID to generate.

## `count` (type: `integer`):

How many IDs to generate in this batch (1–10000).

## `uppercase` (type: `boolean`):

Return all IDs in uppercase.

## `types` (type: `array`):

Generate several id kinds in one run - one batch record each (v4, v7, ulid, nanoid, short). When this list is filled, the single ID type above is ignored, so you are only charged for the batches you listed.

## Actor input object example

```json
{
  "type": "v4",
  "count": 10,
  "uppercase": false,
  "types": [
    "v7",
    "ulid"
  ]
}
```

# Actor output Schema

## `results` (type: `string`):

Every item this run produced, as JSON.

## `resultsCsv` (type: `string`):

The same items as a spreadsheet-ready CSV.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "type": "v4",
    "count": 10,
    "types": [
        "v7",
        "ulid"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("eliai/uuid-generator").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "type": "v4",
    "count": 10,
    "types": [
        "v7",
        "ulid",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("eliai/uuid-generator").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "type": "v4",
  "count": 10,
  "types": [
    "v7",
    "ulid"
  ]
}' |
apify call eliai/uuid-generator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,eliai/uuid-generator"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/cdzEATTXrzoWIIVIa/builds/bhM7hSqchdayFPxuG/openapi.json
