{
  "openapi": "3.1.0",
  "info": {
    "title": "Agent Ready API",
    "version": "1.0.0",
    "description": "Scan a public website or a public GitHub repository and read the report as JSON. Every finding carries its evidence. No key is needed; requests are rate limited per address."
  },
  "servers": [
    {
      "url": "https://makeagentready.tech"
    }
  ],
  "paths": {
    "/api/v1/site": {
      "get": {
        "summary": "Scan a website",
        "description": "Reads a public website the way an AI answer crawler does and returns a 0 to 100 score with every check, its evidence and its fix. A scan from the last ten minutes is reused.",
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "A website, like makeagentready.tech."
          },
          {
            "name": "force",
            "in": "query",
            "schema": {
              "type": "boolean"
            },
            "description": "Scan again instead of reusing a recent scan."
          },
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "text"
              ]
            },
            "description": "text returns a plain-text report."
          },
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "saas",
                "publisher",
                "shop",
                "local",
                "docs",
                "personal",
                "other"
              ],
              "description": "What kind of site it is. Leave out to detect it."
            }
          },
          {
            "name": "files",
            "in": "query",
            "schema": {
              "type": "boolean",
              "description": "Include the full text of each generated fix file."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The report.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SiteReport"
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found, or a private repository.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The address cannot be scanned.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. Wait for the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "The target or GitHub could not be reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Scan a website (JSON body)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string"
                  },
                  "force": {
                    "type": "boolean"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "saas",
                      "publisher",
                      "shop",
                      "local",
                      "docs",
                      "personal",
                      "other"
                    ],
                    "description": "What kind of site it is. Leave out to detect it."
                  },
                  "files": {
                    "type": "boolean",
                    "description": "Include the full text of each generated fix file."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The report.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SiteReport"
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found, or a private repository.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The address cannot be scanned.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. Wait for the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "The target or GitHub could not be reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/repo": {
      "get": {
        "summary": "Scan a GitHub repository",
        "description": "Reads a public repository the way a coding agent does and returns findings with file, line and quote. Waits for the scan, which can take up to two minutes; a scan of the same commit is instant.",
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "owner/repo or a GitHub URL, optionally ending in /tree/<branch>/<directory>."
          },
          {
            "name": "force",
            "in": "query",
            "schema": {
              "type": "boolean"
            },
            "description": "Scan again instead of reusing a recent scan."
          },
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "text"
              ]
            },
            "description": "text returns a plain-text report."
          }
        ],
        "responses": {
          "200": {
            "description": "The report.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RepoReport"
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found, or a private repository.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The address cannot be scanned.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. Wait for the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "The target or GitHub could not be reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Scan a GitHub repository (JSON body)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string"
                  },
                  "force": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The report.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RepoReport"
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found, or a private repository.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The address cannot be scanned.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. Wait for the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "The target or GitHub could not be reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/checks": {
      "get": {
        "summary": "List the checks",
        "parameters": [
          {
            "name": "kind",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "website",
                "repository"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Every check and the scoring rules."
          },
          "400": {
            "description": "The request was malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/checks/{id}": {
      "get": {
        "summary": "One check",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "For example AW301 or AR201."
          }
        ],
        "responses": {
          "200": {
            "description": "The check."
          },
          "404": {
            "description": "Not found, or a private repository.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "ok",
          "error"
        ],
        "properties": {
          "ok": {
            "const": false
          },
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "bad_request",
                  "invalid_url",
                  "not_found",
                  "rate_limited",
                  "busy",
                  "unreachable",
                  "blocked",
                  "upstream",
                  "failed"
                ]
              },
              "message": {
                "type": "string"
              },
              "retryAfterSec": {
                "type": "integer"
              }
            }
          }
        }
      },
      "SiteReport": {
        "type": "object",
        "description": "A website report. Check statuses are pass, warn, fail, info or na.",
        "required": [
          "ok",
          "kind",
          "host",
          "score",
          "checks"
        ],
        "properties": {
          "ok": {
            "const": true
          },
          "kind": {
            "const": "website"
          },
          "host": {
            "type": "string"
          },
          "scannedAt": {
            "type": "string",
            "format": "date-time"
          },
          "cached": {
            "type": "boolean"
          },
          "score": {
            "type": "object",
            "properties": {
              "value": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              },
              "grade": {
                "type": "string",
                "enum": [
                  "A",
                  "B",
                  "C",
                  "D",
                  "F"
                ]
              }
            }
          },
          "potential": {
            "type": "integer"
          },
          "verdict": {
            "type": "string"
          },
          "topFixes": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "checks": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "title",
                "status"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "title": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                },
                "gain": {
                  "type": "number"
                },
                "detail": {
                  "type": "string"
                },
                "why": {
                  "type": "string"
                }
              }
            }
          },
          "reportUrl": {
            "type": "string",
            "format": "uri"
          },
          "badgeUrl": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "RepoReport": {
        "type": "object",
        "required": [
          "ok",
          "kind",
          "repo",
          "commit",
          "score",
          "findings"
        ],
        "properties": {
          "ok": {
            "const": true
          },
          "kind": {
            "const": "repository"
          },
          "repo": {
            "type": "string"
          },
          "commit": {
            "type": "string"
          },
          "cached": {
            "type": "boolean"
          },
          "score": {
            "type": "object",
            "properties": {
              "value": {
                "type": "integer"
              },
              "grade": {
                "type": "string"
              },
              "cappedByCritical": {
                "type": "boolean"
              }
            }
          },
          "findings": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "checkId",
                "severity",
                "title",
                "evidence"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "checkId": {
                  "type": "string"
                },
                "severity": {
                  "type": "string",
                  "enum": [
                    "critical",
                    "high",
                    "medium",
                    "low"
                  ]
                },
                "title": {
                  "type": "string"
                },
                "why": {
                  "type": "string"
                },
                "evidence": {
                  "type": "array",
                  "items": {
                    "type": "object"
                  }
                }
              }
            }
          },
          "reportUrl": {
            "type": "string",
            "format": "uri"
          },
          "badgeUrl": {
            "type": "string",
            "format": "uri"
          }
        }
      }
    }
  }
}
