Distributed serial number service

Unique serials, on demand

A lightweight HTTP service for generating atomically incrementing serial numbers across distributed systems. Create a counter, share its slug, and let every client pull the next value without conflicts.

What is uniq.rs?

Atomic increments

Every call to a counter is serialised in PostgreSQL — no duplicates, ever.

🌐

Globally shared

Multiple services or hosts can pull from the same counter over plain HTTP.

🔑

Slug-based access

Each counter gets a UUID slug. Share it only with the clients that need it.

💪

Stateless clients

No SDK, no library — a plain curl is all you need.

API Reference

POST /serials Create a new counter

Creates a new serial counter initialised at 0. The response is a 302 redirect to the counter's canonical URL, which contains its UUID slug.

$ curl -iX POST https://uniq.rs/serials

HTTP/2 302
location: /serials/4b3c2a1d-…
Extract the slug
$ curl -sX POST https://uniq.rs/serials -o /dev/null \
    -w "%{redirect_url}\n"

https://uniq.rs/serials/4b3c2a1d-8f9e-4a2b-b1c0-123456789abc
POST /serials/{slug} Get next value

Atomically increments the counter identified by {slug} and returns the new value as JSON. Repeated calls always yield strictly increasing, unique integers.

$ curl -sX POST https://uniq.rs/serials/4b3c2a1d-8f9e-4a2b-b1c0-123456789abc

{"value":1}

$ curl -sX POST https://uniq.rs/serials/4b3c2a1d-8f9e-4a2b-b1c0-123456789abc

{"value":2}

Quick Start

1 — Create a counter

Run this once to provision a new counter and capture the slug.

$ SLUG=$(curl -sX POST https://uniq.rs/serials -o /dev/null \
    -w "%{redirect_url}" | grep -o '[^/]*$')
$ echo $SLUG
4b3c2a1d-8f9e-4a2b-b1c0-123456789abc

2 — Pull the next serial

Call from any host that has the slug. Values are guaranteed unique.

$ curl -sX POST "https://uniq.rs/serials/$SLUG"
{"value":1}

Error Codes

404 — Not Found

The provided slug does not match any counter. Check that the UUID is correct.

500 — Internal Server Error

An unexpected condition occurred. Retry with exponential back-off.