Skip to content

Dice ​

The /dice endpoint rolls dice using RPG notation (NdX or NdX+M).

Parameters ​

ParameterRequiredDescription
rollYesDice notation (e.g. 2d6+3, 1d20, 4d8). 1–100 dice, 2–1000 sides. The + can be encoded as a space.

Response Fields ​

FieldTypeDescription
rollstringThe parsed dice notation
countnumberNumber of dice rolled
sidesnumberNumber of sides per die
modifiernumberAdded modifier (0 if none)
resultsnumber[]Individual die results
totalnumberSum of all dice results + modifier

Code Examples ​

curl -X GET \
  "https://api.sylvain.sh/v6/dice?roll=2d6%2B3"

Try It ​

Error Handling ​

If parameters are missing or invalid, the API will return an error:

Error MessageDescription
Please provide a valid dice roll (?roll={NdX|NdX+M})The roll parameter is missing or invalid