apyhub
DEVELOPER TOOLS

Generate Random Number API

What it does

Random Number Generator returns a cryptographically secure integer between the min and max query values you send. It is a simple utility for cases where you need a trustworthy random value without building your own generation logic.

Send optional min and max integers to define the range. If you omit them, the defaults are 0 and 100. The response includes the selected value along with the min and max used for that request, so you can log or verify the range alongside the result.

Use it anywhere you need a server-side random integer: selecting a winner, sampling test data, assigning a bucket, or generating a temporary numeric token. Because the value is produced securely, it is a better fit than Math.random-style client logic when the result matters.

Random Number Generator keeps the contract small and predictable: one request in, one integer out, with the range reflected back in the response.

GET
Generate a cryptographically secure random integer within a min/max range
http://localhost:8080/dosvak/random-number
QUICKSTARTGUIDE

Quickstart

Fetch a random number between the default minimum and maximum values.

curl -X GET "http://localhost:8080/dosvak/random-number?max=100&min=0" \
  -H "apy-token: $APY_TOKEN"

What you'll get back

Returns a JSON object with max, min, and value integer fields. max and min echo the requested range, and value is the generated random number.

{
  "max": 100,
  "min": 0,
  "value": 42
}
TRY ITLIVE · 10 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.

About this endpoint

What it does

Generates a cryptographically secure random integer within the requested range and returns it in a JSON object. The response also includes the min and max values used for the generation.

Query Parameter(s)

AttributeTypeMandatoryDescription
maxIntegerNoUpper bound of the range. Default: 100.
minIntegerNoLower bound of the range. Default: 0.

Response

Returns a JSON object with three integer fields: max, min, and value. value is the generated random integer, and min/max reflect the range used.

ParameterTypeMandatoryDescription
maxIntegerNoUpper bound used for generation.
minIntegerNoLower bound used for generation.
valueIntegerNoThe generated random integer.

Query parameters

Name
Type
Description
maxOPTIONAL
integer
DEFAULT 100
minOPTIONAL
integer
DEFAULT 0
▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.