{
  "openapi": "3.0.0",
  "info": {
    "title": "llms.txt Validator API",
    "version": "2.3.0",
    "description": "Validate and analyze llms.txt files with deep link checking and comprehensive statistics. This API validates llms.txt files according to the specification at https://llmstxt.org, checking content types, link validity, and providing detailed token-based size metrics. Uses concurrent link checking with a maximum of 6 simultaneous requests. Automatically ignores links to llms-full.txt on the same hostname."
  },
  "servers": [
    {
      "url": "https://check.llmtext.com",
      "description": "Production server"
    }
  ],
  "paths": {
    "/check": {
      "get": {
        "summary": "Validate and analyze an llms.txt file",
        "description": "Validates an llms.txt file by checking its structure, content type, and all linked documents using a concurrent queue (max 6 simultaneous requests). Returns comprehensive statistics including token counts, link validity percentages, content type analysis, and detailed failure reasons for invalid links. The validator ensures all requirements of the llms.txt specification are met. Links to llms-full.txt on the same hostname are automatically ignored.",
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": true,
            "description": "Full URL of the llms.txt file to validate. Must use HTTPS protocol and end with /llms.txt path.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://example.com/llms.txt"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum number of links to randomly sample and check from the llms.txt file. Used to limit validation time for files with many links. Default: 50, Maximum: 500",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Validation completed successfully. Returns validation status, any errors or warnings, parsed content, detailed metadata about the file and its links, and failure reasons for invalid links.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationResult"
                }
              }
            }
          },
          "400": {
            "description": "Bad request - invalid URL parameter or limit value provided",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "valid": {
                      "type": "boolean",
                      "example": false
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "example": [
                        "URL parameter is required"
                      ]
                    },
                    "warnings": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ValidationResult": {
        "type": "object",
        "required": [
          "valid",
          "errors",
          "warnings",
          "metadata"
        ],
        "properties": {
          "valid": {
            "type": "boolean",
            "description": "Overall validation status. False if any errors are present, including invalid content types, oversized documents, or insufficient valid link percentage."
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "List of validation errors that prevent the file from being considered valid. Includes issues like invalid URLs, wrong content types, oversized documents, and insufficient valid links."
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "List of non-critical issues or suggestions for improvement, such as missing descriptions or details sections."
          },
          "parsed": {
            "type": "object",
            "nullable": true,
            "description": "Parsed structure of the llms.txt file if parsing was successful. Null if parsing failed."
          },
          "metadata": {
            "type": "object",
            "required": [
              "sizeTokens",
              "contentType",
              "linkCount",
              "tokensInLlmsTxt",
              "checkedLinkCount",
              "ignoredLinkCount",
              "validLinkCount",
              "validPercentage",
              "textPlainOrMarkdownCount",
              "otherContentTypeCount",
              "sectionCount",
              "avgDescriptionLength",
              "hasDescription",
              "hasDetails",
              "linkResults"
            ],
            "properties": {
              "sizeTokens": {
                "type": "integer",
                "description": "Size of the llms.txt file in tokens (calculated as bytes/5, rounded up)",
                "example": 2048
              },
              "contentType": {
                "type": "string",
                "description": "Content-Type header returned by the server for the llms.txt file",
                "example": "text/plain; charset=utf-8"
              },
              "linkCount": {
                "type": "integer",
                "description": "Total number of links found in the llms.txt file",
                "example": 15
              },
              "tokensInLlmsTxt": {
                "type": "integer",
                "description": "Estimated token count of the llms.txt file content (length/5, rounded)",
                "example": 1024
              },
              "checkedLinkCount": {
                "type": "integer",
                "description": "Number of links actually checked (may be less than total if limit parameter was used or links were ignored)",
                "example": 15
              },
              "ignoredLinkCount": {
                "type": "integer",
                "description": "Number of links ignored (llms-full.txt on same hostname)",
                "example": 1
              },
              "validLinkCount": {
                "type": "integer",
                "description": "Number of checked links that returned valid markdown/text content under 100k tokens",
                "example": 14
              },
              "validPercentage": {
                "type": "number",
                "format": "float",
                "description": "Percentage of checked links that were valid. Must be 100% for overall validation to pass.",
                "example": 93.33
              },
              "textPlainOrMarkdownCount": {
                "type": "integer",
                "description": "Number of links that returned text/plain or text/markdown content types",
                "example": 14
              },
              "otherContentTypeCount": {
                "type": "integer",
                "description": "Number of links that returned other content types (considered invalid)",
                "example": 1
              },
              "minLinkedDocTokens": {
                "type": "integer",
                "nullable": true,
                "description": "Smallest token count among all valid linked documents. Null if no valid links.",
                "example": 512
              },
              "maxLinkedDocTokens": {
                "type": "integer",
                "nullable": true,
                "description": "Largest token count among all valid linked documents. Null if no valid links. Documents over 20000 tokens trigger an error.",
                "example": 8192
              },
              "avgLinkedDocTokens": {
                "type": "number",
                "format": "float",
                "nullable": true,
                "description": "Average token count across all valid linked documents. Null if no valid links.",
                "example": 3456.5
              },
              "sectionCount": {
                "type": "integer",
                "description": "Number of sections in the llms.txt file",
                "example": 3
              },
              "avgDescriptionLength": {
                "type": "integer",
                "description": "Average length of file descriptions/notes in tokens across all sections",
                "example": 128
              },
              "hasDescription": {
                "type": "boolean",
                "description": "Whether the llms.txt file includes a top-level description. Warning issued if false.",
                "example": true
              },
              "hasDetails": {
                "type": "boolean",
                "description": "Whether the llms.txt file includes a details section. Warning issued if false.",
                "example": true
              },
              "linkResults": {
                "type": "array",
                "description": "Detailed results for each checked link including validity, token count, content type, and failure reason if invalid",
                "items": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    },
                    "valid": {
                      "type": "boolean"
                    },
                    "tokens": {
                      "type": "integer"
                    },
                    "contentType": {
                      "type": "string"
                    },
                    "failReason": {
                      "type": "string"
                    },
                    "ignored": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}