Skip to content
moxon home

Dice

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

gethttps://api.moxon.dev/v4/dice
Try itget/v4/dice

Parameters

  • rollstringrequired

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

Response Fields

  • rollstring

    The parsed dice notation

  • countnumber

    Number of dice rolled

  • sidesnumber

    Number of sides per die

  • modifiernumber

    Added modifier (0 if none)

  • resultsnumber[]

    Individual die results

  • totalnumber

    Sum of all dice results + modifier

Code Examples

Error Handling

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

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