{
  "openapi": "3.1.0",
  "info": {
    "title": "pdrng API",
    "version": "1.1.1",
    "summary": "Pseudo Deterministic Random Number Generator. Same seed, same output.",
    "description": "Every route takes a `seed` and returns the same answer for that seed, forever. Pass any word or number: \"brian\" resolves to 814, the default. Deterministic responses are cached immutably at the edge.",
    "license": {
      "name": "MIT",
      "url": "https://github.com/brianfunk/pdrng/blob/main/LICENSE"
    },
    "contact": {
      "name": "Brian Funk",
      "url": "https://github.com/brianfunk/pdrng"
    }
  },
  "servers": [
    {
      "url": "https://pdrng.com"
    }
  ],
  "tags": [
    {
      "name": "Profile",
      "description": "Everything for a seed"
    },
    {
      "name": "Numbers",
      "description": "Numeric utilities"
    },
    {
      "name": "Games",
      "description": "Games of chance"
    },
    {
      "name": "Fate",
      "description": "Oracles and omens"
    }
  ],
  "paths": {
    "/api/v1/profile": {
      "get": {
        "operationId": "profile",
        "tags": [
          "Profile"
        ],
        "summary": "Everything at once",
        "description": "Every pdrng result for a seed in one response. This is what the website renders.",
        "parameters": [
          {
            "name": "seed",
            "in": "query",
            "required": false,
            "description": "Any text or number. Numeric strings are treated as numbers; everything else is hashed as text (\"brian\" hashes to 814). Defaults to 814.",
            "schema": {
              "type": "string"
            },
            "example": "brian"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Profile"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/seed": {
      "get": {
        "operationId": "seed",
        "tags": [
          "Profile"
        ],
        "summary": "Resolve a seed",
        "description": "Returns the numeric seed that an input resolves to, e.g. \"brian\" becomes 814.",
        "parameters": [
          {
            "name": "seed",
            "in": "query",
            "required": false,
            "description": "Any text or number. Numeric strings are treated as numbers; everything else is hashed as text (\"brian\" hashes to 814). Defaults to 814.",
            "schema": {
              "type": "string"
            },
            "example": "brian"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "seed": {
                      "type": "integer",
                      "description": "The numeric seed the result derives from"
                    },
                    "input": {
                      "description": "The input as supplied",
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "number"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/number": {
      "get": {
        "operationId": "number",
        "tags": [
          "Numbers"
        ],
        "summary": "Deterministic number",
        "description": "A number with exactly `digits` digits (1-15), built from the seed with the digit-fill algorithm.",
        "parameters": [
          {
            "name": "seed",
            "in": "query",
            "required": false,
            "description": "Any text or number. Numeric strings are treated as numbers; everything else is hashed as text (\"brian\" hashes to 814). Defaults to 814.",
            "schema": {
              "type": "string"
            },
            "example": "brian"
          },
          {
            "name": "digits",
            "in": "query",
            "required": false,
            "description": "Digit count, 1-15",
            "schema": {
              "type": "integer",
              "default": 3
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "seed": {
                      "type": "integer",
                      "description": "The numeric seed the result derives from"
                    },
                    "digits": {
                      "type": "integer",
                      "description": "Requested digit count"
                    },
                    "value": {
                      "type": "integer",
                      "description": "The number"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/float": {
      "get": {
        "operationId": "float",
        "tags": [
          "Numbers"
        ],
        "summary": "Deterministic float",
        "description": "A float in [0, 1) with `precision` decimal places (1-15).",
        "parameters": [
          {
            "name": "seed",
            "in": "query",
            "required": false,
            "description": "Any text or number. Numeric strings are treated as numbers; everything else is hashed as text (\"brian\" hashes to 814). Defaults to 814.",
            "schema": {
              "type": "string"
            },
            "example": "brian"
          },
          {
            "name": "precision",
            "in": "query",
            "required": false,
            "description": "Decimal places, 1-15",
            "schema": {
              "type": "integer",
              "default": 6
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "seed": {
                      "type": "integer",
                      "description": "The numeric seed the result derives from"
                    },
                    "precision": {
                      "type": "integer",
                      "description": "Requested precision"
                    },
                    "value": {
                      "type": "number"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/range": {
      "get": {
        "operationId": "range",
        "tags": [
          "Numbers"
        ],
        "summary": "Integer in a range",
        "description": "An integer in [min, max] using seed priority selection: the first of the seed, its trailing digits, first digit, last digit and middle digits that fits.",
        "parameters": [
          {
            "name": "seed",
            "in": "query",
            "required": false,
            "description": "Any text or number. Numeric strings are treated as numbers; everything else is hashed as text (\"brian\" hashes to 814). Defaults to 814.",
            "schema": {
              "type": "string"
            },
            "example": "brian"
          },
          {
            "name": "min",
            "in": "query",
            "required": true,
            "description": "Lower bound (inclusive)",
            "schema": {
              "type": "integer"
            },
            "example": 1
          },
          {
            "name": "max",
            "in": "query",
            "required": true,
            "description": "Upper bound (inclusive)",
            "schema": {
              "type": "integer"
            },
            "example": 100
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "seed": {
                      "type": "integer",
                      "description": "The numeric seed the result derives from"
                    },
                    "min": {
                      "type": "integer",
                      "description": "Lower bound"
                    },
                    "max": {
                      "type": "integer",
                      "description": "Upper bound"
                    },
                    "value": {
                      "type": "integer",
                      "description": "Selected integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/array": {
      "get": {
        "operationId": "array",
        "tags": [
          "Numbers"
        ],
        "summary": "Array of numbers",
        "description": "`count` numbers with `digits` digits each. Each element uses the sub-seed seed + index × (2 × digitSum + 1).",
        "parameters": [
          {
            "name": "seed",
            "in": "query",
            "required": false,
            "description": "Any text or number. Numeric strings are treated as numbers; everything else is hashed as text (\"brian\" hashes to 814). Defaults to 814.",
            "schema": {
              "type": "string"
            },
            "example": "brian"
          },
          {
            "name": "count",
            "in": "query",
            "required": false,
            "description": "Element count, 0-10000",
            "schema": {
              "type": "integer",
              "default": 5
            }
          },
          {
            "name": "digits",
            "in": "query",
            "required": false,
            "description": "Digits per element, 1-15",
            "schema": {
              "type": "integer",
              "default": 3
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "seed": {
                      "type": "integer",
                      "description": "The numeric seed the result derives from"
                    },
                    "count": {
                      "type": "integer",
                      "description": "Element count"
                    },
                    "digits": {
                      "type": "integer",
                      "description": "Digits per element"
                    },
                    "values": {
                      "type": "array",
                      "items": {
                        "type": "integer"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/uuid": {
      "get": {
        "operationId": "uuid",
        "tags": [
          "Numbers"
        ],
        "summary": "Deterministic UUID",
        "description": "A UUID in v4 format derived from the seed. Same seed, same UUID.",
        "parameters": [
          {
            "name": "seed",
            "in": "query",
            "required": false,
            "description": "Any text or number. Numeric strings are treated as numbers; everything else is hashed as text (\"brian\" hashes to 814). Defaults to 814.",
            "schema": {
              "type": "string"
            },
            "example": "brian"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "seed": {
                      "type": "integer",
                      "description": "The numeric seed the result derives from"
                    },
                    "value": {
                      "type": "string",
                      "description": "UUID v4 format"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/odd-or-even": {
      "get": {
        "operationId": "oddOrEven",
        "tags": [
          "Numbers"
        ],
        "summary": "Odd or even",
        "description": "Parity of the seed itself.",
        "parameters": [
          {
            "name": "seed",
            "in": "query",
            "required": false,
            "description": "Any text or number. Numeric strings are treated as numbers; everything else is hashed as text (\"brian\" hashes to 814). Defaults to 814.",
            "schema": {
              "type": "string"
            },
            "example": "brian"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "seed": {
                      "type": "integer",
                      "description": "The numeric seed the result derives from"
                    },
                    "value": {
                      "type": "string",
                      "enum": [
                        "odd",
                        "even"
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/red-or-black": {
      "get": {
        "operationId": "redOrBlack",
        "tags": [
          "Games"
        ],
        "summary": "Red or black",
        "description": "Red when the digit sum is odd, black when even.",
        "parameters": [
          {
            "name": "seed",
            "in": "query",
            "required": false,
            "description": "Any text or number. Numeric strings are treated as numbers; everything else is hashed as text (\"brian\" hashes to 814). Defaults to 814.",
            "schema": {
              "type": "string"
            },
            "example": "brian"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "seed": {
                      "type": "integer",
                      "description": "The numeric seed the result derives from"
                    },
                    "value": {
                      "type": "string",
                      "enum": [
                        "red",
                        "black"
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/coin": {
      "get": {
        "operationId": "coin",
        "tags": [
          "Games"
        ],
        "summary": "Coin flip",
        "description": "Heads when the digit sum is even, tails when odd.",
        "parameters": [
          {
            "name": "seed",
            "in": "query",
            "required": false,
            "description": "Any text or number. Numeric strings are treated as numbers; everything else is hashed as text (\"brian\" hashes to 814). Defaults to 814.",
            "schema": {
              "type": "string"
            },
            "example": "brian"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "seed": {
                      "type": "integer",
                      "description": "The numeric seed the result derives from"
                    },
                    "value": {
                      "type": "string",
                      "enum": [
                        "heads",
                        "tails"
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/dice": {
      "get": {
        "operationId": "dice",
        "tags": [
          "Games"
        ],
        "summary": "Roll one die",
        "description": "A result from 1 to `sides` using seed priority selection.",
        "parameters": [
          {
            "name": "seed",
            "in": "query",
            "required": false,
            "description": "Any text or number. Numeric strings are treated as numbers; everything else is hashed as text (\"brian\" hashes to 814). Defaults to 814.",
            "schema": {
              "type": "string"
            },
            "example": "brian"
          },
          {
            "name": "sides",
            "in": "query",
            "required": false,
            "description": "Number of sides, 1 or more",
            "schema": {
              "type": "integer",
              "default": 6
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "seed": {
                      "type": "integer",
                      "description": "The numeric seed the result derives from"
                    },
                    "sides": {
                      "type": "integer",
                      "description": "Number of sides"
                    },
                    "value": {
                      "type": "integer",
                      "description": "Die result"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/card": {
      "get": {
        "operationId": "card",
        "tags": [
          "Games"
        ],
        "summary": "Draw a card",
        "description": "A playing card such as \"8 of Diamonds\". Rank from the seed, suit from the digit sum.",
        "parameters": [
          {
            "name": "seed",
            "in": "query",
            "required": false,
            "description": "Any text or number. Numeric strings are treated as numbers; everything else is hashed as text (\"brian\" hashes to 814). Defaults to 814.",
            "schema": {
              "type": "string"
            },
            "example": "brian"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "seed": {
                      "type": "integer",
                      "description": "The numeric seed the result derives from"
                    },
                    "value": {
                      "type": "string",
                      "description": "e.g. \"8 of Diamonds\""
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/roulette": {
      "get": {
        "operationId": "roulette",
        "tags": [
          "Games"
        ],
        "summary": "Spin the wheel",
        "description": "A roulette pocket (0-36) with its color and parity.",
        "parameters": [
          {
            "name": "seed",
            "in": "query",
            "required": false,
            "description": "Any text or number. Numeric strings are treated as numbers; everything else is hashed as text (\"brian\" hashes to 814). Defaults to 814.",
            "schema": {
              "type": "string"
            },
            "example": "brian"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "seed": {
                      "type": "integer",
                      "description": "The numeric seed the result derives from"
                    },
                    "value": {
                      "$ref": "#/components/schemas/Roulette"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/rps": {
      "get": {
        "operationId": "rps",
        "tags": [
          "Games"
        ],
        "summary": "Rock, paper, scissors",
        "description": "Chosen from (seed + digitSum) modulo 3.",
        "parameters": [
          {
            "name": "seed",
            "in": "query",
            "required": false,
            "description": "Any text or number. Numeric strings are treated as numbers; everything else is hashed as text (\"brian\" hashes to 814). Defaults to 814.",
            "schema": {
              "type": "string"
            },
            "example": "brian"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "seed": {
                      "type": "integer",
                      "description": "The numeric seed the result derives from"
                    },
                    "value": {
                      "type": "string",
                      "enum": [
                        "rock",
                        "paper",
                        "scissors"
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/magic8": {
      "get": {
        "operationId": "magic8",
        "tags": [
          "Fate"
        ],
        "summary": "Magic 8-Ball",
        "description": "One of the twenty classic answers.",
        "parameters": [
          {
            "name": "seed",
            "in": "query",
            "required": false,
            "description": "Any text or number. Numeric strings are treated as numbers; everything else is hashed as text (\"brian\" hashes to 814). Defaults to 814.",
            "schema": {
              "type": "string"
            },
            "example": "brian"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "seed": {
                      "type": "integer",
                      "description": "The numeric seed the result derives from"
                    },
                    "value": {
                      "type": "string",
                      "description": "The answer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/zodiac": {
      "get": {
        "operationId": "zodiac",
        "tags": [
          "Fate"
        ],
        "summary": "Zodiac sign",
        "description": "A zodiac sign from the last two digits of the seed.",
        "parameters": [
          {
            "name": "seed",
            "in": "query",
            "required": false,
            "description": "Any text or number. Numeric strings are treated as numbers; everything else is hashed as text (\"brian\" hashes to 814). Defaults to 814.",
            "schema": {
              "type": "string"
            },
            "example": "brian"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "seed": {
                      "type": "integer",
                      "description": "The numeric seed the result derives from"
                    },
                    "value": {
                      "type": "string",
                      "description": "e.g. \"Gemini\""
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tarot": {
      "get": {
        "operationId": "tarot",
        "tags": [
          "Fate"
        ],
        "summary": "Tarot card",
        "description": "A Major Arcana card.",
        "parameters": [
          {
            "name": "seed",
            "in": "query",
            "required": false,
            "description": "Any text or number. Numeric strings are treated as numbers; everything else is hashed as text (\"brian\" hashes to 814). Defaults to 814.",
            "schema": {
              "type": "string"
            },
            "example": "brian"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "seed": {
                      "type": "integer",
                      "description": "The numeric seed the result derives from"
                    },
                    "value": {
                      "type": "string",
                      "description": "e.g. \"The Magician\""
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/fortune": {
      "get": {
        "operationId": "fortune",
        "tags": [
          "Fate"
        ],
        "summary": "Fortune cookie",
        "description": "A fortune chosen from the digit sum.",
        "parameters": [
          {
            "name": "seed",
            "in": "query",
            "required": false,
            "description": "Any text or number. Numeric strings are treated as numbers; everything else is hashed as text (\"brian\" hashes to 814). Defaults to 814.",
            "schema": {
              "type": "string"
            },
            "example": "brian"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "seed": {
                      "type": "integer",
                      "description": "The numeric seed the result derives from"
                    },
                    "value": {
                      "type": "string",
                      "description": "The fortune"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/spin": {
      "get": {
        "operationId": "spin",
        "tags": [
          "Games"
        ],
        "summary": "Pick from a list",
        "description": "Choose one entry from a comma-separated list of choices.",
        "parameters": [
          {
            "name": "seed",
            "in": "query",
            "required": false,
            "description": "Any text or number. Numeric strings are treated as numbers; everything else is hashed as text (\"brian\" hashes to 814). Defaults to 814.",
            "schema": {
              "type": "string"
            },
            "example": "brian"
          },
          {
            "name": "choices",
            "in": "query",
            "required": true,
            "description": "Comma-separated options",
            "schema": {
              "type": "string"
            },
            "example": "pizza,tacos,sushi"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "seed": {
                      "type": "integer",
                      "description": "The numeric seed the result derives from"
                    },
                    "choices": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "value": {
                      "type": "string",
                      "description": "The chosen entry"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/roll": {
      "get": {
        "operationId": "roll",
        "tags": [
          "Games"
        ],
        "summary": "Roll dice notation",
        "description": "Tabletop dice notation such as `2d6+3`. Returns each die, the modifier and the total.",
        "parameters": [
          {
            "name": "seed",
            "in": "query",
            "required": false,
            "description": "Any text or number. Numeric strings are treated as numbers; everything else is hashed as text (\"brian\" hashes to 814). Defaults to 814.",
            "schema": {
              "type": "string"
            },
            "example": "brian"
          },
          {
            "name": "notation",
            "in": "query",
            "required": false,
            "description": "Dice notation like 2d6, 1d20+5, 3d8-2",
            "schema": {
              "type": "string",
              "default": "2d6"
            },
            "example": "2d6+3"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "seed": {
                      "type": "integer",
                      "description": "The numeric seed the result derives from"
                    },
                    "notation": {
                      "type": "string",
                      "description": "Notation as parsed"
                    },
                    "value": {
                      "$ref": "#/components/schemas/Roll"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/bingo": {
      "get": {
        "operationId": "bingo",
        "tags": [
          "Games"
        ],
        "summary": "Bingo call",
        "description": "A bingo call such as \"B-14\" from the last two digits of the seed.",
        "parameters": [
          {
            "name": "seed",
            "in": "query",
            "required": false,
            "description": "Any text or number. Numeric strings are treated as numbers; everything else is hashed as text (\"brian\" hashes to 814). Defaults to 814.",
            "schema": {
              "type": "string"
            },
            "example": "brian"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "seed": {
                      "type": "integer",
                      "description": "The numeric seed the result derives from"
                    },
                    "value": {
                      "type": "string",
                      "description": "e.g. \"B-14\""
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/color": {
      "get": {
        "operationId": "color",
        "tags": [
          "Numbers"
        ],
        "summary": "Hex color",
        "description": "A six-digit hex color derived from the seed digits.",
        "parameters": [
          {
            "name": "seed",
            "in": "query",
            "required": false,
            "description": "Any text or number. Numeric strings are treated as numbers; everything else is hashed as text (\"brian\" hashes to 814). Defaults to 814.",
            "schema": {
              "type": "string"
            },
            "example": "brian"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "seed": {
                      "type": "integer",
                      "description": "The numeric seed the result derives from"
                    },
                    "value": {
                      "type": "string",
                      "description": "e.g. \"#a81414\""
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/random-seed": {
      "get": {
        "operationId": "randomSeed",
        "tags": [
          "Numbers"
        ],
        "summary": "Fresh random seed",
        "description": "The one non-deterministic endpoint. Returns a seed from the Web Crypto API to feed into any other route.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "seed": {
                      "type": "integer",
                      "description": "A fresh random seed"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "example": "invalid_parameter"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      },
      "Roulette": {
        "type": "object",
        "properties": {
          "number": {
            "type": "integer",
            "minimum": 0,
            "maximum": 36
          },
          "color": {
            "type": "string",
            "enum": [
              "red",
              "black",
              "green"
            ]
          },
          "parity": {
            "type": "string",
            "enum": [
              "odd",
              "even",
              "zero"
            ]
          }
        }
      },
      "Roll": {
        "type": "object",
        "properties": {
          "rolls": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          },
          "modifier": {
            "type": "integer"
          },
          "total": {
            "type": "integer"
          }
        }
      },
      "Profile": {
        "type": "object",
        "properties": {
          "input": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "seed": {
            "type": "integer"
          },
          "derived": {
            "type": "object",
            "properties": {
              "digits": {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              },
              "digitSum": {
                "type": "integer"
              },
              "digitProduct": {
                "type": "integer"
              },
              "firstDigit": {
                "type": "integer"
              },
              "lastDigit": {
                "type": "integer"
              }
            }
          },
          "number": {
            "type": "object",
            "properties": {
              "digits3": {
                "type": "integer"
              },
              "digits6": {
                "type": "integer"
              }
            }
          },
          "float": {
            "type": "number"
          },
          "uuid": {
            "type": "string"
          },
          "oddOrEven": {
            "type": "string",
            "enum": [
              "odd",
              "even"
            ]
          },
          "redOrBlack": {
            "type": "string",
            "enum": [
              "red",
              "black"
            ]
          },
          "coin": {
            "type": "string",
            "enum": [
              "heads",
              "tails"
            ]
          },
          "dice": {
            "type": "object",
            "properties": {
              "d6": {
                "type": "integer"
              },
              "d20": {
                "type": "integer"
              }
            }
          },
          "card": {
            "type": "string"
          },
          "roulette": {
            "$ref": "#/components/schemas/Roulette"
          },
          "rps": {
            "type": "string",
            "enum": [
              "rock",
              "paper",
              "scissors"
            ]
          },
          "magic8": {
            "type": "string"
          },
          "zodiac": {
            "type": "string"
          },
          "tarot": {
            "type": "string"
          },
          "fortune": {
            "type": "string"
          },
          "bingo": {
            "type": "string"
          },
          "color": {
            "type": "string"
          },
          "roll": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Roll"
              },
              {
                "type": "object",
                "properties": {
                  "notation": {
                    "type": "string"
                  }
                }
              }
            ]
          }
        }
      }
    }
  }
}