{
 "openapi": "3.1.0",
 "info": {
  "title": "Lottery numbers and fair random",
  "version": "1.0.0",
  "description": "Lottery numbers (picks, past draws, ticket check) and fair, reproducible randomness. Free, no key. The same tools are MCP servers at /mcp/lottery and /mcp/random."
 },
 "servers": [
  {
   "url": "https://tools.intoperson.com"
  }
 ],
 "paths": {
  "/api/v1/lottery/pick": {
   "get": {
    "operationId": "pick_numbers",
    "summary": "Pick lottery numbers",
    "description": "Random numbers for a lottery game, 1 to 10 sets. Either name a game: kr645 (Lotto 6/45 (South Korea)), powerball (Powerball (USA)), megamillions (Mega Millions (USA, matrix since 2025-04-08)), euromillions (EuroMillions), uk_lotto (Lotto (UK)), jp_loto6 (Loto 6 (Japan)), jp_loto7 (Loto 7 (Japan)); or give your own format with game \"custom\": count numbers from min (default 1) to max, and optionally extra_count numbers from 1 to extra_max drawn apart (a bonus ball). The answer has the seed that reproduces it.",
    "responses": {
     "200": {
      "description": "The result."
     },
     "400": {
      "description": "An argument is wrong: {error: {code, message, field}}."
     },
     "503": {
      "description": "The source of past draws did not answer."
     }
    },
    "parameters": [
     {
      "name": "game",
      "in": "query",
      "required": false,
      "description": "A game, or \"custom\" with count and max. May be left out when count and max are given.",
      "schema": {
       "type": "string",
       "enum": [
        "kr645",
        "powerball",
        "megamillions",
        "euromillions",
        "uk_lotto",
        "jp_loto6",
        "jp_loto7",
        "custom"
       ]
      }
     },
     {
      "name": "sets",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "minimum": 1,
       "maximum": 10,
       "default": 1
      }
     },
     {
      "name": "count",
      "in": "query",
      "required": false,
      "description": "custom: how many numbers per set.",
      "schema": {
       "type": "integer",
       "minimum": 1,
       "maximum": 50
      }
     },
     {
      "name": "max",
      "in": "query",
      "required": false,
      "description": "custom: the largest number.",
      "schema": {
       "type": "integer",
       "minimum": 1,
       "maximum": 1000
      }
     },
     {
      "name": "min",
      "in": "query",
      "required": false,
      "description": "custom: the smallest number.",
      "schema": {
       "type": "integer",
       "minimum": 0,
       "maximum": 1000,
       "default": 1
      }
     },
     {
      "name": "extra_count",
      "in": "query",
      "required": false,
      "description": "custom: how many extra (bonus) numbers, drawn apart.",
      "schema": {
       "type": "integer",
       "minimum": 0,
       "maximum": 10,
       "default": 0
      }
     },
     {
      "name": "extra_max",
      "in": "query",
      "required": false,
      "description": "custom: the largest extra number (extras start at 1).",
      "schema": {
       "type": "integer",
       "minimum": 1,
       "maximum": 1000
      }
     },
     {
      "name": "seed",
      "in": "query",
      "required": false,
      "description": "Optional. 64 hex characters. Give the seed of an earlier answer to get the same result again (that is how a draw is checked). Leave it out for a fresh draw.",
      "schema": {
       "type": "string",
       "pattern": "^[0-9a-fA-F]{64}$"
      }
     }
    ]
   },
   "post": {
    "operationId": "pick_numbers_post",
    "summary": "Pick lottery numbers",
    "description": "Random numbers for a lottery game, 1 to 10 sets. Either name a game: kr645 (Lotto 6/45 (South Korea)), powerball (Powerball (USA)), megamillions (Mega Millions (USA, matrix since 2025-04-08)), euromillions (EuroMillions), uk_lotto (Lotto (UK)), jp_loto6 (Loto 6 (Japan)), jp_loto7 (Loto 7 (Japan)); or give your own format with game \"custom\": count numbers from min (default 1) to max, and optionally extra_count numbers from 1 to extra_max drawn apart (a bonus ball). The answer has the seed that reproduces it.",
    "responses": {
     "200": {
      "description": "The result."
     },
     "400": {
      "description": "An argument is wrong: {error: {code, message, field}}."
     },
     "503": {
      "description": "The source of past draws did not answer."
     }
    },
    "requestBody": {
     "required": false,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "game": {
          "type": "string",
          "enum": [
           "kr645",
           "powerball",
           "megamillions",
           "euromillions",
           "uk_lotto",
           "jp_loto6",
           "jp_loto7",
           "custom"
          ],
          "description": "A game, or \"custom\" with count and max. May be left out when count and max are given."
         },
         "sets": {
          "type": "integer",
          "minimum": 1,
          "maximum": 10,
          "default": 1
         },
         "count": {
          "type": "integer",
          "minimum": 1,
          "maximum": 50,
          "description": "custom: how many numbers per set."
         },
         "max": {
          "type": "integer",
          "minimum": 1,
          "maximum": 1000,
          "description": "custom: the largest number."
         },
         "min": {
          "type": "integer",
          "minimum": 0,
          "maximum": 1000,
          "default": 1,
          "description": "custom: the smallest number."
         },
         "extra_count": {
          "type": "integer",
          "minimum": 0,
          "maximum": 10,
          "default": 0,
          "description": "custom: how many extra (bonus) numbers, drawn apart."
         },
         "extra_max": {
          "type": "integer",
          "minimum": 1,
          "maximum": 1000,
          "description": "custom: the largest extra number (extras start at 1)."
         },
         "seed": {
          "type": "string",
          "pattern": "^[0-9a-fA-F]{64}$",
          "description": "Optional. 64 hex characters. Give the seed of an earlier answer to get the same result again (that is how a draw is checked). Leave it out for a fresh draw."
         }
        }
       }
      }
     }
    }
   }
  },
  "/api/v1/lottery/draw": {
   "get": {
    "operationId": "get_draw",
    "summary": "Get winning numbers",
    "description": "The winning numbers of the latest draw, or of one past draw. kr645: give the draw number (회차). powerball, megamillions: give the draw date YYYY-MM-DD. Sources: dhlottery.co.kr (Korea), data.ny.gov (USA).",
    "responses": {
     "200": {
      "description": "The result."
     },
     "400": {
      "description": "An argument is wrong: {error: {code, message, field}}."
     },
     "503": {
      "description": "The source of past draws did not answer."
     }
    },
    "parameters": [
     {
      "name": "game",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string",
       "enum": [
        "kr645",
        "powerball",
        "megamillions"
       ]
      }
     },
     {
      "name": "draw",
      "in": "query",
      "required": false,
      "description": "Optional. Draw number (kr645) or draw date YYYY-MM-DD (USA). Leave it out for the latest.",
      "schema": {
       "type": [
        "string",
        "integer"
       ]
      }
     }
    ]
   },
   "post": {
    "operationId": "get_draw_post",
    "summary": "Get winning numbers",
    "description": "The winning numbers of the latest draw, or of one past draw. kr645: give the draw number (회차). powerball, megamillions: give the draw date YYYY-MM-DD. Sources: dhlottery.co.kr (Korea), data.ny.gov (USA).",
    "responses": {
     "200": {
      "description": "The result."
     },
     "400": {
      "description": "An argument is wrong: {error: {code, message, field}}."
     },
     "503": {
      "description": "The source of past draws did not answer."
     }
    },
    "requestBody": {
     "required": false,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "game": {
          "type": "string",
          "enum": [
           "kr645",
           "powerball",
           "megamillions"
          ]
         },
         "draw": {
          "type": [
           "string",
           "integer"
          ],
          "description": "Optional. Draw number (kr645) or draw date YYYY-MM-DD (USA). Leave it out for the latest."
         }
        },
        "required": [
         "game"
        ],
        "additionalProperties": false
       }
      }
     }
    }
   }
  },
  "/api/v1/lottery/check": {
   "get": {
    "operationId": "check_ticket",
    "summary": "Check a ticket",
    "description": "Compare your numbers with a draw (the latest unless you give one). kr645 gives the rank and the prize per winner from the official record; powerball and megamillions give the match (prize amounts depend on state and multiplier and are not given).",
    "responses": {
     "200": {
      "description": "The result."
     },
     "400": {
      "description": "An argument is wrong: {error: {code, message, field}}."
     },
     "503": {
      "description": "The source of past draws did not answer."
     }
    },
    "parameters": [
     {
      "name": "game",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string",
       "enum": [
        "kr645",
        "powerball",
        "megamillions"
       ]
      }
     },
     {
      "name": "numbers",
      "in": "query",
      "required": true,
      "description": "kr645: 6 numbers 1-45. powerball: 5 numbers 1-69. megamillions: 5 numbers 1-70.",
      "schema": {
       "type": "array",
       "items": {
        "type": "integer"
       }
      },
      "style": "form",
      "explode": false
     },
     {
      "name": "extra_number",
      "in": "query",
      "required": false,
      "description": "powerball: your Powerball 1-26. megamillions: your Mega Ball 1-24. Not used for kr645.",
      "schema": {
       "type": "integer"
      }
     },
     {
      "name": "draw",
      "in": "query",
      "required": false,
      "description": "Optional, as in get_draw.",
      "schema": {
       "type": [
        "string",
        "integer"
       ]
      }
     }
    ]
   },
   "post": {
    "operationId": "check_ticket_post",
    "summary": "Check a ticket",
    "description": "Compare your numbers with a draw (the latest unless you give one). kr645 gives the rank and the prize per winner from the official record; powerball and megamillions give the match (prize amounts depend on state and multiplier and are not given).",
    "responses": {
     "200": {
      "description": "The result."
     },
     "400": {
      "description": "An argument is wrong: {error: {code, message, field}}."
     },
     "503": {
      "description": "The source of past draws did not answer."
     }
    },
    "requestBody": {
     "required": false,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "game",
         "numbers"
        ],
        "properties": {
         "game": {
          "type": "string",
          "enum": [
           "kr645",
           "powerball",
           "megamillions"
          ]
         },
         "numbers": {
          "type": "array",
          "items": {
           "type": "integer"
          },
          "description": "kr645: 6 numbers 1-45. powerball: 5 numbers 1-69. megamillions: 5 numbers 1-70."
         },
         "extra_number": {
          "type": "integer",
          "description": "powerball: your Powerball 1-26. megamillions: your Mega Ball 1-24. Not used for kr645."
         },
         "draw": {
          "type": [
           "string",
           "integer"
          ],
          "description": "Optional, as in get_draw."
         }
        }
       }
      }
     }
    }
   }
  },
  "/api/v1/random/dice": {
   "get": {
    "operationId": "roll_dice",
    "summary": "Roll dice",
    "description": "Roll 1 to 100 dice with 2 to 1000 sides each (default one six-sided die).",
    "responses": {
     "200": {
      "description": "The result."
     },
     "400": {
      "description": "An argument is wrong: {error: {code, message, field}}."
     },
     "503": {
      "description": "The source of past draws did not answer."
     }
    },
    "parameters": [
     {
      "name": "sides",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "minimum": 2,
       "maximum": 1000,
       "default": 6
      }
     },
     {
      "name": "count",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "minimum": 1,
       "maximum": 100,
       "default": 1
      }
     },
     {
      "name": "seed",
      "in": "query",
      "required": false,
      "description": "Optional. 64 hex characters. Give the seed of an earlier answer to get the same result again (that is how a draw is checked). Leave it out for a fresh draw.",
      "schema": {
       "type": "string",
       "pattern": "^[0-9a-fA-F]{64}$"
      }
     }
    ]
   },
   "post": {
    "operationId": "roll_dice_post",
    "summary": "Roll dice",
    "description": "Roll 1 to 100 dice with 2 to 1000 sides each (default one six-sided die).",
    "responses": {
     "200": {
      "description": "The result."
     },
     "400": {
      "description": "An argument is wrong: {error: {code, message, field}}."
     },
     "503": {
      "description": "The source of past draws did not answer."
     }
    },
    "requestBody": {
     "required": false,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "sides": {
          "type": "integer",
          "minimum": 2,
          "maximum": 1000,
          "default": 6
         },
         "count": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100,
          "default": 1
         },
         "seed": {
          "type": "string",
          "pattern": "^[0-9a-fA-F]{64}$",
          "description": "Optional. 64 hex characters. Give the seed of an earlier answer to get the same result again (that is how a draw is checked). Leave it out for a fresh draw."
         }
        },
        "additionalProperties": false
       }
      }
     }
    }
   }
  },
  "/api/v1/random/coin": {
   "get": {
    "operationId": "flip_coin",
    "summary": "Flip a coin",
    "description": "Flip a fair coin 1 to 100 times.",
    "responses": {
     "200": {
      "description": "The result."
     },
     "400": {
      "description": "An argument is wrong: {error: {code, message, field}}."
     },
     "503": {
      "description": "The source of past draws did not answer."
     }
    },
    "parameters": [
     {
      "name": "count",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "minimum": 1,
       "maximum": 100,
       "default": 1
      }
     },
     {
      "name": "seed",
      "in": "query",
      "required": false,
      "description": "Optional. 64 hex characters. Give the seed of an earlier answer to get the same result again (that is how a draw is checked). Leave it out for a fresh draw.",
      "schema": {
       "type": "string",
       "pattern": "^[0-9a-fA-F]{64}$"
      }
     }
    ]
   },
   "post": {
    "operationId": "flip_coin_post",
    "summary": "Flip a coin",
    "description": "Flip a fair coin 1 to 100 times.",
    "responses": {
     "200": {
      "description": "The result."
     },
     "400": {
      "description": "An argument is wrong: {error: {code, message, field}}."
     },
     "503": {
      "description": "The source of past draws did not answer."
     }
    },
    "requestBody": {
     "required": false,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "count": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100,
          "default": 1
         },
         "seed": {
          "type": "string",
          "pattern": "^[0-9a-fA-F]{64}$",
          "description": "Optional. 64 hex characters. Give the seed of an earlier answer to get the same result again (that is how a draw is checked). Leave it out for a fresh draw."
         }
        },
        "additionalProperties": false
       }
      }
     }
    }
   }
  },
  "/api/v1/random/integer": {
   "get": {
    "operationId": "random_integer",
    "summary": "Random integers",
    "description": "Integers from min to max inclusive, 1 to 1000 of them, with or without repeats. The range may hold at most 2^32 values.",
    "responses": {
     "200": {
      "description": "The result."
     },
     "400": {
      "description": "An argument is wrong: {error: {code, message, field}}."
     },
     "503": {
      "description": "The source of past draws did not answer."
     }
    },
    "parameters": [
     {
      "name": "min",
      "in": "query",
      "required": true,
      "schema": {
       "type": "integer"
      }
     },
     {
      "name": "max",
      "in": "query",
      "required": true,
      "schema": {
       "type": "integer"
      }
     },
     {
      "name": "count",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "minimum": 1,
       "maximum": 1000,
       "default": 1
      }
     },
     {
      "name": "unique",
      "in": "query",
      "required": false,
      "schema": {
       "type": "boolean",
       "default": false
      }
     },
     {
      "name": "seed",
      "in": "query",
      "required": false,
      "description": "Optional. 64 hex characters. Give the seed of an earlier answer to get the same result again (that is how a draw is checked). Leave it out for a fresh draw.",
      "schema": {
       "type": "string",
       "pattern": "^[0-9a-fA-F]{64}$"
      }
     }
    ]
   },
   "post": {
    "operationId": "random_integer_post",
    "summary": "Random integers",
    "description": "Integers from min to max inclusive, 1 to 1000 of them, with or without repeats. The range may hold at most 2^32 values.",
    "responses": {
     "200": {
      "description": "The result."
     },
     "400": {
      "description": "An argument is wrong: {error: {code, message, field}}."
     },
     "503": {
      "description": "The source of past draws did not answer."
     }
    },
    "requestBody": {
     "required": false,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "min": {
          "type": "integer"
         },
         "max": {
          "type": "integer"
         },
         "count": {
          "type": "integer",
          "minimum": 1,
          "maximum": 1000,
          "default": 1
         },
         "unique": {
          "type": "boolean",
          "default": false
         },
         "seed": {
          "type": "string",
          "pattern": "^[0-9a-fA-F]{64}$",
          "description": "Optional. 64 hex characters. Give the seed of an earlier answer to get the same result again (that is how a draw is checked). Leave it out for a fresh draw."
         }
        },
        "required": [
         "min",
         "max"
        ],
        "additionalProperties": false
       }
      }
     }
    }
   }
  },
  "/api/v1/random/pick": {
   "get": {
    "operationId": "pick_from_list",
    "summary": "Pick from a list",
    "description": "Pick 1 or more items from a list of up to 1000, each equally likely. Without repeats by default.",
    "responses": {
     "200": {
      "description": "The result."
     },
     "400": {
      "description": "An argument is wrong: {error: {code, message, field}}."
     },
     "503": {
      "description": "The source of past draws did not answer."
     }
    },
    "parameters": [
     {
      "name": "items",
      "in": "query",
      "required": true,
      "schema": {
       "type": "array",
       "items": {
        "type": "string",
        "maxLength": 200
       }
      },
      "style": "form",
      "explode": false
     },
     {
      "name": "count",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "minimum": 1,
       "maximum": 1000,
       "default": 1
      }
     },
     {
      "name": "unique",
      "in": "query",
      "required": false,
      "schema": {
       "type": "boolean",
       "default": true
      }
     },
     {
      "name": "seed",
      "in": "query",
      "required": false,
      "description": "Optional. 64 hex characters. Give the seed of an earlier answer to get the same result again (that is how a draw is checked). Leave it out for a fresh draw.",
      "schema": {
       "type": "string",
       "pattern": "^[0-9a-fA-F]{64}$"
      }
     }
    ]
   },
   "post": {
    "operationId": "pick_from_list_post",
    "summary": "Pick from a list",
    "description": "Pick 1 or more items from a list of up to 1000, each equally likely. Without repeats by default.",
    "responses": {
     "200": {
      "description": "The result."
     },
     "400": {
      "description": "An argument is wrong: {error: {code, message, field}}."
     },
     "503": {
      "description": "The source of past draws did not answer."
     }
    },
    "requestBody": {
     "required": false,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "items": {
          "type": "array",
          "items": {
           "type": "string",
           "maxLength": 200
          },
          "minItems": 1,
          "maxItems": 1000
         },
         "count": {
          "type": "integer",
          "minimum": 1,
          "maximum": 1000,
          "default": 1
         },
         "unique": {
          "type": "boolean",
          "default": true
         },
         "seed": {
          "type": "string",
          "pattern": "^[0-9a-fA-F]{64}$",
          "description": "Optional. 64 hex characters. Give the seed of an earlier answer to get the same result again (that is how a draw is checked). Leave it out for a fresh draw."
         }
        },
        "required": [
         "items"
        ],
        "additionalProperties": false
       }
      }
     }
    }
   }
  },
  "/api/v1/random/shuffle": {
   "get": {
    "operationId": "shuffle_list",
    "summary": "Shuffle a list",
    "description": "Put up to 1000 items in a random order; every order is equally likely.",
    "responses": {
     "200": {
      "description": "The result."
     },
     "400": {
      "description": "An argument is wrong: {error: {code, message, field}}."
     },
     "503": {
      "description": "The source of past draws did not answer."
     }
    },
    "parameters": [
     {
      "name": "items",
      "in": "query",
      "required": true,
      "schema": {
       "type": "array",
       "items": {
        "type": "string",
        "maxLength": 200
       }
      },
      "style": "form",
      "explode": false
     },
     {
      "name": "seed",
      "in": "query",
      "required": false,
      "description": "Optional. 64 hex characters. Give the seed of an earlier answer to get the same result again (that is how a draw is checked). Leave it out for a fresh draw.",
      "schema": {
       "type": "string",
       "pattern": "^[0-9a-fA-F]{64}$"
      }
     }
    ]
   },
   "post": {
    "operationId": "shuffle_list_post",
    "summary": "Shuffle a list",
    "description": "Put up to 1000 items in a random order; every order is equally likely.",
    "responses": {
     "200": {
      "description": "The result."
     },
     "400": {
      "description": "An argument is wrong: {error: {code, message, field}}."
     },
     "503": {
      "description": "The source of past draws did not answer."
     }
    },
    "requestBody": {
     "required": false,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "items": {
          "type": "array",
          "items": {
           "type": "string",
           "maxLength": 200
          },
          "minItems": 1,
          "maxItems": 1000
         },
         "seed": {
          "type": "string",
          "pattern": "^[0-9a-fA-F]{64}$",
          "description": "Optional. 64 hex characters. Give the seed of an earlier answer to get the same result again (that is how a draw is checked). Leave it out for a fresh draw."
         }
        },
        "required": [
         "items"
        ],
        "additionalProperties": false
       }
      }
     }
    }
   }
  }
 }
}