Skip to content

Roll several formulas in one request

POST
/v1/roll/batch
curl --request POST \
--url https://api.rollful.dev/v1/roll/batch \
--header 'Content-Type: application/json' \
--data '{ "rolls": [ { "formula": "2d6+3", "advantage": "normal", "bonuses": [ 1 ], "tags": [ "example" ] } ] }'

Dice are counted across every roll in the request, not per roll.

Media typeapplication/json
object
rolls
required
Array<object>
>= 1 items <= 20 items
object
formula
required

A dice formula, such as 2d6+3 or 4d6kh3.

string
>= 1 characters <= 200 characters
advantage

Applies to the first plain d20 term. Net advantage and disadvantage yourself.

string
Allowed values: normal advantage disadvantage
bonuses
Array
<= 20 items
tags

Trailing words to accept as a tag. A trailing word not listed here is a parse error.

Array<string>
<= 20 items

One result per requested roll.

Media typeapplication/json
object
rolls
required
Array<object>
object
formula
required
string
dice
required
Array<object>
object
sides
required
integer
sign
required
Any of:
number
Allowed values: 1
results
required

Every die rolled, including dropped ones. A penetrated 1 is recorded as 0, the one case this holds a number below 1.

Array<integer>
kept
required

The dice that counted towards the total.

Array<integer>
keptFlags
required

Aligned to results: whether each die was kept.

Array<boolean>
multiplier
required
integer
total
required

This group’s signed contribution to the total.

integer
naturalHigh
required
boolean
naturalLow
required
boolean
modifier
required

Sum of the flat modifiers. Dice are not counted.

integer
modifiers
required

Each flat modifier in order, so +1 -6 can be shown rather than -5.

Array<integer>
total
required
integer
advantageState
required

Applies to the first plain d20 term. Net advantage and disadvantage yourself.

string
Allowed values: normal advantage disadvantage
tag
string
Example
{
"rolls": [
{
"dice": [
{
"sign": 1
}
],
"advantageState": "normal"
}
]
}

The request or the formula was rejected.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid_request invalid_formula too_many_dice
message
required
string
Example
{
"error": {
"code": "invalid_formula",
"message": "A roll may use at most 1000 dice, but this one asks for 999999"
}
}

The request body was larger than the limit.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: payload_too_large
message
required
string
Example
{
"error": {
"code": "payload_too_large",
"message": "A request body may be at most 8192 bytes"
}
}

Too many requests from this address.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: rate_limited
message
required
string
Example
{
"error": {
"code": "rate_limited",
"message": "At most 60 requests every 60 seconds"
}
}

The random source failed.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: internal_error
message
required
string
Example
{
"error": {
"code": "internal_error",
"message": "The random source failed. Try again."
}
}