API Documentation
Programmatically access the Design Decoder analysis engine.

Analyze Website Endpoint

This endpoint allows you to retrieve an analysis for a given website URL. It will return a cached result if available, or perform a new analysis and cache it.

GET
/api/analyze

Parameters

  • url
    required

    The full URL of the website you want to analyze (e.g., `https://apple.com`).
  • refresh
    optional

    Set to `true` to force a new analysis, bypassing and overwriting any existing cached result.

Example Request

Using cURL to request a standard analysis:

curl 'https://<your-app-domain>/api/analyze?url=apple.com'

Using cURL to force a refresh:

curl 'https://<your-app-domain>/api/analyze?url=apple.com&refresh=true'

Response Object

The API returns a JSON object containing the full analysis. The structure matches the `AnalysisResult` type.

{
  "predictedTimestamp": "20230605170324",
  "beforeTimestamp": "20230501...",
  "predictedOriginal": "https://www.apple.com/",
  "beforeOriginal": "https://www.apple.com/",
  "data": [
    {
      "timestamp": "20220101...",
      "original": "https://www.apple.com/",
      "score": 0.05,
      "details": {
        "tagScore": 0.01,
        "classScore": 0.08,
        "assetScore": 0.02
      }
      // ... and so on for each snapshot
    }
  ],
  "analysisStrategy": "This prediction identifies..."
}

Error Handling

If an error occurs, the API will respond with a relevant HTTP status code and a JSON object containing an `error` message.

// Example: URL parameter is missing (400 Bad Request)
{
  "error": "URL parameter is required."
}

// Example: Analysis fails (500 Internal Server Error)
{
  "error": "No historical snapshots found for this website."
}