{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/pageaudit/json-schema/pageaudit-audit-schema.json",
  "title": "Audit",
  "description": "The report of one audit: score, findings and everything observed on the page.",
  "x-generated": "2026-11-26",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/pageaudit-audit-api-openapi.yml#/components/schemas/Audit",
  "type": "object",
  "properties": {
    "id": {
      "type": [
        "string",
        "null"
      ],
      "description": "ID of the stored audit; `null` when the database was unavailable."
    },
    "score": {
      "type": "integer",
      "description": "Score from 0 to 100, computed from the findings below."
    },
    "issues": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Achado"
      },
      "description": "Everything found, from most to least severe."
    },
    "summary": {
      "allOf": [
        {
          "$ref": "#/$defs/ResumoPagina"
        }
      ],
      "description": "What the page declares: title, meta, canonical, OG, headings, links…"
    },
    "counts": {
      "allOf": [
        {
          "$ref": "#/$defs/ContagemAchados"
        }
      ],
      "description": "How many findings of each severity."
    },
    "headers": {
      "type": "object",
      "description": "Every header of the target's response. `Set-Cookie` is removed on purpose: it is a third party's credential."
    },
    "htmlTruncated": {
      "type": "boolean",
      "description": "`true` when the page passed 2 MB and was read only that far."
    },
    "jsonLd": {
      "type": "array",
      "items": {
        "type": "object"
      },
      "description": "The raw JSON-LD blocks, as they were on the page."
    },
    "jsonLdStored": {
      "type": "integer",
      "description": "How many blocks survived the size cap — compare with `summary.jsonLdBlocks`."
    },
    "truncated": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "What was cut and why: `jsonld_size`, `jsonld_nodes_over_50`, `result_size`. Empty means nothing cut."
    },
    "fixes": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Correcao"
      },
      "description": "The ready fix of each finding, without a model — paste, fill in or decide. The consolidated one is at `_links.patch`."
    },
    "quota": {
      "allOf": [
        {
          "$ref": "#/$defs/CotaAudit"
        }
      ],
      "description": "How much is still free and what it costs past that."
    },
    "_links": {
      "allOf": [
        {
          "$ref": "#/$defs/LinksAudit"
        }
      ],
      "description": "This audit, the patch, the share and the API index."
    }
  },
  "required": [
    "id",
    "score",
    "issues",
    "summary",
    "counts",
    "headers",
    "htmlTruncated",
    "jsonLd",
    "jsonLdStored",
    "truncated",
    "fixes",
    "quota",
    "_links"
  ],
  "$defs": {
    "Achado": {
      "type": "object",
      "properties": {
        "severity": {
          "type": "string",
          "description": "Severity of the finding."
        },
        "code": {
          "type": "string",
          "description": "Stable check code, e.g. `title_missing`. It is what you filter by."
        },
        "message": {
          "type": "string",
          "description": "The finding in one sentence, ready to show a person."
        }
      },
      "required": [
        "severity",
        "code",
        "message"
      ],
      "description": "A problem (or a pass) found on the page."
    },
    "ContagemAchados": {
      "type": "object",
      "properties": {
        "errors": {
          "type": "integer",
          "description": "Serious findings."
        },
        "warnings": {
          "type": "integer",
          "description": "Findings that deserve attention."
        },
        "info": {
          "type": "integer",
          "description": "Observations without severity."
        }
      },
      "required": [
        "errors",
        "warnings",
        "info"
      ],
      "description": "How many findings of each severity — the summary that fits in a badge."
    },
    "Correcao": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string",
          "description": "The same `code` as the finding (`Achado.code`)."
        },
        "severity": {
          "type": "string",
          "description": "Severity of the source finding."
        },
        "classe": {
          "type": "string",
          "description": "`deterministico` comes whole from the page; `molde` has a `{{…}}` placeholder; `sem_patch` is an instruction."
        },
        "alvo": {
          "type": "string",
          "description": "Where to apply: `head`, `corpo`, `img`, `arquivo` or `pagina` (instruction)."
        },
        "snippet": {
          "type": [
            "string",
            "null"
          ],
          "description": "The ready tag (or with a placeholder). `null` for files and for `sem_patch`."
        },
        "arquivo": {
          "type": [
            "object",
            "null"
          ],
          "description": "`path` and `conteudo` when the fix is a file at the host root."
        },
        "fonte": {
          "type": [
            "string",
            "null"
          ],
          "description": "Where the value came from, or what the page already had (for the template or to check the cut)."
        },
        "nota": {
          "type": [
            "string",
            "null"
          ],
          "description": "How to apply, or what to decide."
        }
      },
      "required": [
        "code",
        "severity",
        "classe",
        "alvo",
        "snippet",
        "arquivo",
        "fonte",
        "nota"
      ],
      "description": "The ready fix of one finding. `classe` says whether it is to paste, to fill in or to decide."
    },
    "CotaAudit": {
      "type": "object",
      "properties": {
        "free_per_day": {
          "type": "integer",
          "description": "Free audits per IP per day."
        },
        "price_usd": {
          "type": "number",
          "description": "Price of an audit beyond the allowance, in USD."
        }
      },
      "required": [
        "free_per_day",
        "price_usd"
      ],
      "description": "How much is still free and what it costs past that."
    },
    "LinksAudit": {
      "type": "object",
      "properties": {
        "self": {
          "type": "string",
          "description": "This audit, to re-read without re-auditing."
        },
        "patch": {
          "type": [
            "string",
            "null"
          ],
          "description": "`GET /api/audits/:id/patch` — the consolidated patch of this audit."
        },
        "share": {
          "type": "string",
          "description": "Where to publish this audit under a public slug."
        },
        "api_index": {
          "type": "string",
          "description": "Self-describing API index."
        }
      },
      "required": [
        "patch",
        "api_index"
      ],
      "description": "Addresses of the audit just created. Without a stored `id`, only `api_index` comes."
    },
    "ResumoPagina": {
      "type": "object",
      "properties": {
        "finalUrl": {
          "type": "string",
          "description": "URL after following every redirect."
        },
        "status": {
          "type": "integer",
          "description": "Final HTTP status of the target."
        },
        "contentType": {
          "type": [
            "string",
            "null"
          ],
          "description": "Content-Type of the final response."
        },
        "title": {
          "type": [
            "string",
            "null"
          ],
          "description": "Content of `<title>`."
        },
        "metaDescription": {
          "type": [
            "string",
            "null"
          ],
          "description": "Content of `<meta name=description>`."
        },
        "canonical": {
          "type": [
            "string",
            "null"
          ],
          "description": "Canonical URL declared by the page."
        },
        "robots": {
          "type": [
            "string",
            "null"
          ],
          "description": "Content of `<meta name=robots>`."
        },
        "viewport": {
          "type": [
            "string",
            "null"
          ],
          "description": "Content of `<meta name=viewport>`."
        },
        "charset": {
          "type": [
            "string",
            "null"
          ],
          "description": "Declared encoding."
        },
        "lang": {
          "type": [
            "string",
            "null"
          ],
          "description": "Language declared in `<html lang>`."
        },
        "favicon": {
          "type": [
            "string",
            "null"
          ],
          "description": "URL of the favicon found."
        },
        "faviconSource": {
          "type": [
            "string",
            "null"
          ],
          "description": "How the favicon was found: declared or by the default path."
        },
        "h1s": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Every `<h1>` on the page, in order."
        },
        "openGraph": {
          "type": "object",
          "description": "The `og:*` tags found, key by key."
        },
        "twitter": {
          "type": "object",
          "description": "The `twitter:*` tags found."
        },
        "jsonLdCount": {
          "type": "integer",
          "description": "How many JSON-LD nodes the page had."
        },
        "jsonLdBlocks": {
          "type": "integer",
          "description": "How many `<script type=application/ld+json>` blocks existed."
        },
        "jsonLdDropped": {
          "type": "boolean",
          "description": "`true` when nodes were dropped for passing the cap."
        },
        "jsonLdTypes": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The `@type`s found, e.g. `Organization`, `WebSite`."
        },
        "images": {
          "type": "object",
          "description": "Image count and how many have no `alt`."
        },
        "links": {
          "type": "object",
          "description": "Count of internal, external and text-less links."
        },
        "words": {
          "type": "integer",
          "description": "Words in the visible content."
        },
        "hreflang": {
          "type": "array",
          "items": {
            "type": "object"
          },
          "description": "The declared language alternates."
        },
        "legacy": {
          "type": "object",
          "description": "Old markup still present (e.g. `<font>`, layout tables)."
        },
        "redirects": {
          "type": "array",
          "items": {
            "type": "object"
          },
          "description": "The redirect chain followed to the final URL."
        },
        "robotsTxt": {
          "type": "object",
          "description": "What the origin's `robots.txt` says about this URL."
        },
        "sitemap": {
          "type": "object",
          "description": "Whether the URL appears in the sitemap the origin declares."
        }
      },
      "required": [
        "finalUrl",
        "status",
        "contentType",
        "title",
        "metaDescription",
        "canonical",
        "robots",
        "viewport",
        "charset",
        "lang",
        "favicon",
        "faviconSource",
        "h1s",
        "openGraph",
        "twitter",
        "jsonLdCount",
        "jsonLdBlocks",
        "jsonLdDropped",
        "jsonLdTypes",
        "images",
        "links",
        "words",
        "hreflang",
        "legacy",
        "redirects",
        "robotsTxt",
        "sitemap"
      ],
      "description": "Everything the page declares about itself. It is the most consulted object of the API."
    }
  }
}