{
  "openapi": "3.1.0",
  "info": {
    "title": "getrandomness API",
    "version": "0.1.0",
    "description": "A tiny agent-facing API for curated randomness. Public request paths return prepared corpus items and do not call live upstream providers."
  },
  "servers": [
    {
      "url": "https://getrandomness.com"
    }
  ],
  "paths": {
    "/wikipedia": {
      "get": {
        "operationId": "getWikipedia",
        "summary": "Get a random cleaned Wikipedia page",
        "description": "Returns one prepared Wikipedia page as Markdown in a JSON response.",
        "parameters": [
          {
            "name": "max_bytes",
            "in": "query",
            "required": false,
            "description": "Optional UTF-8 byte limit for the content field.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 32768,
              "default": 16384
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A random Wikipedia page.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WikipediaResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      },
      "head": {
        "operationId": "headWikipedia",
        "summary": "Check /wikipedia headers without a body",
        "responses": {
          "200": {
            "$ref": "#/components/responses/HeadOKJSONNoStore"
          }
        }
      }
    },
    "/wikipedia/info": {
      "get": {
        "operationId": "getWikipediaInfo",
        "summary": "Get plain-text /wikipedia documentation",
        "responses": {
          "200": {
            "$ref": "#/components/responses/PlainTextOK"
          }
        }
      },
      "head": {
        "operationId": "headWikipediaInfo",
        "summary": "Check /wikipedia/info headers without a body",
        "responses": {
          "200": {
            "$ref": "#/components/responses/HeadOKTextCached"
          }
        }
      }
    },
    "/font-pair": {
      "get": {
        "operationId": "getFontPair",
        "summary": "Get a coherent heading and body font pair",
        "responses": {
          "200": {
            "description": "A font pair.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FontPairResponse"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      },
      "head": {
        "operationId": "headFontPair",
        "summary": "Check /font-pair headers without a body",
        "responses": {
          "200": {
            "$ref": "#/components/responses/HeadOKJSONNoStore"
          }
        }
      }
    },
    "/font-pair/info": {
      "get": {
        "operationId": "getFontPairInfo",
        "summary": "Get plain-text /font-pair documentation",
        "responses": {
          "200": {
            "$ref": "#/components/responses/PlainTextOK"
          }
        }
      },
      "head": {
        "operationId": "headFontPairInfo",
        "summary": "Check /font-pair/info headers without a body",
        "responses": {
          "200": {
            "$ref": "#/components/responses/HeadOKTextCached"
          }
        }
      }
    },
    "/palette": {
      "get": {
        "operationId": "getPalette",
        "summary": "Get a coherent five-color palette",
        "parameters": [
          {
            "name": "color",
            "in": "query",
            "required": false,
            "description": "Optional #rrggbb seed color. URL-encode # as %23.",
            "schema": {
              "type": "string",
              "pattern": "^#[0-9a-fA-F]{6}$",
              "examples": [
                "#3366ff"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A coherent five-color palette.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaletteResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      },
      "head": {
        "operationId": "headPalette",
        "summary": "Check /palette headers without a body",
        "responses": {
          "200": {
            "$ref": "#/components/responses/HeadOKJSONNoStore"
          }
        }
      }
    },
    "/palette/info": {
      "get": {
        "operationId": "getPaletteInfo",
        "summary": "Get plain-text /palette documentation",
        "responses": {
          "200": {
            "$ref": "#/components/responses/PlainTextOK"
          }
        }
      },
      "head": {
        "operationId": "headPaletteInfo",
        "summary": "Check /palette/info headers without a body",
        "responses": {
          "200": {
            "$ref": "#/components/responses/HeadOKTextCached"
          }
        }
      }
    },
    "/llms.txt": {
      "get": {
        "operationId": "getLLMsTxt",
        "summary": "Get agent-readable site documentation",
        "responses": {
          "200": {
            "$ref": "#/components/responses/PlainTextOK"
          }
        }
      },
      "head": {
        "operationId": "headLLMsTxt",
        "summary": "Check /llms.txt headers without a body",
        "responses": {
          "200": {
            "$ref": "#/components/responses/HeadOKTextCached"
          }
        }
      }
    },
    "/openapi.json": {
      "get": {
        "operationId": "getOpenAPI",
        "summary": "Get this OpenAPI description",
        "responses": {
          "200": {
            "description": "OpenAPI 3.1 document.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      },
      "head": {
        "operationId": "headOpenAPI",
        "summary": "Check /openapi.json headers without a body",
        "responses": {
          "200": {
            "$ref": "#/components/responses/HeadOKJSONCached"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "WikipediaResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "content",
          "source",
          "truncated"
        ],
        "properties": {
          "content": {
            "type": "string",
            "description": "Cleaned Markdown text."
          },
          "source": {
            "$ref": "#/components/schemas/WikipediaSource"
          },
          "truncated": {
            "type": "boolean"
          }
        }
      },
      "WikipediaSource": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "title",
          "url",
          "revision_url",
          "license",
          "attribution"
        ],
        "properties": {
          "name": {
            "type": "string",
            "examples": [
              "Wikipedia"
            ]
          },
          "title": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "revision_url": {
            "type": "string",
            "format": "uri"
          },
          "license": {
            "type": "string"
          },
          "attribution": {
            "type": "string"
          }
        }
      },
      "FontPairResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "heading_font",
          "heading_url",
          "body_font",
          "body_url"
        ],
        "properties": {
          "heading_font": {
            "type": "string"
          },
          "heading_url": {
            "type": "string",
            "format": "uri"
          },
          "body_font": {
            "type": "string"
          },
          "body_url": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "PaletteResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "colors"
        ],
        "properties": {
          "colors": {
            "type": "array",
            "minItems": 5,
            "maxItems": 5,
            "items": {
              "type": "string",
              "pattern": "^#[0-9a-f]{6}$"
            }
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Invalid request.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "Unavailable": {
        "description": "Corpus unavailable or service overloaded.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "PlainTextOK": {
        "description": "Plain-text documentation.",
        "content": {
          "text/plain": {
            "schema": {
              "type": "string"
            }
          }
        }
      },
      "HeadOKJSONNoStore": {
        "description": "Headers only. No response body.",
        "headers": {
          "Cache-Control": {
            "schema": {
              "type": "string",
              "const": "no-store"
            }
          }
        }
      },
      "HeadOKTextCached": {
        "description": "Headers only. No response body.",
        "headers": {
          "Cache-Control": {
            "schema": {
              "type": "string",
              "const": "public, max-age=300"
            }
          }
        }
      },
      "HeadOKJSONCached": {
        "description": "Headers only. No response body.",
        "headers": {
          "Cache-Control": {
            "schema": {
              "type": "string",
              "const": "public, max-age=300"
            }
          }
        }
      }
    }
  }
}
