Zum Hauptinhalt springen
6 Min. Lesedauer

GET /insights/:websiteId

Retrieve AI-generated insights for your website. Returns actionable observations including anomalies, trends, recommendations, and predictions based on your analytics data.

GET/api/external/v1/insights/:websiteId

Get AI-generated insights for a website

Authentication

All requests require an API key passed via the X-API-Key header. Alternatively, you can use the Authorization: Bearer YOUR_API_KEY header.

AuthenticationBash
curl -X GET 'https://api.zenovay.com/api/external/v1/insights/a1b2c3d4-e5f6-7890-abcd-ef1234567890?range=7d' \
-H 'X-API-Key: YOUR_API_KEY'

This endpoint requires a Pro plan or higher. Free-tier API keys will receive a 403 Forbidden response.

Credit Cost

Each request to this endpoint costs 1 API credit.

Parameters

NameTypeRequiredDefaultDescription
websiteIdstring (path)Yes-The UUID of the website
rangestring (query)No7dTime range: 24h, 7d, 30d, 90d
typestring (query)No-Filter by insight type: anomaly, trend, recommendation, prediction
severitystring (query)No-Filter by severity: info, warning, critical
limitinteger (query)No50Number of insights to return (max: 200)
offsetinteger (query)No0Number of records to skip for pagination

Response

Response (200 OK)JSON
{
"success": true,
"data": {
  "insights": [
    {
      "id": "ins_7a1b2c3d-4e5f-6789-abcd-ef0123456789",
      "type": "anomaly",
      "severity": "warning",
      "title": "Unusual traffic spike from Germany",
      "description": "Traffic from Germany increased by 340% compared to the 7-day average. This spike started at 14:00 UTC and is concentrated on the /pricing page.",
      "metric_name": "visitors_by_country",
      "metric_value": 1284,
      "metric_change": 340.5,
      "recommendation": "Investigate whether a marketing campaign or external link is driving this traffic. Consider localizing the pricing page for German visitors.",
      "created_at": "2026-03-16T14:30:00.000Z"
    },
    {
      "id": "ins_8b2c3d4e-5f6a-7890-bcde-f01234567890",
      "type": "trend",
      "severity": "info",
      "title": "Mobile traffic steadily increasing",
      "description": "Mobile visitor share has grown from 38% to 52% over the past 30 days, with a consistent upward trend of approximately 2% per week.",
      "metric_name": "mobile_share",
      "metric_value": 52.3,
      "metric_change": 14.3,
      "recommendation": "Prioritize mobile experience optimization. Test page load times on mobile devices and consider implementing AMP or responsive improvements.",
      "created_at": "2026-03-16T12:00:00.000Z"
    },
    {
      "id": "ins_9c3d4e5f-6a7b-8901-cdef-012345678901",
      "type": "recommendation",
      "severity": "info",
      "title": "High bounce rate on blog posts",
      "description": "Blog pages have a 78% bounce rate, significantly above your site average of 45%. Visitors from organic search are the most likely to bounce.",
      "metric_name": "bounce_rate",
      "metric_value": 78.2,
      "metric_change": -33.2,
      "recommendation": "Add related article suggestions, internal links, and clear CTAs to blog posts. Consider adding a table of contents for longer articles.",
      "created_at": "2026-03-16T10:15:00.000Z"
    }
  ],
  "pagination": {
    "total": 12,
    "limit": 50,
    "offset": 0,
    "has_more": false
  }
},
"timestamp": "2026-03-16T15:00:00.000Z"
}

Response Fields

FieldTypeDescription
insightsarrayList of AI-generated insight records
insights[].idstringUnique insight identifier
insights[].typestringInsight type: anomaly, trend, recommendation, prediction
insights[].severitystringSeverity level: info, warning, critical
insights[].titlestringShort summary of the insight
insights[].descriptionstringDetailed explanation of the insight
insights[].metric_namestringThe analytics metric this insight relates to
insights[].metric_valuenumberCurrent value of the metric
insights[].metric_changenumberPercentage change from the comparison period
insights[].recommendationstringActionable recommendation based on the insight
insights[].created_atstringISO 8601 timestamp when the insight was generated
pagination.totalnumberTotal number of matching insights
pagination.limitnumberRecords per page
pagination.offsetnumberCurrent offset
pagination.has_morebooleanWhether more records are available

TypeScript Interface

InsightsResponseTypeScript
interface Insight {
id: string;
type: 'anomaly' | 'trend' | 'recommendation' | 'prediction';
severity: 'info' | 'warning' | 'critical';
title: string;
description: string;
metric_name: string;
metric_value: number;
metric_change: number;
recommendation: string;
created_at: string;
}

interface InsightsResponse {
success: true;
data: {
  insights: Insight[];
  pagination: {
    total: number;
    limit: number;
    offset: number;
    has_more: boolean;
  };
};
timestamp: string;
}

HTTP Status Codes

Status CodeDescription
200Success
400Bad Request - Invalid parameters
401Unauthorized - Invalid or missing API key
403Forbidden - Pro plan or higher required
404Not Found - Website not found
429Too Many Requests - Rate limit exceeded
500Internal Server Error

Code Examples

cURLBash
curl -X GET 'https://api.zenovay.com/api/external/v1/insights/a1b2c3d4-e5f6-7890-abcd-ef1234567890?range=7d&type=anomaly&severity=warning' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json'

Error Handling

Error Response (403 Forbidden)JSON
{
"success": false,
"error": {
  "message": "This endpoint requires a Pro plan or higher",
  "code": "PLAN_REQUIRED",
  "timestamp": "2026-03-16T15:00:00.000Z"
}
}
War diese Seite hilfreich?