{
  "openapi": "3.1.0",
  "info": {
    "title": "MazeRank API",
    "version": "2026-10-19",
    "description": "AI visibility data and done-for-you fixes for your MazeRank websites. Keys: Account → API & MCP. Every response carries the MazeRank-Version header. Nothing is ever published or sent on your behalf.",
    "contact": {
      "url": "https://mazerank.com/developers/api"
    }
  },
  "servers": [
    {
      "url": "https://api.mazerank.com/v1"
    }
  ],
  "security": [
    {
      "bearer": []
    }
  ],
  "tags": [
    {
      "name": "Sites"
    },
    {
      "name": "Visibility data"
    },
    {
      "name": "Fixes"
    },
    {
      "name": "Plan, accuracy and facts"
    },
    {
      "name": "Exports"
    }
  ],
  "paths": {
    "/sites": {
      "get": {
        "summary": "List sites",
        "tags": [
          "Sites"
        ],
        "x-scope": "sites",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Site"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "missing_api_key | invalid_api_key"
          }
        }
      }
    },
    "/sites/{site_id}": {
      "get": {
        "summary": "Get site",
        "tags": [
          "Sites"
        ],
        "x-scope": "sites",
        "parameters": [
          {
            "name": "site_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Site id from GET /sites"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Site"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "site_not_found"
          }
        }
      }
    },
    "/sites/{site_id}/mention-rates": {
      "get": {
        "summary": "Mention rates",
        "tags": [
          "Visibility data"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "x-scope": "rates",
        "parameters": [
          {
            "name": "site_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Site id from GET /sites"
          },
          {
            "name": "weeks",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 52,
              "default": 12
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "current": {
                          "type": "object",
                          "properties": {
                            "mentionRate": {
                              "anyOf": [
                                {
                                  "type": "number"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "answers": {
                              "type": "integer"
                            },
                            "score": {
                              "anyOf": [
                                {
                                  "type": "number"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "asOf": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "window": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          }
                        },
                        "weekly": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "week": {
                                "type": "string"
                              },
                              "mentionRate": {
                                "anyOf": [
                                  {
                                    "type": "number"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "answers": {
                                "type": "integer"
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "missing_api_key | invalid_api_key"
          },
          "403": {
            "description": "missing_scope"
          },
          "404": {
            "description": "site_not_found"
          },
          "429": {
            "description": "rate_limited"
          }
        }
      }
    },
    "/sites/{site_id}/engines": {
      "get": {
        "summary": "Engines",
        "tags": [
          "Visibility data"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "x-scope": "engines",
        "parameters": [
          {
            "name": "site_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Site id from GET /sites"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "engine": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          },
                          "mentionRate": {
                            "type": "number"
                          },
                          "answers": {
                            "type": "integer"
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "missing_api_key | invalid_api_key"
          },
          "403": {
            "description": "missing_scope"
          },
          "404": {
            "description": "site_not_found"
          },
          "429": {
            "description": "rate_limited"
          }
        }
      }
    },
    "/sites/{site_id}/competitors": {
      "get": {
        "summary": "Competitors",
        "tags": [
          "Visibility data"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "x-scope": "competitors",
        "parameters": [
          {
            "name": "site_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Site id from GET /sites"
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "you": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "mentionRate": {
                              "anyOf": [
                                {
                                  "type": "number"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          }
                        },
                        "tracked": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "competitors": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string"
                              },
                              "mentionRate": {
                                "type": "number"
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "missing_api_key | invalid_api_key"
          },
          "403": {
            "description": "missing_scope"
          },
          "404": {
            "description": "site_not_found"
          },
          "429": {
            "description": "rate_limited"
          }
        }
      }
    },
    "/sites/{site_id}/answers": {
      "get": {
        "summary": "Answers",
        "tags": [
          "Visibility data"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "x-scope": "answers",
        "parameters": [
          {
            "name": "site_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Site id from GET /sites"
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "engine",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "date": {
                            "type": "string"
                          },
                          "question": {
                            "type": "string"
                          },
                          "language": {
                            "type": "string"
                          },
                          "city": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "engine": {
                            "type": "string"
                          },
                          "mentioned": {
                            "type": "boolean"
                          },
                          "rank": {
                            "anyOf": [
                              {
                                "type": "integer"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "sentiment": {
                            "type": "string"
                          },
                          "competitors": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "citations": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "ownSiteCited": {
                            "type": "boolean"
                          },
                          "answer": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "missing_api_key | invalid_api_key"
          },
          "403": {
            "description": "missing_scope"
          },
          "404": {
            "description": "site_not_found"
          },
          "429": {
            "description": "rate_limited"
          }
        }
      }
    },
    "/sites/{site_id}/alerts": {
      "get": {
        "summary": "Alerts",
        "tags": [
          "Visibility data"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "x-scope": "alerts",
        "parameters": [
          {
            "name": "site_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Site id from GET /sites"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string"
                          },
                          "engine": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "createdAt": {
                            "type": "string"
                          },
                          "text": {
                            "type": "string"
                          },
                          "quote": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "missing_api_key | invalid_api_key"
          },
          "403": {
            "description": "missing_scope"
          },
          "404": {
            "description": "site_not_found"
          },
          "429": {
            "description": "rate_limited"
          }
        }
      }
    },
    "/sites/{site_id}/reports": {
      "get": {
        "summary": "Reports",
        "tags": [
          "Visibility data"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "x-scope": "reports",
        "parameters": [
          {
            "name": "site_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Site id from GET /sites"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "monthlyPdf": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "month": {
                                  "type": "string"
                                },
                                "generatedAt": {
                                  "type": "string"
                                }
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "pdfUrl": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "weeklyReportUrl": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "lastWeeklyEmailFor": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "missing_api_key | invalid_api_key"
          },
          "403": {
            "description": "missing_scope"
          },
          "404": {
            "description": "site_not_found"
          },
          "429": {
            "description": "rate_limited"
          }
        }
      }
    },
    "/sites/{site_id}/fixes": {
      "get": {
        "summary": "List fixes",
        "description": "Ranked fixes (rank 1 = do first), grounded in the latest check. Retired fixes are never listed.",
        "tags": [
          "Fixes"
        ],
        "x-scope": "fixes",
        "parameters": [
          {
            "name": "site_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Site id from GET /sites"
          },
          {
            "name": "category",
            "in": "query",
            "schema": {
              "type": "string",
              "description": "Comma list of content, tool, technical, listing, reviews_community, outreach"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "open",
                "in_progress",
                "awaiting_approval",
                "done",
                "verified",
                "dismissed",
                "all"
              ],
              "default": "active"
            },
            "description": "active = open + in_progress + awaiting_approval"
          },
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string",
              "description": "Comma list of article, tool, directory, outreach, community, technical"
            }
          },
          {
            "name": "impact",
            "in": "query",
            "schema": {
              "type": "string",
              "description": "Comma list of high, medium, low"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string",
              "description": "next_cursor from the previous page"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "api_version": {
                      "type": "string"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/FixSummary"
                      }
                    },
                    "total": {
                      "type": "integer"
                    },
                    "next_cursor": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "budget": {
                      "$ref": "#/components/schemas/Budget"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "site_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/sites/{site_id}/fix-categories": {
      "get": {
        "summary": "List fix categories",
        "description": "Categories with counts per status.",
        "tags": [
          "Fixes"
        ],
        "x-scope": "fixes",
        "parameters": [
          {
            "name": "site_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Site id from GET /sites"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "api_version": {
                      "type": "string"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "enum": [
                              "content",
                              "tool",
                              "technical",
                              "listing",
                              "reviews_community",
                              "outreach"
                            ]
                          },
                          "label": {
                            "type": "string"
                          },
                          "types": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "counts": {
                            "type": "object",
                            "properties": {
                              "open": {
                                "type": "integer"
                              },
                              "in_progress": {
                                "type": "integer"
                              },
                              "awaiting_approval": {
                                "type": "integer"
                              },
                              "done": {
                                "type": "integer"
                              },
                              "verified": {
                                "type": "integer"
                              },
                              "dismissed": {
                                "type": "integer"
                              },
                              "total": {
                                "type": "integer"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "site_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/sites/{site_id}/fixes/next": {
      "get": {
        "summary": "Get next fix",
        "description": "The in-progress fix if any, otherwise rank 1 of the open fixes (optionally in a category). data is null when nothing is left.",
        "tags": [
          "Fixes"
        ],
        "x-scope": "fixes",
        "parameters": [
          {
            "name": "site_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Site id from GET /sites"
          },
          {
            "name": "category",
            "in": "query",
            "schema": {
              "type": "string",
              "description": "Comma list of content, tool, technical, listing, reviews_community, outreach"
            }
          },
          {
            "name": "include",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "solution"
              ]
            },
            "description": "solution: add the written solution and a content-complete implementation.agent_prompt (default: compact)"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "api_version": {
                      "type": "string"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/Fix"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "remaining": {
                      "type": "integer"
                    },
                    "message": {
                      "type": "string"
                    },
                    "budget": {
                      "$ref": "#/components/schemas/Budget"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "site_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/sites/{site_id}/fixes/{fix_id}": {
      "get": {
        "summary": "Get fix",
        "description": "One fix with its evidence, re-check and implementation brief. Compact by default; include=solution adds the solution.",
        "tags": [
          "Fixes"
        ],
        "x-scope": "fixes",
        "parameters": [
          {
            "name": "site_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Site id from GET /sites"
          },
          {
            "name": "fix_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Fix id from GET /sites/{site_id}/fixes"
          },
          {
            "name": "include",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "solution"
              ]
            },
            "description": "solution: add the written solution and a content-complete implementation.agent_prompt (default: compact)"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "api_version": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Fix"
                    },
                    "budget": {
                      "$ref": "#/components/schemas/Budget"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "fix_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/sites/{site_id}/fixes/{fix_id}/solution": {
      "get": {
        "summary": "Get solution",
        "description": "The written solution as structured parts. Never generates.",
        "tags": [
          "Fixes"
        ],
        "x-scope": "fixes",
        "parameters": [
          {
            "name": "site_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Site id from GET /sites"
          },
          {
            "name": "fix_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Fix id from GET /sites/{site_id}/fixes"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "api_version": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Solution"
                    },
                    "budget": {
                      "$ref": "#/components/schemas/Budget"
                    }
                  }
                }
              }
            }
          },
          "202": {
            "description": "generating (Retry-After: 20)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "no_solution",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "generation_failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Write solution",
        "description": "Lite is free and immediate. Full uses the site's monthly budget (Pro 20, Scale 60) and returns 202; poll GET. An existing full solution is returned free unless regenerate. Spark: the 1 free full solution is spent only with use_free=true on this fix (else 402 free_pick_required).",
        "tags": [
          "Fixes"
        ],
        "x-scope": "fixes_write",
        "parameters": [
          {
            "name": "site_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Site id from GET /sites"
          },
          {
            "name": "fix_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Fix id from GET /sites/{site_id}/fixes"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "mode": {
                    "type": "string",
                    "enum": [
                      "full",
                      "lite"
                    ],
                    "default": "full"
                  },
                  "use_free": {
                    "type": "boolean",
                    "default": false,
                    "description": "Spark only"
                  },
                  "regenerate": {
                    "type": "boolean",
                    "default": false,
                    "description": "Pro/Scale only; uses budget"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Existing or lite solution",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "api_version": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Solution"
                    },
                    "budget": {
                      "$ref": "#/components/schemas/Budget"
                    }
                  }
                }
              }
            }
          },
          "202": {
            "description": "Writing started",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "api_version": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "const": "generating"
                    },
                    "fix_id": {
                      "type": "string"
                    },
                    "mode": {
                      "type": "string"
                    },
                    "retry_after_seconds": {
                      "type": "integer"
                    },
                    "budget": {
                      "$ref": "#/components/schemas/Budget"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "free_pick_required | budget_exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "plan_required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "fix_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "generation_failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/sites/{site_id}/fixes/{fix_id}/start": {
      "post": {
        "summary": "Mark in progress",
        "description": "open → in_progress; Get next fix returns it first. Idempotent.",
        "tags": [
          "Fixes"
        ],
        "x-scope": "fixes_write",
        "parameters": [
          {
            "name": "site_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Site id from GET /sites"
          },
          {
            "name": "fix_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Fix id from GET /sites/{site_id}/fixes"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "api_version": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Fix"
                    },
                    "changed": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "fix_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "invalid_transition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/sites/{site_id}/fixes/{fix_id}/done": {
      "post": {
        "summary": "Mark done",
        "description": "open/in_progress/awaiting_approval → done; optional body {\"url\": \"https://…\"} stores the published page. Re-checks the fix's questions at ~72 h, day 7 and day 21, then verified. Idempotent.",
        "tags": [
          "Fixes"
        ],
        "x-scope": "fixes_write",
        "parameters": [
          {
            "name": "site_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Site id from GET /sites"
          },
          {
            "name": "fix_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Fix id from GET /sites/{site_id}/fixes"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "api_version": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Fix"
                    },
                    "changed": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "fix_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "invalid_transition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/sites/{site_id}/fixes/{fix_id}/dismiss": {
      "post": {
        "summary": "Dismiss",
        "description": "open/in_progress → dismissed; optional body {\"reason\": \"…\"}; nothing is deleted. Idempotent.",
        "tags": [
          "Fixes"
        ],
        "x-scope": "fixes_write",
        "parameters": [
          {
            "name": "site_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Site id from GET /sites"
          },
          {
            "name": "fix_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Fix id from GET /sites/{site_id}/fixes"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "api_version": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Fix"
                    },
                    "changed": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "fix_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "invalid_transition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/sites/{site_id}/fixes/{fix_id}/reopen": {
      "post": {
        "summary": "Reopen",
        "description": "Any status → open (clears in_progress and awaiting_approval). Idempotent.",
        "tags": [
          "Fixes"
        ],
        "x-scope": "fixes_write",
        "parameters": [
          {
            "name": "site_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Site id from GET /sites"
          },
          {
            "name": "fix_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Fix id from GET /sites/{site_id}/fixes"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "api_version": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Fix"
                    },
                    "changed": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "fix_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "invalid_transition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/sites/{site_id}/fixes/{fix_id}/apply": {
      "post": {
        "summary": "Apply fix (prepare change set)",
        "description": "Packages the fix's written solution as a change set for your agent: a pull request (branch, commit message, body, file changes), a CMS draft (WordPress/Webflow) or manual steps. MazeRank never pushes, merges or publishes; a person approves, then POST …/done with the published url. Sets status awaiting_approval. Needs an active plan and a written solution (never generates).",
        "tags": [
          "Fixes"
        ],
        "x-scope": "fixes_write",
        "parameters": [
          {
            "name": "site_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Site id from GET /sites"
          },
          {
            "name": "fix_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Fix id from GET /sites/{site_id}/fixes"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "format": {
                    "type": "string",
                    "enum": [
                      "pull_request",
                      "cms_draft",
                      "manual"
                    ],
                    "description": "Hint only; the fix type decides"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "api_version": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "fix_id": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "const": "awaiting_approval"
                        },
                        "change_set": {
                          "$ref": "#/components/schemas/ChangeSet"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "plan_required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "no_solution | fix_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "invalid_transition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/sites/{site_id}/fixes/{fix_id}/proof": {
      "get": {
        "summary": "Fix proof",
        "description": "Same questions and engines before vs after, re-check passes, verdict and receipt links. A signal, never a promise.",
        "tags": [
          "Fixes"
        ],
        "x-scope": "fixes",
        "parameters": [
          {
            "name": "site_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Site id from GET /sites"
          },
          {
            "name": "fix_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Fix id from GET /sites/{site_id}/fixes"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "api_version": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Proof"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "fix_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/sites/{site_id}/fixes/{fix_id}/receipt": {
      "get": {
        "summary": "Proof receipt",
        "description": "The proof with its public receipt link. format=pdf redirects (302) to the PDF.",
        "tags": [
          "Fixes"
        ],
        "x-scope": "fixes",
        "parameters": [
          {
            "name": "site_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Site id from GET /sites"
          },
          {
            "name": "fix_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Fix id from GET /sites/{site_id}/fixes"
          },
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "pdf"
              ],
              "default": "json"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "api_version": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Proof"
                    }
                  }
                }
              }
            }
          },
          "302": {
            "description": "format=pdf: Location is the receipt PDF"
          },
          "404": {
            "description": "no_receipt | fix_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/sites/{site_id}/plan": {
      "get": {
        "summary": "This week's plan",
        "description": "Up to 3 tasks (fixes and wrong-answer corrections).",
        "tags": [
          "Plan, accuracy and facts"
        ],
        "x-scope": "plan",
        "parameters": [
          {
            "name": "site_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Site id from GET /sites"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "api_version": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Plan"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "site_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/sites/{site_id}/plan/tasks/{task_id}/swap": {
      "post": {
        "summary": "Swap a task",
        "description": "\"Not this one\": replaces an open task with the next best. Needs plan + fixes_write; not on admin keys.",
        "tags": [
          "Plan, accuracy and facts"
        ],
        "x-scope": "plan + fixes_write",
        "parameters": [
          {
            "name": "site_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Site id from GET /sites"
          },
          {
            "name": "task_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "s:<fix id> or c:<correction id>"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "api_version": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Plan"
                    },
                    "replaced": {
                      "type": "string"
                    },
                    "new_task_id": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "admin_key_read_only",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "site_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "invalid_transition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/sites/{site_id}/wins": {
      "get": {
        "summary": "Wins",
        "tags": [
          "Visibility data"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "x-scope": "plan",
        "parameters": [
          {
            "name": "site_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Site id from GET /sites"
          },
          {
            "name": "month",
            "in": "query",
            "schema": {
              "type": "string",
              "description": "YYYY-MM"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "month": {
                          "type": "string"
                        },
                        "tasks_done": {
                          "type": "integer"
                        },
                        "proven": {
                          "type": "integer"
                        },
                        "more_questions_named": {
                          "type": "integer"
                        },
                        "engines": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "wrong_answers_corrected": {
                          "type": "integer"
                        },
                        "score": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "from": {
                                  "type": "number"
                                },
                                "to": {
                                  "type": "number"
                                }
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "items": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "task_id": {
                                "type": "string"
                              },
                              "title": {
                                "type": "string"
                              },
                              "done_at": {
                                "type": "string"
                              },
                              "proven": {
                                "type": "boolean"
                              },
                              "receipt_url": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "missing_api_key | invalid_api_key"
          },
          "403": {
            "description": "missing_scope"
          },
          "404": {
            "description": "site_not_found"
          },
          "429": {
            "description": "rate_limited"
          }
        }
      }
    },
    "/sites/{site_id}/accuracy": {
      "get": {
        "summary": "Accuracy",
        "tags": [
          "Visibility data"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "x-scope": "accuracy",
        "parameters": [
          {
            "name": "site_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Site id from GET /sites"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "accuracy_pct": {
                              "anyOf": [
                                {
                                  "type": "number"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "correct": {
                              "type": "integer"
                            },
                            "checkable": {
                              "type": "integer"
                            },
                            "wrong": {
                              "type": "integer"
                            },
                            "outdated": {
                              "type": "integer"
                            },
                            "mixed_up": {
                              "type": "integer"
                            },
                            "misleading": {
                              "type": "integer"
                            },
                            "unverifiable": {
                              "type": "integer"
                            },
                            "facts_confirmed": {
                              "type": "boolean"
                            },
                            "by_engine": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "engine": {
                                    "type": "string"
                                  },
                                  "correct": {
                                    "type": "integer"
                                  },
                                  "checkable": {
                                    "type": "integer"
                                  },
                                  "accuracy_pct": {
                                    "anyOf": [
                                      {
                                        "type": "number"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  }
                                }
                              }
                            },
                            "weekly": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "week": {
                                    "type": "string"
                                  },
                                  "correct": {
                                    "type": "integer"
                                  },
                                  "checkable": {
                                    "type": "integer"
                                  },
                                  "accuracy_pct": {
                                    "anyOf": [
                                      {
                                        "type": "number"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  }
                                }
                              }
                            }
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "missing_api_key | invalid_api_key"
          },
          "403": {
            "description": "missing_scope"
          },
          "404": {
            "description": "site_not_found"
          },
          "429": {
            "description": "rate_limited"
          }
        }
      }
    },
    "/sites/{site_id}/claims": {
      "get": {
        "summary": "Wrong answers (claims)",
        "tags": [
          "Visibility data"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "x-scope": "accuracy",
        "parameters": [
          {
            "name": "site_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Site id from GET /sites"
          },
          {
            "name": "verdict",
            "in": "query",
            "schema": {
              "type": "string",
              "description": "Comma list; default wrong,outdated,mixed_up,misleading"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "date": {
                            "type": "string"
                          },
                          "engine": {
                            "type": "string"
                          },
                          "field": {
                            "type": "string"
                          },
                          "claim": {
                            "type": "string"
                          },
                          "quote": {
                            "type": "string"
                          },
                          "verdict": {
                            "type": "string"
                          },
                          "severity": {
                            "type": "string"
                          },
                          "confidence": {
                            "type": "number"
                          },
                          "likely_source": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string"
                                  },
                                  "url": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "domain": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  }
                                }
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "missing_api_key | invalid_api_key"
          },
          "403": {
            "description": "missing_scope"
          },
          "404": {
            "description": "site_not_found"
          },
          "429": {
            "description": "rate_limited"
          }
        }
      }
    },
    "/sites/{site_id}/facts": {
      "get": {
        "summary": "Business facts",
        "tags": [
          "Plan, accuracy and facts"
        ],
        "x-scope": "facts",
        "parameters": [
          {
            "name": "site_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Site id from GET /sites"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "api_version": {
                      "type": "string"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Fact"
                      }
                    },
                    "fields": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "site_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "put": {
        "summary": "Set facts",
        "description": "Adds confirmed owner facts. One-value fields replace the current value (kept as history); service/price/policy add rows. Re-grades claims. Not on admin keys.",
        "tags": [
          "Plan, accuracy and facts"
        ],
        "x-scope": "facts_write",
        "parameters": [
          {
            "name": "site_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Site id from GET /sites"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "facts": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "field": {
                          "type": "string"
                        },
                        "value": {
                          "type": "string"
                        },
                        "key": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "field",
                        "value"
                      ]
                    }
                  }
                },
                "required": [
                  "facts"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "api_version": {
                      "type": "string"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Fact"
                      }
                    },
                    "changed": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "admin_key_read_only",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "site_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/sites/{site_id}/export/{kind}.csv": {
      "get": {
        "summary": "CSV export",
        "description": "UTF-8 CSV (with BOM) of answers (scope answers), fixes or proofs (fixes), claims (accuracy) or plan (plan). Up to 5000 rows. Text cells starting with = + - @ are prefixed with ' .",
        "tags": [
          "Exports"
        ],
        "x-scope": "per kind",
        "parameters": [
          {
            "name": "site_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Site id from GET /sites"
          },
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "answers",
                "fixes",
                "claims",
                "proofs",
                "plan"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "CSV",
            "content": {
              "text/csv": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "description": "site_not_found | not_found"
          }
        }
      }
    },
    "/sites/{site_id}/plan.csv": {
      "get": {
        "summary": "Plan CSV",
        "tags": [
          "Exports"
        ],
        "x-scope": "plan",
        "parameters": [
          {
            "name": "site_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Site id from GET /sites"
          }
        ],
        "responses": {
          "200": {
            "description": "CSV",
            "content": {
              "text/csv": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "lr_… account key (or X-Api-Key header)"
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string",
            "description": "Machine code"
          },
          "message": {
            "type": "string"
          },
          "detail": {
            "type": "string"
          },
          "scope": {
            "type": "string"
          }
        },
        "required": [
          "error"
        ]
      },
      "Site": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "website": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "city": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "country": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "languages": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "plan": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "agencyClient": {
            "type": "boolean"
          },
          "brandId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "location": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "Budget": {
        "type": "object",
        "properties": {
          "plan": {
            "type": "string",
            "description": "spark | pro | scale | none"
          },
          "full_per_month": {
            "type": "integer"
          },
          "used_this_month": {
            "type": "integer"
          },
          "budget_remaining": {
            "type": "integer"
          },
          "spark_pick_required": {
            "type": "boolean"
          },
          "renews_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "FixSummary": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Stable id"
          },
          "key": {
            "type": "string",
            "description": "Stable content key"
          },
          "type": {
            "type": "string",
            "enum": [
              "article",
              "tool",
              "directory",
              "outreach",
              "community",
              "technical"
            ]
          },
          "category": {
            "type": "string",
            "enum": [
              "content",
              "tool",
              "technical",
              "listing",
              "reviews_community",
              "outreach"
            ]
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "in_progress",
              "awaiting_approval",
              "done",
              "verified",
              "dismissed"
            ]
          },
          "impact": {
            "type": "string",
            "enum": [
              "high",
              "medium",
              "low"
            ]
          },
          "effort": {
            "type": "integer",
            "description": "1 easy – 3 big"
          },
          "rank": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ]
          },
          "score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "why": {
            "type": "string"
          },
          "target": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "versus": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "counts": {
            "type": "object",
            "properties": {
              "questions": {
                "type": "integer"
              },
              "cited_pages": {
                "type": "integer"
              },
              "answers_checked": {
                "type": "integer"
              }
            }
          },
          "solution_available": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "full",
                  "lite"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string"
          },
          "started_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "done_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "revision": {
            "type": "string",
            "description": "Changes when the fix's wording or evidence changes"
          }
        }
      },
      "Fix": {
        "allOf": [
          {
            "$ref": "#/components/schemas/FixSummary"
          },
          {
            "type": "object",
            "properties": {
              "evidence": {
                "type": "object",
                "properties": {
                  "cited_pages": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "url": {
                          "type": "string"
                        },
                        "title": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "domain": {
                          "type": "string"
                        },
                        "source_type": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "format": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "cited_count": {
                          "type": "integer"
                        },
                        "relevance": {
                          "anyOf": [
                            {
                              "type": "number"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "traits": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "author": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      }
                    }
                  },
                  "questions": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "question_id": {
                          "type": "string"
                        },
                        "text": {
                          "type": "string"
                        },
                        "answers_checked": {
                          "type": "integer"
                        },
                        "engines_missed": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "named_instead": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  },
                  "competitors_named": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "questions": {
                          "type": "integer"
                        }
                      }
                    }
                  },
                  "site": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "robots_blocked": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "has_llms_txt": {
                            "type": "boolean"
                          },
                          "schema_types": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        }
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                }
              },
              "recheck": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "started_at": {
                        "type": "string"
                      },
                      "until": {
                        "type": "string"
                      },
                      "before": {
                        "type": "object",
                        "properties": {
                          "named": {
                            "type": "integer"
                          },
                          "answers": {
                            "type": "integer"
                          }
                        }
                      },
                      "after": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "named": {
                                "type": "integer"
                              },
                              "answers": {
                                "type": "integer"
                              }
                            }
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    }
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "solution_state": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "status": {
                        "type": "string"
                      },
                      "mode": {
                        "type": "string"
                      },
                      "updated_at": {
                        "type": "string"
                      }
                    }
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "implementation": {
                "$ref": "#/components/schemas/Implementation"
              },
              "solution": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/Solution"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Only with include=solution"
              }
            }
          }
        ]
      },
      "ChangeSet": {
        "type": "object",
        "properties": {
          "fix_id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "language": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": [
              "full",
              "lite"
            ]
          },
          "format": {
            "type": "string",
            "enum": [
              "pull_request",
              "cms_draft",
              "manual"
            ]
          },
          "pull_request": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "branch": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  },
                  "commit_message": {
                    "type": "string"
                  },
                  "body": {
                    "type": "string"
                  },
                  "changes": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "op": {
                          "type": "string",
                          "enum": [
                            "create",
                            "update",
                            "append"
                          ]
                        },
                        "path": {
                          "type": "string"
                        },
                        "content": {
                          "type": "string"
                        },
                        "content_type": {
                          "type": "string"
                        },
                        "placement": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "note": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "cms_draft": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "const": "draft"
                  },
                  "title": {
                    "type": "string"
                  },
                  "slug": {
                    "type": "string"
                  },
                  "excerpt": {
                    "type": "string"
                  },
                  "content_html": {
                    "type": "string"
                  },
                  "content_markdown": {
                    "type": "string"
                  },
                  "meta": {
                    "type": "object",
                    "properties": {
                      "title_tag": {
                        "type": "string"
                      },
                      "meta_description": {
                        "type": "string"
                      }
                    }
                  },
                  "json_ld": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "for": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "description": "wordpress, webflow…"
                    }
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "manual_steps": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "n": {
                  "type": "integer"
                },
                "title": {
                  "type": "string"
                },
                "url": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              }
            }
          },
          "placeholders": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "verification": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "check": {
                  "type": "string"
                },
                "how": {
                  "type": "string"
                },
                "url": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              }
            }
          },
          "acceptance_criteria": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "approval": {
            "type": "object",
            "properties": {
              "required": {
                "type": "boolean",
                "const": true
              },
              "status": {
                "type": "string",
                "const": "awaiting_approval"
              },
              "rule": {
                "type": "string"
              },
              "next": {
                "type": "string"
              }
            }
          }
        }
      },
      "Proof": {
        "type": "object",
        "properties": {
          "fix_id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "verdict": {
            "anyOf": [
              {
                "type": "string",
                "description": "proven | not_yet | not_proven"
              },
              {
                "type": "null"
              }
            ]
          },
          "done_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "proven_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "published_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "low_confidence": {
            "type": "boolean"
          },
          "before": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "named": {
                    "type": "integer"
                  },
                  "pairs": {
                    "type": "integer"
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "now": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "named": {
                    "type": "integer"
                  },
                  "pairs": {
                    "type": "integer"
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "lift": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "engines": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "engine": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "named": {
                  "anyOf": [
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              }
            }
          },
          "passes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "label": {
                  "type": "string"
                },
                "due_at": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "ran_at": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "skipped": {
                  "type": "boolean"
                },
                "runs": {
                  "anyOf": [
                    {
                      "type": "integer"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "held": {
                  "anyOf": [
                    {
                      "type": "integer"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "confidence": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              }
            }
          },
          "receipt_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "receipt_pdf_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "Plan": {
        "type": "object",
        "properties": {
          "week_of": {
            "type": "string"
          },
          "tasks": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "task_id": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "fix",
                    "correction"
                  ]
                },
                "fix_id": {
                  "type": "string"
                },
                "correction_id": {
                  "type": "string"
                },
                "kind": {
                  "type": "string"
                },
                "title": {
                  "type": "string"
                },
                "why": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "todo",
                    "done",
                    "swapped",
                    "gone"
                  ]
                },
                "slot": {
                  "type": "string"
                },
                "effort_minutes": {
                  "type": "integer"
                },
                "who": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "estimated_gain": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "done_at": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              }
            }
          }
        }
      },
      "Fact": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "field": {
            "type": "string"
          },
          "key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "value": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "confirmed_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "Implementation": {
        "type": "object",
        "properties": {
          "goal": {
            "type": "string"
          },
          "who_can_do_it": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "developer",
                "agent",
                "owner_manual"
              ]
            }
          },
          "acceptance_criteria": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "steps": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "n": {
                  "type": "integer"
                },
                "action": {
                  "type": "string",
                  "enum": [
                    "create_page",
                    "edit_page",
                    "add_schema",
                    "add_file",
                    "external_profile",
                    "manual"
                  ]
                },
                "title": {
                  "type": "string"
                },
                "target": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              }
            }
          },
          "files": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "path": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "url": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "action": {
                  "type": "string"
                },
                "placement": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              }
            }
          },
          "placeholders": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "label": {
                  "type": "string"
                },
                "token": {
                  "type": "string",
                  "description": "e.g. [[FILL IN: price]] (PREENCHER / COMPLETAR in pt / es)"
                },
                "part": {
                  "type": "string"
                }
              }
            }
          },
          "dependencies": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "solution",
                    "placeholders",
                    "fix"
                  ]
                },
                "detail": {
                  "type": "string"
                }
              }
            }
          },
          "verification": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "check": {
                  "type": "string"
                },
                "how": {
                  "type": "string"
                },
                "url": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              }
            }
          },
          "agent_prompt": {
            "type": "string",
            "description": "Ready for Cursor / Claude Code, in the site's language"
          },
          "agent_prompt_has_content": {
            "type": "boolean"
          }
        }
      },
      "Solution": {
        "type": "object",
        "properties": {
          "fix_id": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": [
              "full",
              "lite"
            ]
          },
          "type": {
            "type": "string"
          },
          "language": {
            "type": "string"
          },
          "generated_at": {
            "type": "string"
          },
          "revision": {
            "type": "string"
          },
          "parts": {
            "type": "object",
            "description": "Per type. article: title_tag, meta_description, slug, article_markdown, article_html, json_ld, faq[{question,answer}], internal_links[{anchor,url}], citable_facts. tool: build_prompt, target_keyword, title_tag, meta_description, slug, page_markdown, page_html, json_ld, faq. directory: listing{…}. outreach: outreach{to, subject, body, follow_up, why_fit, send:'copy_only'}. community: community{…}. technical: technical{llms_txt, robots_txt, business_json_ld, faq_html}. lite: outline_markdown, cited_page_covers."
          },
          "blanks": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "part": {
                  "type": "string"
                },
                "text": {
                  "type": "string"
                }
              }
            }
          },
          "files": {
            "type": "object",
            "properties": {
              "markdown": {
                "type": "object",
                "properties": {
                  "filename": {
                    "type": "string"
                  },
                  "content": {
                    "type": "string"
                  }
                }
              },
              "html": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "filename": {
                        "type": "string"
                      },
                      "content": {
                        "type": "string"
                      }
                    }
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          "upgrade_hint": {
            "type": "string"
          },
          "plan": {
            "type": "string"
          },
          "full_per_month": {
            "type": "integer"
          },
          "used_this_month": {
            "type": "integer"
          },
          "budget_remaining": {
            "type": "integer"
          },
          "spark_pick_required": {
            "type": "boolean"
          },
          "renews_at": {
            "type": "string"
          }
        }
      }
    }
  }
}