← All tool references

Lifestyle · execute

Dice Roller

Roll any number of dice with a chosen number of sides and total the results.

Open public tool

Overview

Category
Lifestyle
API mode
execute
Processing
client-side
Privacy
no-data-stored

Public descriptor

The descriptor is available without an API key and supplies this tool’s metadata, schemas, modes, and examples.

GET /api/v1/tools/dice-roller

View this descriptor as JSON

Execute availability

This tool has an execute route defined by its descriptor. Server-side execution is currently unavailable, so requests return api_not_launched.

POST /api/v1/tools/dice-roller/execute

Authentication is not issued during the preview. A bearer API key is planned for execution after launch.

Input schema

object object; additional properties are not accepted.

sides · number · required
Enter the sides used in this calculation.
count · number · required
Enter how many swatches, rolls, picks, names, letters, or values you want returned.
{
    "type": "object",
    "properties": {
        "sides": {
            "type": "number",
            "description": "Enter the sides used in this calculation."
        },
        "count": {
            "type": "number",
            "description": "Enter how many swatches, rolls, picks, names, letters, or values you want returned."
        }
    },
    "required": [
        "sides",
        "count"
    ],
    "additionalProperties": false
}

Output schema

On a successful execution, schema values appear in data.result.values.

rolls · array
Individual die results.
subtotal · number
Browser-calculated subtotal.
modifier · number
Browser-calculated modifier.
total · number
Sum of rolls.
notation · string
Browser-calculated notation.
{
    "type": "object",
    "properties": {
        "rolls": {
            "type": "array",
            "items": [],
            "description": "Individual die results."
        },
        "subtotal": {
            "type": "number",
            "description": "Browser-calculated subtotal."
        },
        "modifier": {
            "type": "number",
            "description": "Browser-calculated modifier."
        },
        "total": {
            "type": "number",
            "description": "Sum of rolls."
        },
        "notation": {
            "type": "string",
            "description": "Browser-calculated notation."
        }
    },
    "additionalProperties": false
}

Dice Roller: 2d6

The request body follows the published input schema. The response below shows the success-envelope shape returned after execution is available.

curl -X POST "https://utilitypages.org/api/v1/tools/dice-roller/execute" \
  -H "Content-Type: application/json" \
  -d '{
    "sides": 6,
    "count": 2
}'
{
    "ok": true,
    "data": {
        "slug": "dice-roller",
        "result": {
            "values": {
                "rolls": [
                    3,
                    5
                ],
                "subtotal": 8,
                "modifier": 0,
                "total": 8,
                "notation": "2d6"
            },
            "display": {
                "display": "[3,5]"
            },
            "warnings": [],
            "assumptions": [],
            "steps": []
        }
    },
    "meta": [],
    "request_id": "req_example_123"
}

Errors

api_not_launched · 503
Returned by the current launch gate for every execute request.
invalid_json · 400
Returned when an enabled execute request does not contain valid JSON.
validation_failed · 422
Returned when a request does not satisfy the input schema.
browser_interaction_required · 422
Returned for browser capability tools instead of inventing a server-side result.
tool_not_found · 404
Returned when a requested descriptor slug does not exist.
execution_failed · 503
Returned when an enabled server-side execution cannot complete.