Fork me on GitHub


Random Number API



Generate numbers, strings, and UUIDv4 values with this Go API. Source: GitHub.


Request format
Requests are GET with URL query parameters. count is 1–100 (default 1). max is exclusive. Invalid or repeated documented options return HTTP 400 with {"error":"..."}; failed Bluesky requests return HTTP 502. Errors never return partially generated arrays. Each response includes an X-Request-ID header. GET /healthz returns 204 when the server is running.

CURL

Previously invalid options silently used defaults; they now return 400 on v1.0 routes.

Get a random number
URL
https://www.randomnumberapi.com/api/v1.0/random
https://www.randomnumberapi.com/api/v1.0/randomnumber

Option Discription Default
min Inclusive minimum, at least 0 0
max Exclusive maximum, greater than min min + 100
count 1 to 100 numbers 1
secure Use cryptographic randomness (true/false) false
Example
Response:
[389, 741, 959, 754, 916]
Get a number seeded from public Bluesky replies
URL
https://www.randomnumberapi.com/api/v1.0/randomblueskynumber

Notes
Public replies to posts in Bluesky's Discover feed are hashed into deterministic pseudorandom seeds. No account or API key is needed. Reply hashes are cached in memory; another post is fetched after a pool is used. Replies may repeat or be old, so this is not secure randomness. If Bluesky is unavailable, the API returns 502 without a partial array. secure=true is rejected here; use the regular number endpoint instead.

Option Discription Default
min Inclusive minimum, at least 0 0
max Exclusive maximum, greater than min min + 100
count 1 to 100 numbers 1
Example
Response:
[389, 741, 959, 754, 916]
Get a random string
URL
https://www.randomnumberapi.com/api/v1.0/randomstring

Option Discription Default
min Inclusive minimum length, 0 to 1000 10
max Exclusive maximum length, at most 1001 (allows length 1000) 20
count 1 to 100 strings 1
all Include digits and symbols (true/false) False
secure Use cryptographic randomness for lengths and characters (true/false) false
Example
Response:
["sMierZwjgeBTS", "JsGdgIaBQvKpZKA", "qBhFRSfVEzLmeyV", "sehXFM", "DbGuP"]
Get a random UUID
URL
https://www.randomnumberapi.com/api/v1.0/uuid
https://www.randomnumberapi.com/api/v1.0/randomuuid

Option Discription Default
count 1 to 100 cryptographically random UUIDv4 values 1
Example
Response:
["333d69ac-79cf-455a-baf1-c7eeb76327bb", "7087d9a7-79e8-4df1-9b06-c37202bc285d"]


Copyright 2023; James Kozlowski