Dice Roller

Dice Roller API

Utilities

Roll d4, d6, d8, d10, d12, d20, d100 or any custom die, or type notation like 3d6+2, 2d20kh1 for advantage or 4d6dl1, and see every die and the total.

Authentication

All API requests require a valid API key passed in the Authorization header as a Bearer token.

Rate Limit

120 requests per minute

Endpoints

1 endpoint available

Overview

Roll dice from standard notation. Every die is rolled with the server's crypto-secure random generator and each face is equally likely.

Notation

  • d20, 3d6, d% (a d100)
  • Modifiers and extra groups: 3d6+2, 1d8+1d6-1
  • Keep or drop: 2d20kh1 (keep highest), 2d20kl1 (keep lowest), 4d6dl1 (drop lowest), 4d6dh1 (drop highest); 4d6k3 means kh3 and 4d6d1 means dl1
  • Limits: 100 dice per group, 200 dice in total, 2 to 1000 sides, 12 groups and modifiers, modifiers up to 10000

Response

groups has one entry per term. rolls holds the faces in roll order and kept marks which of them count towards the total after keep or drop rules. min and max are the lowest and highest totals this notation can give.

Endpoints

POST
https://opentools.ca/api/v1/tools/dice-roller
Roll dice from notation

Request Body

Content-Type: application/json

ParameterTypeRequiredDescription
notation
string
Required
Dice notation, up to 200 characters, such as "3d6+2" or "4d6dl1".

Response Example

{
  "success": true,
  "notation": "4d6dl1+2",
  "total": 15,
  "min": 5,
  "max": 20,
  "groups": [
    {
      "term": "+4d6dl1",
      "kind": "dice",
      "rolls": [
        4,
        5,
        4,
        3
      ],
      "kept": [
        true,
        true,
        true,
        false
      ],
      "subtotal": 13
    },
    {
      "term": "+2",
      "kind": "constant",
      "rolls": [],
      "kept": [],
      "subtotal": 2
    }
  ]
}

Error Codes

400
Bad Request - Missing notation, or notation that cannot be parsed or exceeds the limits (the message says why)
401
Unauthorized - Invalid or missing API key
403
Forbidden - API key inactive, expired, or request from a disallowed IP
429
Too Many Requests - Rate limit exceeded
500
Internal Server Error

Code Examples

curl -X POST https://opentools.ca/api/v1/tools/dice-roller \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"notation": "4d6dl1+2"}'

Ready to get started?

Create an API key to start using the Dice Roller API.

Rather use it in your browser? Open the Dice Roller