{
  "openapi": "3.1.2",
  "info": {
    "title": "Unlovable.Click featuring R.E.A. — API and MCP",
    "version": "2026-11-06",
    "summary": "Free human website investigations and self-service metered agent API/MCP.",
    "description": "Human workspace investigations and full reports are free. Agent accounts, project management, API-key administration, and MCP discovery are free. Only successful authenticated agent analysis operations use prepaid USDC credits: analyze_html 0.01 USDC, scan_url/project_scan 0.03 USDC, compare_urls 0.05 USDC. Failed paid operations are refunded.",
    "contact": {
      "name": "R.E.A. API reference",
      "url": "https://unlovable.click/agent-api"
    }
  },
  "servers": [
    {
      "url": "https://unlovable.click",
      "description": "Free human workspace and public scan API"
    },
    {
      "url": "https://agents.unlovable.click",
      "description": "Self-service agent API and Streamable HTTP MCP gateway"
    }
  ],
  "tags": [
    {
      "name": "Human — Scan",
      "description": "Free human public website scans."
    },
    {
      "name": "Human — Reports",
      "description": "Free browser-bound full human reports."
    },
    {
      "name": "Agent — Account",
      "description": "Free self-service registration, keys, balance, and usage."
    },
    {
      "name": "Agent — Projects",
      "description": "Free basic project management."
    },
    {
      "name": "Agent — Paid Analysis",
      "description": "Metered agent API analysis calls."
    },
    {
      "name": "Agent — MCP",
      "description": "Free MCP discovery and free/paid tool calls."
    },
    {
      "name": "Agent — Credits",
      "description": "Prepaid USDC top-ups for agent API/MCP use."
    },
    {
      "name": "Privacy requests",
      "description": "Privacy and deletion requests."
    }
  ],
  "components": {
    "securitySchemes": {
      "visitorCookie": {
        "type": "apiKey",
        "in": "cookie",
        "name": "rea_visitor",
        "description": "HttpOnly, Secure, SameSite=Lax browser ownership cookie set by POST /api/rea/scan."
      },
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "Opaque operator-issued credential",
        "description": "Provisioned out of band by the Operator. Do not expose this credential in browser code."
      },
      "agentBearer": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API key"
      }
    },
    "schemas": {
      "ScanRequest": {
        "type": "object",
        "required": [
          "url"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "pattern": "^https?://",
            "maxLength": 2048,
            "description": "Public HTTP or HTTPS page to investigate."
          }
        },
        "additionalProperties": false
      },
      "QuoteRequest": {
        "type": "object",
        "required": [
          "reportId",
          "chain"
        ],
        "properties": {
          "reportId": {
            "type": "string",
            "format": "uuid"
          },
          "chain": {
            "type": "string",
            "enum": [
              "solana",
              "base"
            ]
          }
        },
        "additionalProperties": false
      },
      "ConfirmRequest": {
        "type": "object",
        "required": [
          "reportId",
          "quoteId",
          "txHash"
        ],
        "properties": {
          "reportId": {
            "type": "string",
            "format": "uuid"
          },
          "quoteId": {
            "type": "string",
            "format": "uuid"
          },
          "txHash": {
            "type": "string",
            "minLength": 64,
            "maxLength": 120,
            "description": "Solana transaction signature or Base transaction hash."
          }
        },
        "additionalProperties": false
      },
      "PrivacyRequest": {
        "type": "object",
        "required": [
          "requestType",
          "message"
        ],
        "properties": {
          "requestType": {
            "type": "string",
            "enum": [
              "access",
              "delete",
              "correct",
              "opt-out",
              "payment",
              "other"
            ]
          },
          "email": {
            "type": "string",
            "format": "email",
            "maxLength": 254
          },
          "reportId": {
            "type": "string",
            "format": "uuid"
          },
          "message": {
            "type": "string",
            "minLength": 10,
            "maxLength": 3000
          }
        },
        "additionalProperties": false
      },
      "AgentAnalyzeRequest": {
        "type": "object",
        "required": [
          "html"
        ],
        "properties": {
          "html": {
            "type": "string",
            "minLength": 1,
            "maxLength": 524288,
            "description": "HTML to inspect. Submitted scripts are not executed; external scripts are not fetched."
          }
        },
        "additionalProperties": false
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "locked": {
            "type": "boolean"
          }
        },
        "required": [
          "error"
        ]
      }
    }
  },
  "paths": {
    "/api/rea/scan": {
      "post": {
        "tags": [
          "Human — Scan"
        ],
        "summary": "Run a public website investigation",
        "description": "Free human preview. Starts a visitor-bound report, captures a limited public-page sample and sets the rea_visitor cookie on first use. Rate limited. Do not submit secrets or private URLs.",
        "operationId": "runPublicScan",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ScanRequest"
              },
              "example": {
                "url": "https://example.com"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Investigation preview and report ID",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "reportId",
                    "sourceUrl",
                    "finalUrl",
                    "pageCount",
                    "metrics",
                    "pages"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "reportId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "sourceUrl": {
                      "type": "string"
                    },
                    "finalUrl": {
                      "type": "string"
                    },
                    "capturedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "pageCount": {
                      "type": "integer"
                    },
                    "metrics": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "pages": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "technologySignals": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "visualSummary": {
                      "type": "string"
                    },
                    "desktopScreenshot": {
                      "type": "string"
                    },
                    "mobileScreenshot": {
                      "type": "string"
                    },
                    "paid": {
                      "const": false
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unsupported URL"
          },
          "429": {
            "description": "Rate limit reached"
          },
          "503": {
            "description": "Report storage unavailable"
          }
        }
      }
    },
    "/api/rea/preview": {
      "get": {
        "tags": [
          "Human — Reports"
        ],
        "summary": "Retrieve the free preview",
        "description": "Returns the preview associated with a report in the same browser.",
        "operationId": "getReportPreview",
        "security": [
          {
            "visitorCookie": []
          }
        ],
        "parameters": [
          {
            "name": "reportId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Preview JSON",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Report not found in this browser"
          }
        }
      }
    },
    "/api/rea/preview-image": {
      "get": {
        "tags": [
          "Human — Reports"
        ],
        "summary": "Retrieve a captured preview image",
        "description": "Returns a report-owned desktop or mobile screenshot when it was captured.",
        "operationId": "getPreviewImage",
        "security": [
          {
            "visitorCookie": []
          }
        ],
        "parameters": [
          {
            "name": "reportId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "desktop",
                "mobile"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "PNG screenshot",
            "content": {
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "404": {
            "description": "Image not available in this browser"
          }
        }
      }
    },
    "/api/rea/report": {
      "get": {
        "tags": [
          "Human — Reports"
        ],
        "summary": "Retrieve the detailed paid report",
        "description": "Returns full findings only after the matching investigation has a verified payment. Returns HTTP 402 while locked.",
        "operationId": "getPaidReport",
        "security": [
          {
            "visitorCookie": []
          }
        ],
        "parameters": [
          {
            "name": "reportId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Detailed report",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Detailed report is locked",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Report not found in this browser"
          }
        }
      }
    },
    "/api/privacy/request": {
      "post": {
        "tags": [
          "Privacy requests"
        ],
        "summary": "Submit a privacy or service request",
        "description": "Stores a request for operator review. Email is optional and used only if you ask for a reply. Do not include wallet secrets or passwords.",
        "operationId": "submitPrivacyRequest",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PrivacyRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted with request reference",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "requestId": {
                      "type": "string",
                      "format": "uuid"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request"
          },
          "429": {
            "description": "Rate limit reached"
          }
        }
      }
    },
    "/analyze": {
      "servers": [
        {
          "url": "https://rea-origin.unlovable.click",
          "description": "Authenticated agent runtime"
        }
      ],
      "post": {
        "tags": [
          "Agent — Paid Analysis"
        ],
        "summary": "Analyze submitted HTML (0.01 USDC on success)",
        "security": [
          {
            "agentBearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "html"
                ],
                "properties": {
                  "html": {
                    "type": "string",
                    "maxLength": 524288
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "REA evidence."
          },
          "402": {
            "description": "Insufficient prepaid credits."
          }
        }
      }
    },
    "/mcp": {
      "servers": [
        {
          "url": "https://rea-origin.unlovable.click",
          "description": "Authenticated agent runtime"
        }
      ],
      "post": {
        "tags": [
          "Agent — MCP"
        ],
        "summary": "Streamable HTTP MCP endpoint",
        "security": [
          {
            "agentBearer": []
          }
        ],
        "description": "tools/list is free. runtime_status and project management tools are free. Paid tools: analyze_html 0.01 USDC, scan_url/project_scan 0.03 USDC, compare_urls 0.05 USDC on success.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "JSON-RPC MCP request."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "MCP JSON-RPC response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/health": {
      "servers": [
        {
          "url": "https://rea-origin.unlovable.click",
          "description": "Authenticated agent runtime"
        }
      ],
      "get": {
        "tags": [
          "Agent — Runtime"
        ],
        "summary": "Runtime health",
        "description": "Authenticated runtime status endpoint.",
        "operationId": "getAgentRuntimeHealth",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Runtime health",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Bearer credential required"
          },
          "503": {
            "description": "Runtime unavailable"
          }
        }
      }
    },
    "/register": {
      "post": {
        "tags": [
          "Agent — Account"
        ],
        "summary": "Register an agent account and issue the first API key",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 80
                  },
                  "email": {
                    "type": "string",
                    "format": "email"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Account created; raw API key is returned once."
          },
          "400": {
            "description": "Invalid registration."
          },
          "429": {
            "description": "Registration rate limit."
          }
        }
      }
    },
    "/account": {
      "get": {
        "tags": [
          "Agent — Account"
        ],
        "summary": "Get account balance, keys, and usage totals",
        "security": [
          {
            "agentBearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "Account details.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/usage": {
      "get": {
        "tags": [
          "Agent — Account"
        ],
        "summary": "Get recent metered usage",
        "security": [
          {
            "agentBearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "Usage events.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/keys": {
      "post": {
        "tags": [
          "Agent — Account"
        ],
        "summary": "Create an additional API key (free)",
        "security": [
          {
            "agentBearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "New key returned once."
          }
        }
      }
    },
    "/keys/revoke": {
      "post": {
        "tags": [
          "Agent — Account"
        ],
        "summary": "Revoke an API key (free)",
        "security": [
          {
            "agentBearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "keyId"
                ],
                "properties": {
                  "keyId": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Key revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/topup/quote": {
      "post": {
        "tags": [
          "Agent — Credits"
        ],
        "summary": "Create a prepaid USDC top-up quote (minimum 5.00 USDC)",
        "security": [
          {
            "agentBearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "chain"
                ],
                "properties": {
                  "chain": {
                    "type": "string",
                    "enum": [
                      "solana",
                      "base"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Unique 5.00–5.99 USDC quote, network, receiver, token, and 30-minute expiry. No on-chain transaction is required for each subsequent API/MCP call.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/topup/verify": {
      "post": {
        "tags": [
          "Agent — Credits"
        ],
        "summary": "Verify a mainnet USDC transfer and credit the account",
        "security": [
          {
            "agentBearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "quoteId",
                  "txRef"
                ],
                "properties": {
                  "quoteId": {
                    "type": "string"
                  },
                  "txRef": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verified credit.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/scan": {
      "post": {
        "tags": [
          "Agent — Paid Analysis"
        ],
        "summary": "Fetch and analyze a public URL (0.03 USDC on success)",
        "security": [
          {
            "agentBearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "projectId": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Fetched page and REA evidence."
          },
          "402": {
            "description": "Insufficient prepaid credits."
          }
        }
      }
    },
    "/compare": {
      "post": {
        "tags": [
          "Agent — Paid Analysis"
        ],
        "summary": "Compare two public URLs (0.05 USDC on success)",
        "security": [
          {
            "agentBearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "urlA",
                  "urlB"
                ],
                "properties": {
                  "urlA": {
                    "type": "string",
                    "format": "uri"
                  },
                  "urlB": {
                    "type": "string",
                    "format": "uri"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Title, heading, and accessibility comparison."
          },
          "402": {
            "description": "Insufficient prepaid credits."
          }
        }
      }
    },
    "/projects": {
      "get": {
        "tags": [
          "Agent — Projects"
        ],
        "summary": "List active projects (free)",
        "security": [
          {
            "agentBearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "Projects.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Agent — Projects"
        ],
        "summary": "Create a project (free; up to five active projects)",
        "security": [
          {
            "agentBearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "notes": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Project created."
          }
        }
      }
    },
    "/projects/{projectId}": {
      "get": {
        "tags": [
          "Agent — Projects"
        ],
        "summary": "Get a project and latest scan (free)",
        "security": [
          {
            "agentBearer": []
          }
        ],
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Project details.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Agent — Projects"
        ],
        "summary": "Update a project (free)",
        "security": [
          {
            "agentBearer": []
          }
        ],
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "notes": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated project.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Agent — Projects"
        ],
        "summary": "Archive a project (free)",
        "security": [
          {
            "agentBearer": []
          }
        ],
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Archived project.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  }
}