{
  "openapi": "3.1.0",
  "info": {
    "title": "DocScout API",
    "version": "1.0.0",
    "summary": "Audit API documentation for LLM and AI-agent readiness.",
    "description": "Free, unauthenticated, rate-limited endpoint behind the audit on getdocscout.com. Human-readable reference: https://getdocscout.com/docs/api",
    "contact": {
      "email": "hola@getdocscout.com",
      "url": "https://getdocscout.com/contact"
    },
    "termsOfService": "https://getdocscout.com/terms"
  },
  "servers": [
    {
      "url": "https://getdocscout.com"
    }
  ],
  "externalDocs": {
    "url": "https://getdocscout.com/docs/api",
    "description": "API reference"
  },
  "paths": {
    "/api/audit": {
      "post": {
        "operationId": "runAudit",
        "summary": "Audit a documentation URL",
        "tags": [
          "Audit"
        ],
        "description": "Crawls the URL plus up to 8 linked docs pages, discovers llms.txt and OpenAPI specs, checks links, and returns a 0-100 score across six dimensions with the top 3 alerts. Takes 20-60 s. Results are cached for 24 h per normalized URL. No authentication. Limits: 3 audits per IP per day, a per-network cap, and a global daily cap; limits reset 00:00 UTC. Cached results don't count toward your limit.",
        "security": [],
        "x-ratelimit": {
          "perIp": {
            "limit": 3,
            "window": "1d"
          },
          "perNetwork": {
            "limit": 8,
            "window": "1d",
            "scope": "/24 IPv4, /64 IPv6"
          },
          "global": {
            "window": "1d"
          },
          "reset": "00:00 UTC",
          "cachedResponsesCount": false
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri",
                    "description": "Public http(s) URL of your API docs.",
                    "example": "https://docs.stripe.com/api"
                  }
                }
              },
              "example": {
                "url": "https://docs.stripe.com/api"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Audit result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuditResult"
                },
                "example": {
                  "url": "https://docs.example.com/api",
                  "overall": 72,
                  "summary": "Solid reference with an OpenAPI spec; no llms.txt and two broken links.",
                  "dimensions": [
                    {
                      "key": "machine_readability",
                      "label": "Machine Readability",
                      "score": 55,
                      "rationale": "OpenAPI spec found, but no /llms.txt."
                    }
                  ],
                  "alerts": [
                    {
                      "severity": "high",
                      "title": "No llms.txt found",
                      "fix": "Publish /llms.txt listing your key docs pages.",
                      "status": "confirmed",
                      "evidence": {
                        "url": "https://docs.example.com/llms.txt",
                        "quote": "404 Not Found",
                        "confidence": "high",
                        "verified": true
                      }
                    }
                  ],
                  "signals": {
                    "llms_txt": false,
                    "llms_full_txt": false,
                    "openapi_found": true,
                    "pages_analyzed": 8
                  },
                  "cached": false,
                  "auditedAt": "2026-10-10T20:00:00.000Z"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or non-public URL.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "Please enter a valid http(s) URL."
                }
              }
            }
          },
          "422": {
            "description": "The page could not be read (not public, or blocked).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "Could not read that page. Is it public?"
                }
              }
            }
          },
          "429": {
            "x-ratelimit-policy": {
              "perIp": "3/day",
              "perNetwork24": "8/day",
              "global": "daily cap",
              "reset": "00:00 UTC"
            },
            "description": "Rate limited. `code` is `ip_limit`, `net_limit` or `daily_cap`. Honor the `Retry-After` header (seconds until 00:00 UTC).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "You've used your 3 free audits for today. Come back tomorrow, or see the Fix Report for a full audit.",
                  "code": "ip_limit"
                }
              }
            }
          },
          "502": {
            "description": "Scoring failed upstream. Safe to retry once; failed audits don't count toward your limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "Scoring failed. Try again."
                }
              }
            }
          },
          "503": {
            "description": "Free audits are temporarily paused (`code: paused`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "Free audits are paused right now. Please try again later.",
                  "code": "paused"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string",
            "description": "Human-readable message."
          },
          "code": {
            "type": "string",
            "enum": [
              "ip_limit",
              "net_limit",
              "daily_cap",
              "paused"
            ]
          }
        }
      },
      "Evidence": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "quote": {
            "type": "string",
            "description": "Snippet quoted from the fetched page."
          },
          "status": {
            "type": "integer",
            "description": "HTTP status, for link findings."
          },
          "confidence": {
            "type": "string",
            "enum": [
              "high",
              "medium",
              "low"
            ]
          },
          "verified": {
            "type": "boolean",
            "description": "True if the quote was found in the fetched text."
          }
        }
      },
      "Alert": {
        "type": "object",
        "required": [
          "severity",
          "title",
          "fix",
          "status"
        ],
        "properties": {
          "severity": {
            "type": "string",
            "enum": [
              "high",
              "medium",
              "low"
            ]
          },
          "title": {
            "type": "string",
            "example": "No llms.txt found"
          },
          "fix": {
            "type": "string",
            "description": "Concrete recommended fix."
          },
          "status": {
            "type": "string",
            "enum": [
              "confirmed",
              "to_verify"
            ],
            "description": "`to_verify` when the evidence could not be independently matched against fetched content."
          },
          "evidence": {
            "$ref": "#/components/schemas/Evidence"
          }
        }
      },
      "Dimension": {
        "type": "object",
        "required": [
          "key",
          "label",
          "score"
        ],
        "properties": {
          "key": {
            "type": "string",
            "enum": [
              "structure",
              "code_examples",
              "reference_completeness",
              "machine_readability",
              "auth_errors",
              "freshness_versioning"
            ]
          },
          "label": {
            "type": "string"
          },
          "score": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "rationale": {
            "type": "string"
          }
        }
      },
      "AuditResult": {
        "type": "object",
        "required": [
          "url",
          "overall",
          "dimensions",
          "alerts"
        ],
        "properties": {
          "url": {
            "type": "string"
          },
          "overall": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "summary": {
            "type": "string"
          },
          "dimensions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Dimension"
            },
            "description": "Always six items, one per dimension (example truncated)."
          },
          "alerts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Alert"
            },
            "maxItems": 3
          },
          "checks": {
            "type": "object",
            "description": "Raw deterministic checks: OpenAPI discovery hits, link check results, unreadable pages."
          },
          "signals": {
            "type": "object",
            "properties": {
              "llms_txt": {
                "type": "boolean"
              },
              "llms_full_txt": {
                "type": "boolean"
              },
              "openapi_found": {
                "type": "boolean"
              },
              "openapi_files": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "pages_analyzed": {
                "type": "integer"
              }
            }
          },
          "pages": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "url": {
                  "type": "string"
                },
                "chars": {
                  "type": "integer"
                },
                "readable": {
                  "type": "boolean"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "cached": {
            "type": "boolean"
          },
          "auditedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      }
    }
  }
}