{
  "openapi": "3.1.0",
  "info": {
    "title": "rdrand.com",
    "version": "2.0.0",
    "summary": "Free hardware random numbers from Intel and AMD RDRAND.",
    "description": "Random keys, bytes and integers (and, just for fun, coin flips and Magic 8 Ball answers) from the RDRAND instruction of the servers' CPUs. No sign-up and no API key. All endpoints are POST only and return the value itself as the response body (plain text, although labelled text/html). CORS is open: every response, errors included, carries `Access-Control-Allow-Origin: *`, and preflight (OPTIONS) requests are answered. Full documentation: https://rdrand.com/llms-full.txt",
    "contact": { "name": "JebteK, LLC", "url": "https://rdrand.com/", "email": "support@jebtek.freshdesk.com" },
    "license": { "name": "MIT", "identifier": "MIT" }
  },
  "servers": [{ "url": "https://rdrand.com/API" }],
  "externalDocs": { "description": "Full documentation (Markdown)", "url": "https://rdrand.com/llms-full.txt" },
  "paths": {
    "/GenerateKey": {
      "post": {
        "operationId": "generateKey",
        "summary": "Random key string",
        "description": "Returns `length` characters, each drawn uniformly from the 63 symbols 0-9, A-Z, underscore and a-z. Suitable for keys, tokens and identifiers.",
        "parameters": [{ "$ref": "#/components/parameters/LengthQuery" }],
        "requestBody": { "$ref": "#/components/requestBodies/Length" },
        "responses": {
          "200": {
            "description": "The random key. Empty (with no Content-Type) when length is 0.",
            "headers": { "Access-Control-Allow-Origin": { "$ref": "#/components/headers/Cors" } },
            "content": {
              "text/html": {
                "schema": { "type": "string", "pattern": "^[0-9A-Z_a-z]*$", "maxLength": 16777216 },
                "example": "kq9ZLx0tuE3_Wb7cRmN2pQ8sVd1yHf4j"
              }
            }
          },
          "500": { "$ref": "#/components/responses/Error" }
        }
      }
    },
    "/GenerateBytes": {
      "post": {
        "operationId": "generateBytes",
        "summary": "Random bytes (base64)",
        "description": "Returns `length` random bytes encoded as standard base64 (RFC 4648, with = padding).",
        "parameters": [{ "$ref": "#/components/parameters/LengthQuery" }],
        "requestBody": { "$ref": "#/components/requestBodies/Length" },
        "responses": {
          "200": {
            "description": "The random bytes, base64 encoded. Empty (with no Content-Type) when length is 0.",
            "headers": { "Access-Control-Allow-Origin": { "$ref": "#/components/headers/Cors" } },
            "content": {
              "text/html": {
                "schema": { "type": "string", "contentEncoding": "base64" },
                "example": "q83vEjRWeJCrze8SNFZ4kA=="
              }
            }
          },
          "500": { "$ref": "#/components/responses/Error" }
        }
      }
    },
    "/GenerateUInt": {
      "post": {
        "operationId": "generateUInt",
        "summary": "Random 31-bit integer",
        "description": "Returns a random integer from 0 to 2147483647 as decimal text. Takes no parameters; send an empty body.",
        "responses": {
          "200": {
            "description": "The random integer as decimal text.",
            "headers": { "Access-Control-Allow-Origin": { "$ref": "#/components/headers/Cors" } },
            "content": {
              "text/html": {
                "schema": { "type": "string", "pattern": "^[0-9]{1,10}$", "description": "Decimal integer, 0 to 2147483647." },
                "example": "1840615727"
              }
            }
          },
          "500": { "$ref": "#/components/responses/Error" }
        }
      }
    },
    "/FlipCoin": {
      "post": {
        "operationId": "flipCoin",
        "summary": "Flip a coin (just for fun)",
        "description": "Returns `Heads` or `Tails`, each with probability 1/2. Takes no parameters; send an empty body.",
        "responses": {
          "200": {
            "description": "The side the coin landed on.",
            "headers": { "Access-Control-Allow-Origin": { "$ref": "#/components/headers/Cors" } },
            "content": {
              "text/html": {
                "schema": { "type": "string", "enum": ["Heads", "Tails"] },
                "example": "Heads"
              }
            }
          },
          "500": { "$ref": "#/components/responses/Error" }
        }
      }
    },
    "/Magic8Ball": {
      "post": {
        "operationId": "magic8Ball",
        "summary": "Ask the Magic 8 Ball (just for fun)",
        "description": "Returns one of the 20 classic Magic 8 Ball answers, chosen uniformly: 10 yes, 5 non-committal, 5 no. A `question` may be sent; it does not affect the answer.",
        "requestBody": {
          "required": false,
          "description": "Optional. The question is read and ignored, as the 8 Ball would.",
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": { "type": "object", "properties": { "question": { "type": "string" } } },
              "example": { "question": "Will it ship on Friday?" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The answer, with no trailing punctuation.",
            "headers": { "Access-Control-Allow-Origin": { "$ref": "#/components/headers/Cors" } },
            "content": {
              "text/html": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "It is certain",
                    "It is decidedly so",
                    "Without a doubt",
                    "Yes, definitely",
                    "You may rely on it",
                    "As I see it, yes",
                    "Most likely",
                    "Outlook good",
                    "Yes",
                    "Signs point to yes",
                    "Reply hazy, try again",
                    "Ask again later",
                    "Better not tell you now",
                    "Cannot predict now",
                    "Concentrate and ask again",
                    "Don't count on it",
                    "My reply is no",
                    "My sources say no",
                    "Outlook not so good",
                    "Very doubtful"
                  ]
                },
                "example": "Signs point to yes"
              }
            }
          },
          "500": { "$ref": "#/components/responses/Error" }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Length": {
        "type": "integer",
        "minimum": 0,
        "maximum": 16777216,
        "description": "Number of characters (GenerateKey) or bytes (GenerateBytes)."
      },
      "LengthRequest": {
        "type": "object",
        "properties": { "length": { "$ref": "#/components/schemas/Length" } },
        "required": ["length"]
      }
    },
    "parameters": {
      "LengthQuery": {
        "name": "length",
        "in": "query",
        "required": false,
        "description": "Alternative to sending `length` in the body. If both are present, the body wins.",
        "schema": { "$ref": "#/components/schemas/Length" }
      }
    },
    "requestBodies": {
      "Length": {
        "required": false,
        "description": "`length` as a form field (recommended) or a JSON object. Required here unless given in the query string.",
        "content": {
          "application/x-www-form-urlencoded": {
            "schema": { "$ref": "#/components/schemas/LengthRequest" },
            "example": { "length": 32 }
          },
          "application/json": {
            "schema": { "$ref": "#/components/schemas/LengthRequest" },
            "example": { "length": 32 }
          }
        }
      }
    },
    "headers": {
      "Cors": { "description": "Always `*`.", "schema": { "type": "string", "const": "*" } }
    },
    "responses": {
      "Error": {
        "description": "Missing, invalid, negative or too-large `length`, or a malformed JSON body. The body is an HTML error page; do not parse it.",
        "content": { "text/html": { "schema": { "type": "string" } } }
      }
    }
  }
}
