{"openapi":"3.1.0","info":{"title":"EEA Portal Backend","description":"Backend API","version":"1.0.0"},"paths":{"/health":{"get":{"summary":"Health","operationId":"health_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/email-creative/generate":{"post":{"tags":["Email Creative"],"summary":"Generate Email Creative","description":"Generate improved email creative and recommendations using AI\n\nArgs:\n    html_file: HTML file upload (mandatory)\n    guidelines: Campaign guidelines (optional)\n    insight_identifier: Campaign hash identifier from insights (optional, if report_id not provided)\n    report_id: Report ID (filename without .json extension) (optional, if insight_identifier not provided)\n    organization_id: Organization ID for org-level AI prompt config (optional)\n    tenant_id: Tenant ID for tenant-level AI prompt config (optional)\n\nReturns:\n    EmailCreativeResponse with download URLs for improved HTML and recommendations","operationId":"generate_email_creative_api_v1_email_creative_generate_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_generate_email_creative_api_v1_email_creative_generate_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailCreativeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/email-creative/generate-pdf":{"post":{"tags":["Email Creative"],"summary":"Generate Creative Report Pdf","description":"Generate creative report PDF; fetches improved HTML from GCS, returns PDF download URL.","operationId":"generate_creative_report_pdf_api_v1_email_creative_generate_pdf_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_generate_creative_report_pdf_api_v1_email_creative_generate_pdf_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreativeReportPdfResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/insights":{"post":{"tags":["Insights"],"summary":"Generate Insights","description":"Generate insights by triggering a workflow\n\nArgs:\n    request: GenerateInsightsRequest with providers list and campaign_names\n\nReturns:\n    GenerateInsightsResponse with workflow execution details","operationId":"generate_insights_api_v1_insights_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateInsightsRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateInsightsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/insights/generate-pdf":{"post":{"tags":["Insights"],"summary":"Generate Engagement Report Pdf","description":"Generate engagement report PDF (text-only); returns PDF download URL.\nRequires report_id or insight_identifier.","operationId":"generate_engagement_report_pdf_api_v1_insights_generate_pdf_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EngagementReportPdfRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EngagementReportPdfResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/campaigns/providers":{"get":{"tags":["Campaigns"],"summary":"Get Providers","description":"Get list of all available ESP providers.\n\nReturns:\n    ProvidersResponse with list of providers (id=enum key, name=capitalized enum value)","operationId":"get_providers_api_v1_campaigns_providers_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProvidersResponse"}}}}}}},"/api/v1/campaigns":{"get":{"tags":["Campaigns"],"summary":"Get Campaigns","description":"Get list of campaigns from Firestore.\n\nArgs:\n    search_term: Optional search term to filter campaigns by name (prefix match)\n    providers: Optional comma-separated string of provider enum keys (e.g., \"ADESTRA,PURESEND\")\n    limit: Optional limit on number of results (default: 1000, min: 1, max: 1000)\n    cursor: Optional cursor for pagination (document id of last item from previous page)\n\nReturns:\n    CampaignsResponse with list of campaigns and next_cursor for pagination","operationId":"get_campaigns_api_v1_campaigns_get","parameters":[{"name":"search_term","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Search term to filter campaigns by name (prefix match)","title":"Search Term"},"description":"Search term to filter campaigns by name (prefix match)"},{"name":"providers","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Comma-separated list of provider enum keys to filter by (e.g., 'ADESTRA,PURESEND')","title":"Providers"},"description":"Comma-separated list of provider enum keys to filter by (e.g., 'ADESTRA,PURESEND')"},{"name":"limit","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","maximum":1000,"minimum":1},{"type":"null"}],"description":"Maximum number of campaigns to return","title":"Limit"},"description":"Maximum number of campaigns to return"},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Document id cursor for pagination (id of last item from previous page)","title":"Cursor"},"description":"Document id cursor for pagination (id of last item from previous page)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/report":{"post":{"tags":["Reports"],"summary":"Save Report","description":"Save a report to Google Cloud Storage.\n\nUse the `report_type` query parameter to select the report type:\n\n**`report_type=email_analytics`** (default):\n- Body must include: `report_name`, `report_data` (InsightsData structure), `esps`, `campaign_names`\n- Optional: `insight_identifier`\n- Behavior: updates an existing report with the same name (overwrite), or creates a new one.\n\n**`report_type=website_analytics`**:\n- Body must include: `report_name`, `report_data` (full website analytics payload)\n- Overwrites the most recent existing website analytics report with the same name, or creates a new one.\n- Website analytics report IDs are prefixed with `wa_` to prevent collision with email analytics IDs.","operationId":"save_report_api_v1_report_post","parameters":[{"name":"report_type","in":"query","required":false,"schema":{"$ref":"#/components/schemas/ReportType","description":"Report type to save. 'email_analytics' (default) or 'website_analytics'.","default":"email_analytics"},"description":"Report type to save. 'email_analytics' (default) or 'website_analytics'."},{"name":"x-user-token","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"JWT token for user authentication","title":"X-User-Token"},"description":"JWT token for user authentication"},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Tenant scope from X-Tenant-ID header","title":"X-Tenant-Id"},"description":"Tenant scope from X-Tenant-ID header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveReportUnifiedRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveReportResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/report/check-exists":{"get":{"tags":["Reports"],"summary":"Check Report Exists By Name","description":"Check if reports with the exact name exist for the given report type.\n\nThe check is scoped to the specified `report_type` — a website analytics report named\n\"My Report\" will NOT appear in results when `report_type=email_analytics`, and vice versa.\n\nReturns:\n    CheckReportExistsResponse with list of matching report IDs (empty if none found)","operationId":"check_report_exists_by_name_api_v1_report_check_exists_get","parameters":[{"name":"report_name","in":"query","required":true,"schema":{"type":"string","description":"The exact name of the report to search for","title":"Report Name"},"description":"The exact name of the report to search for"},{"name":"report_type","in":"query","required":false,"schema":{"$ref":"#/components/schemas/ReportType","description":"Report type scope for the check. Defaults to 'email_analytics'.","default":"email_analytics"},"description":"Report type scope for the check. Defaults to 'email_analytics'."},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Tenant scope from X-Tenant-ID header","title":"X-Tenant-Id"},"description":"Tenant scope from X-Tenant-ID header"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckReportExistsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/reports":{"get":{"tags":["Reports"],"summary":"Get Reports","description":"Get paginated reports from Google Cloud Storage.\n\nOptionally filter by one or more report types via `report_types`.\nOmitting `report_types` returns all reports regardless of type.\nEach report item includes a `report_type` field.","operationId":"get_reports_api_v1_reports_get","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"description":"Page number","default":1,"title":"Page"},"description":"Page number"},{"name":"pageSize","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"Number of items per page","default":10,"title":"Pagesize"},"description":"Number of items per page"},{"name":"sortOrder","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/SortOrder"},{"type":"null"}],"description":"Sort order: 'asc' or 'desc'","title":"Sortorder"},"description":"Sort order: 'asc' or 'desc'"},{"name":"sortBy","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Field to sort by (e.g., 'report_name', 'created_at', 'last_edited_at')","title":"Sortby"},"description":"Field to sort by (e.g., 'report_name', 'created_at', 'last_edited_at')"},{"name":"report_types","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/ReportType"}},{"type":"null"}],"description":"Filter by report type(s). Accepts 'email_analytics' and/or 'website_analytics'. Omit to return all types.","title":"Report Types"},"description":"Filter by report type(s). Accepts 'email_analytics' and/or 'website_analytics'. Omit to return all types."},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Tenant scope from X-Tenant-ID header","title":"X-Tenant-Id"},"description":"Tenant scope from X-Tenant-ID header"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetReportsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/reports/statistics":{"get":{"tags":["Reports"],"summary":"Get Reports Statistics","description":"Get overall statistics for reports, optionally filtered by type.\n\nNote: `unique_campaigns_count` reflects only email analytics campaigns.\nIt will be 0 when filtering by `website_analytics` only.","operationId":"get_reports_statistics_api_v1_reports_statistics_get","parameters":[{"name":"report_types","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/ReportType"}},{"type":"null"}],"description":"Filter statistics by report type(s). Omit for aggregate across all types.","title":"Report Types"},"description":"Filter statistics by report type(s). Omit for aggregate across all types."},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Tenant scope from X-Tenant-ID header","title":"X-Tenant-Id"},"description":"Tenant scope from X-Tenant-ID header"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportsStatisticsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/reports/{report_id}":{"get":{"tags":["Reports"],"summary":"Get Report By Id","description":"Get a report by its ID from Google Cloud Storage.\n\nWorks for both email analytics and website analytics reports. The `report_type`\nis detected from GCS metadata and returned in the response.\n\nWebsite analytics report IDs start with `wa_`.","operationId":"get_report_by_id_api_v1_reports__report_id__get","parameters":[{"name":"report_id","in":"path","required":true,"schema":{"type":"string","title":"Report Id"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Tenant scope from X-Tenant-ID header","title":"X-Tenant-Id"},"description":"Tenant scope from X-Tenant-ID header"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetReportResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Reports"],"summary":"Delete Report","description":"Delete a report by its ID from Google Cloud Storage.\n\nWorks for both email analytics and website analytics reports.","operationId":"delete_report_api_v1_reports__report_id__delete","parameters":[{"name":"report_id","in":"path","required":true,"schema":{"type":"string","title":"Report Id"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Tenant scope from X-Tenant-ID header","title":"X-Tenant-Id"},"description":"Tenant scope from X-Tenant-ID header"}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/ai-config":{"put":{"tags":["AI Config"],"summary":"Upsert Ai Config","description":"Create or update AI config for one or more scopes.\n\nAt least one of ``global_config``, ``organization_config``, or\n``tenant_config`` must be present.\n\n- ``global_config`` requires no ID.\n- ``organization_config`` requires ``organization_id``.\n- ``tenant_config`` requires ``tenant_id``.","operationId":"upsert_ai_config_api_v1_ai_config_put","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpsertAiConfigRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpsertAiConfigResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["AI Config"],"summary":"Get Ai Config","description":"Get AI config for the requested scopes.\n\nWhen ``scopes`` is omitted, all three scopes are returned.\nA scope that requires an ID but has none is silently skipped (not 400).","operationId":"get_ai_config_api_v1_ai_config_get","parameters":[{"name":"scopes","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Comma-separated list of scopes to return: global, organization, tenant. Omit to return all three. organization requires organization_id; tenant requires tenant_id; global requires no ID.","title":"Scopes"},"description":"Comma-separated list of scopes to return: global, organization, tenant. Omit to return all three. organization requires organization_id; tenant requires tenant_id; global requires no ID."},{"name":"organization_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Organization ID","title":"Organization Id"},"description":"Organization ID"},{"name":"tenant_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Tenant ID","title":"Tenant Id"},"description":"Tenant ID"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetAiConfigResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["AI Config"],"summary":"Delete Ai Config","description":"Delete config for the requested scope(s).\n\n- ``scopes`` is required and must contain at least one valid scope.\n- ``organization`` scope requires ``organization_id``.\n- ``tenant`` scope requires ``tenant_id``.\n- ``global`` scope requires no ID.","operationId":"delete_ai_config_api_v1_ai_config_delete","parameters":[{"name":"scopes","in":"query","required":true,"schema":{"type":"string","description":"Comma-separated list of scopes to delete: global, organization, tenant. At least one scope is required. organization requires organization_id; tenant requires tenant_id; global requires no ID.","title":"Scopes"},"description":"Comma-separated list of scopes to delete: global, organization, tenant. At least one scope is required. organization requires organization_id; tenant requires tenant_id; global requires no ID."},{"name":"organization_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Organization ID","title":"Organization Id"},"description":"Organization ID"},{"name":"tenant_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Tenant ID","title":"Tenant Id"},"description":"Tenant ID"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteAiConfigResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/audience/generate-smart-naming":{"post":{"tags":["Audiences"],"summary":"Generate Smart Naming","description":"Generate smart naming (title, description, includes, excludes, adds) for an audience\nfrom its nodes and edges using AI. Title and description are editable by the client.\n\nRequest body: nodes and edges.","operationId":"generate_smart_naming_api_v1_audience_generate_smart_naming_post","parameters":[{"name":"tenantID","in":"query","required":true,"schema":{"type":"string","description":"Tenant ID","title":"Tenantid"},"description":"Tenant ID"},{"name":"organizationID","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Organization ID for org-level AI config. Optional.","title":"Organizationid"},"description":"Organization ID for org-level AI config. Optional."},{"name":"X-User-Token","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-User-Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateSmartNamingRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateSmartNamingResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/website-analytics":{"post":{"tags":["Website Analytics"],"summary":"Get Website Analytics report","description":"Proxy endpoint that calls the Website Analytics Agent function and returns its response.","operationId":"get_website_analytics_report_api_v1_website_analytics_post","parameters":[{"name":"x-user-token","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"JWT token for user authentication","title":"X-User-Token"},"description":"JWT token for user authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebsiteAnalyticsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebsiteAnalyticsReportResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/website-analytics/pdf":{"post":{"tags":["Website Analytics"],"summary":"Generate Website Analytics PDF","description":"Generate website analytics report PDF; returns PDF download URL.","operationId":"generate_website_analytics_report_pdf_api_v1_website_analytics_pdf_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebsiteAnalyticsReportPdfRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebsiteAnalyticsReportPdfResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/audience/criteria-description":{"post":{"tags":["Audience Criteria Description"],"summary":"Generate Criteria Description","description":"Generate a human-readable description of audience criteria from nodes and edges.\n\nRequest body: nodes and edges from the audience criteria graph.\nReturns a single ``criteria_description`` string.","operationId":"generate_criteria_description_api_v1_audience_criteria_description_post","parameters":[{"name":"tenantID","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Tenant ID. Optional.","title":"Tenantid"},"description":"Tenant ID. Optional."},{"name":"organizationID","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Organization ID for org-level AI config. Optional.","title":"Organizationid"},"description":"Organization ID for org-level AI config. Optional."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CriteriaDescriptionRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CriteriaDescriptionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"AgentConfigItem":{"properties":{"key":{"type":"string","title":"Key"},"prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Prompt"},"output_detail":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Output Detail"},"temperature":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Temperature"},"max_output_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Output Tokens"}},"type":"object","required":["key"],"title":"AgentConfigItem","description":"One agent's configurable settings inside a tenant PUT request."},"AgentConfigResponse":{"properties":{"key":{"type":"string","title":"Key"},"display_name":{"type":"string","title":"Display Name"},"prompt":{"$ref":"#/components/schemas/AgentPromptField"},"temperature":{"anyOf":[{"$ref":"#/components/schemas/AgentNumericField"},{"type":"null"}]},"max_output_tokens":{"anyOf":[{"$ref":"#/components/schemas/AgentNumericField"},{"type":"null"}]},"output_detail":{"anyOf":[{"$ref":"#/components/schemas/AgentEnumField"},{"type":"null"}]}},"type":"object","required":["key","display_name","prompt"],"title":"AgentConfigResponse","description":"One tenant agent entry in the enriched agents[] array on GET."},"AgentEnumField":{"properties":{"value":{"title":"Value"},"info":{"type":"string","title":"Info"},"options":{"items":{"$ref":"#/components/schemas/EnumOption"},"type":"array","title":"Options"},"default":{"type":"string","title":"Default"}},"type":"object","required":["value","info","options","default"],"title":"AgentEnumField","description":"Enriched enum agent field (output_detail) returned on GET."},"AgentNumericField":{"properties":{"value":{"title":"Value"},"info":{"type":"string","title":"Info"},"min":{"type":"number","title":"Min"},"max":{"type":"number","title":"Max"},"default":{"title":"Default"}},"type":"object","required":["value","info","min","max","default"],"title":"AgentNumericField","description":"Enriched numeric agent field (temperature, max_output_tokens) returned on GET."},"AgentPromptField":{"properties":{"value":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Value"},"prompt_info":{"type":"string","title":"Prompt Info"}},"type":"object","required":["prompt_info"],"title":"AgentPromptField","description":"Enriched per-agent prompt field returned on GET."},"BannedWordsField":{"properties":{"value":{"items":{"type":"string"},"type":"array","title":"Value"},"info":{"type":"string","title":"Info"}},"type":"object","required":["value","info"],"title":"BannedWordsField","description":"Enriched banned_words field returned on GET."},"Body_generate_creative_report_pdf_api_v1_email_creative_generate_pdf_post":{"properties":{"recommendations":{"type":"string","title":"Recommendations","description":"JSON array of recommendations"},"original_html":{"type":"string","format":"binary","title":"Original Html"},"current_time":{"type":"string","title":"Current Time","description":"'Generated at' date/time in user timezone"},"report_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Report Id"},"insight_identifier":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Insight Identifier"},"guidelines":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Guidelines"},"title":{"type":"string","title":"Title","description":"Report title for PDF header","default":"Email Creative Analysis Report"}},"type":"object","required":["recommendations","original_html","current_time"],"title":"Body_generate_creative_report_pdf_api_v1_email_creative_generate_pdf_post"},"Body_generate_email_creative_api_v1_email_creative_generate_post":{"properties":{"html_file":{"type":"string","format":"binary","title":"Html File"},"guidelines":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Guidelines"},"insight_identifier":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Insight Identifier"},"report_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Report Id"},"organization_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Organization Id"},"tenant_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tenant Id"}},"type":"object","required":["html_file"],"title":"Body_generate_email_creative_api_v1_email_creative_generate_post"},"CampaignItem":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"}},"type":"object","required":["id","name"],"title":"CampaignItem","description":"Campaign item in campaigns list response."},"CampaignsResponse":{"properties":{"campaigns":{"items":{"$ref":"#/components/schemas/CampaignItem"},"type":"array","title":"Campaigns"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["campaigns"],"title":"CampaignsResponse","description":"Response model for campaigns list."},"CheckReportExistsResponse":{"properties":{"report_ids":{"items":{"type":"string"},"type":"array","title":"Report Ids"}},"type":"object","required":["report_ids"],"title":"CheckReportExistsResponse","description":"Response model for checking if reports exist by name"},"CreativeReportPdfResponse":{"properties":{"pdf_url":{"type":"string","title":"Pdf Url"}},"type":"object","required":["pdf_url"],"title":"CreativeReportPdfResponse","description":"Response model for creative report PDF generation."},"CriteriaDescriptionRequest":{"properties":{"nodes":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Nodes"},"edges":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Edges"}},"type":"object","title":"CriteriaDescriptionRequest","description":"Request body: nodes and edges from the audience criteria graph."},"CriteriaDescriptionResponse":{"properties":{"criteria_description":{"type":"string","title":"Criteria Description"}},"type":"object","required":["criteria_description"],"title":"CriteriaDescriptionResponse","description":"Response model for criteria description generation."},"DeleteAiConfigResponse":{"properties":{"message":{"type":"string","title":"Message","default":"Config deleted successfully"}},"type":"object","title":"DeleteAiConfigResponse","description":"Response after delete config."},"EmailCreativeResponse":{"properties":{"html_download_url":{"type":"string","title":"Html Download Url"},"recommendations":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Recommendations"}},"type":"object","required":["html_download_url","recommendations"],"title":"EmailCreativeResponse","description":"Response model for email creative improvement"},"EngagementReportData":{"properties":{"insights":{"$ref":"#/components/schemas/InsightsPayload"},"metrics":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metrics","description":"Key performance metrics; may include top_clicked_links."},"audience_segments":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Audience Segments"}},"type":"object","title":"EngagementReportData","description":"Payload under insights.data: matches what FE receives from generate-insights."},"EngagementReportPdfRequest":{"properties":{"current_time":{"type":"string","title":"Current Time","description":"Generated at date/time in user timezone (ISO 8601)"},"title":{"type":"string","title":"Title","description":"Report title for PDF header","default":"Email Engagement Report"},"report_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Report Id","description":"Report identifier (report_* prefix added if missing)."},"insight_identifier":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Insight Identifier","description":"Insight identifier (insights_* prefix added if missing)."},"insights":{"$ref":"#/components/schemas/InsightsWrapper","description":"insights.data: insights.insights, metrics, audience_segments."}},"type":"object","required":["current_time","insights"],"title":"EngagementReportPdfRequest","description":"JSON request body for POST /insights/generate-pdf."},"EngagementReportPdfResponse":{"properties":{"pdf_url":{"type":"string","title":"Pdf Url"}},"type":"object","required":["pdf_url"],"title":"EngagementReportPdfResponse","description":"Response model for engagement report PDF generation."},"EnumOption":{"properties":{"key":{"type":"string","title":"Key"},"display_name":{"type":"string","title":"Display Name"}},"type":"object","required":["key","display_name"],"title":"EnumOption","description":"One selectable enum value returned on GET."},"GenerateInsightsRequest":{"properties":{"providers":{"items":{"type":"string"},"type":"array","title":"Providers"},"campaign_names":{"items":{"type":"string"},"type":"array","title":"Campaign Names"},"organization_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Organization Id"},"tenant_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tenant Id"}},"type":"object","required":["providers","campaign_names"],"title":"GenerateInsightsRequest","description":"Accepts provider enum keys (e.g., \"ADESTRA\") as strings.\nThe route handler will convert them to enum values (e.g., \"adestra\")."},"GenerateInsightsResponse":{"properties":{"insights":{"additionalProperties":true,"type":"object","title":"Insights"}},"type":"object","required":["insights"],"title":"GenerateInsightsResponse","description":"Response model for generating insights - returns the actual insights content from the engagement agent"},"GenerateSmartNamingRequest":{"properties":{"nodes":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Nodes"},"edges":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Edges"}},"type":"object","title":"GenerateSmartNamingRequest","description":"Request body: nodes and edges."},"GenerateSmartNamingResponse":{"properties":{"title":{"type":"string","title":"Title"},"description":{"type":"string","title":"Description"},"includes":{"type":"string","title":"Includes"},"excludes":{"type":"string","title":"Excludes"},"adds":{"type":"string","title":"Adds"}},"type":"object","required":["title","description","includes","excludes","adds"],"title":"GenerateSmartNamingResponse","description":"Response model for generating smart naming"},"GetAiConfigResponse":{"properties":{"organization_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Organization Id"},"tenant_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tenant Id"},"global_config":{"anyOf":[{"$ref":"#/components/schemas/GlobalConfigResponse"},{"type":"null"}]},"organization_config":{"anyOf":[{"$ref":"#/components/schemas/OrganizationConfigResponse"},{"type":"null"}]},"tenant_config":{"anyOf":[{"$ref":"#/components/schemas/TenantConfigResponse"},{"type":"null"}]}},"type":"object","title":"GetAiConfigResponse","description":"Enriched AI config response.\n\nOnly the requested scopes are present.  A scope absent from the response\nmeans it was not requested (or its required ID was not supplied)."},"GetReportResponse":{"properties":{"report":{"$ref":"#/components/schemas/ReportDataResponse"}},"type":"object","required":["report"],"title":"GetReportResponse","description":"Response model for getting a single report by ID"},"GetReportsResponse":{"properties":{"reports":{"items":{"$ref":"#/components/schemas/ReportItemResponse"},"type":"array","title":"Reports"},"pagination":{"$ref":"#/components/schemas/PaginationResponse"}},"type":"object","required":["reports","pagination"],"title":"GetReportsResponse","description":"Response model for getting paginated reports"},"GlobalConfig":{"properties":{"banned_words":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Banned Words"},"settings":{"anyOf":[{"items":{"$ref":"#/components/schemas/GlobalSettingItem"},"type":"array"},{"type":"null"}],"title":"Settings"}},"type":"object","title":"GlobalConfig","description":"Platform-wide AI config on PUT.\n\n``banned_words`` replaces the stored list; omitting it leaves it unchanged.\n``settings`` is a partial list of ``{key, value}`` items — only provided\nkeys are updated; unknown keys and duplicates are rejected."},"GlobalConfigResponse":{"properties":{"banned_words":{"$ref":"#/components/schemas/BannedWordsField"},"setting_categories":{"items":{"$ref":"#/components/schemas/GlobalSettingCategory"},"type":"array","title":"Setting Categories"}},"type":"object","required":["banned_words","setting_categories"],"title":"GlobalConfigResponse","description":"Enriched global (platform-wide) config returned on GET."},"GlobalSettingCategory":{"properties":{"key":{"type":"string","title":"Key"},"display_name":{"type":"string","title":"Display Name"},"info":{"type":"string","title":"Info"},"settings":{"items":{"$ref":"#/components/schemas/GlobalSettingField"},"type":"array","title":"Settings"}},"type":"object","required":["key","display_name","info","settings"],"title":"GlobalSettingCategory","description":"One enriched global settings category returned on GET."},"GlobalSettingField":{"properties":{"key":{"type":"string","title":"Key"},"display_name":{"type":"string","title":"Display Name"},"value":{"type":"integer","title":"Value"},"info":{"type":"string","title":"Info"},"min":{"type":"integer","title":"Min"},"max":{"type":"integer","title":"Max"},"default":{"type":"integer","title":"Default"}},"type":"object","required":["key","display_name","value","info","min","max","default"],"title":"GlobalSettingField","description":"One enriched global setting entry returned on GET (inside a category)."},"GlobalSettingItem":{"properties":{"key":{"type":"string","title":"Key"},"value":{"type":"integer","title":"Value"}},"type":"object","required":["key","value"],"title":"GlobalSettingItem","description":"One global setting entry on PUT (mirrors agents[].key pattern)."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"InsightsPayload":{"properties":{"insights":{"items":{"$ref":"#/components/schemas/RecommendationCategory"},"type":"array","title":"Insights"}},"type":"object","title":"InsightsPayload","description":"Nested insights container: same shape as generate-insights response."},"InsightsWrapper":{"properties":{"data":{"$ref":"#/components/schemas/EngagementReportData","description":"insights.data: audience_segments, insights.insights, metrics."}},"type":"object","required":["data"],"title":"InsightsWrapper","description":"Insights payload: data only (insight_identifier is at request top level)."},"Item":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"}},"type":"object","required":["id","name"],"title":"Item","description":"API response model for an item with id and name"},"OrgAgentConfigItem":{"properties":{"key":{"type":"string","title":"Key"},"prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Prompt"}},"type":"object","required":["key"],"title":"OrgAgentConfigItem","description":"One agent's organization-level settings on PUT.\n\nOrganization agents store prompt only (no temperature / tokens / detail)."},"OrgAgentConfigResponse":{"properties":{"key":{"type":"string","title":"Key"},"display_name":{"type":"string","title":"Display Name"},"prompt":{"$ref":"#/components/schemas/AgentPromptField"}},"type":"object","required":["key","display_name","prompt"],"title":"OrgAgentConfigResponse","description":"One organization agent entry (prompt only) on GET."},"OrganizationConfig":{"properties":{"banned_words":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Banned Words"},"agents":{"anyOf":[{"items":{"$ref":"#/components/schemas/OrgAgentConfigItem"},"type":"array"},{"type":"null"}],"title":"Agents"}},"type":"object","title":"OrganizationConfig","description":"Allowed keys for organization-level AI config on PUT. Extra keys are ignored."},"OrganizationConfigResponse":{"properties":{"banned_words":{"$ref":"#/components/schemas/BannedWordsField"},"agents":{"items":{"$ref":"#/components/schemas/OrgAgentConfigResponse"},"type":"array","title":"Agents"}},"type":"object","required":["banned_words","agents"],"title":"OrganizationConfigResponse","description":"Enriched org config returned on GET."},"PaginationResponse":{"properties":{"page":{"type":"integer","title":"Page"},"pageSize":{"type":"integer","title":"Pagesize"},"totalItems":{"type":"integer","title":"Totalitems"},"totalPages":{"type":"integer","title":"Totalpages"},"sortOrder":{"anyOf":[{"$ref":"#/components/schemas/SortOrder"},{"type":"null"}]},"sortBy":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sortby"}},"type":"object","required":["page","pageSize","totalItems","totalPages","sortOrder","sortBy"],"title":"PaginationResponse","description":"Pagination information"},"ProviderItem":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"}},"type":"object","required":["id","name"],"title":"ProviderItem","description":"Provider item in providers list response."},"ProvidersResponse":{"properties":{"providers":{"items":{"$ref":"#/components/schemas/ProviderItem"},"type":"array","title":"Providers"}},"type":"object","required":["providers"],"title":"ProvidersResponse","description":"Response model for providers list."},"RecommendationCategory":{"properties":{"title":{"type":"string","title":"Title"},"sections":{"items":{"$ref":"#/components/schemas/RecommendationSection"},"type":"array","title":"Sections"}},"type":"object","required":["title"],"title":"RecommendationCategory","description":"A top-level recommendation category (e.g. Content Analysis)."},"RecommendationSection":{"properties":{"title":{"type":"string","title":"Title"},"bullet_points":{"items":{"type":"string"},"type":"array","title":"Bullet Points"}},"type":"object","required":["title"],"title":"RecommendationSection","description":"A section within a recommendation category."},"ReportDataResponse":{"properties":{"report_type":{"$ref":"#/components/schemas/Item"},"campaigns":{"items":{"$ref":"#/components/schemas/Item"},"type":"array","title":"Campaigns"},"esps":{"items":{"$ref":"#/components/schemas/Item"},"type":"array","title":"Esps"},"data":{"additionalProperties":true,"type":"object","title":"Data"}},"type":"object","required":["report_type","campaigns","esps","data"],"title":"ReportDataResponse","description":"API response model for a report extended with esps field"},"ReportItemResponse":{"properties":{"report_id":{"type":"string","title":"Report Id"},"report_name":{"type":"string","title":"Report Name"},"report_type":{"$ref":"#/components/schemas/Item"},"esps":{"items":{"$ref":"#/components/schemas/Item"},"type":"array","title":"Esps"},"created_by":{"type":"string","title":"Created By"},"last_edited_by":{"type":"string","title":"Last Edited By"},"campaigns":{"items":{"$ref":"#/components/schemas/Item"},"type":"array","title":"Campaigns"},"created_at":{"type":"string","title":"Created At"},"last_edited_at":{"type":"string","title":"Last Edited At"}},"type":"object","required":["report_id","report_name","report_type","esps","created_by","last_edited_by","campaigns","created_at","last_edited_at"],"title":"ReportItemResponse","description":"API response model for a report item"},"ReportType":{"type":"string","enum":["email_analytics","website_analytics"],"title":"ReportType"},"ReportsStatisticsResponse":{"properties":{"total_reports":{"type":"integer","title":"Total Reports"},"unique_campaigns_count":{"type":"integer","title":"Unique Campaigns Count"},"most_recent_report_date":{"type":"string","title":"Most Recent Report Date"}},"type":"object","required":["total_reports","unique_campaigns_count","most_recent_report_date"],"title":"ReportsStatisticsResponse","description":"Response model for reports statistics"},"SaveReportResponse":{"properties":{"report_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Report Id"}},"type":"object","title":"SaveReportResponse","description":"Response model for saving a report"},"SaveReportUnifiedRequest":{"properties":{"report_name":{"type":"string","title":"Report Name"},"report_data":{"title":"Report Data"},"esps":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Esps"},"campaign_names":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Campaign Names"},"insight_identifier":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Insight Identifier"}},"type":"object","required":["report_name","report_data"],"title":"SaveReportUnifiedRequest","description":"Unified request body for POST /report.\n\nFor report_type=email_analytics (default):\n  Required: report_name, report_data (InsightsData structure), esps, campaign_names\n  Optional: insight_identifier\n\nFor report_type=website_analytics:\n  Required: report_name, report_data (full website analytics payload dict)"},"SortOrder":{"type":"string","enum":["asc","desc"],"title":"SortOrder"},"TenantConfig":{"properties":{"banned_words":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Banned Words"},"agents":{"anyOf":[{"items":{"$ref":"#/components/schemas/AgentConfigItem"},"type":"array"},{"type":"null"}],"title":"Agents"}},"type":"object","title":"TenantConfig","description":"Allowed keys for tenant-level AI config on PUT. Extra keys are ignored."},"TenantConfigResponse":{"properties":{"banned_words":{"$ref":"#/components/schemas/BannedWordsField"},"agents":{"items":{"$ref":"#/components/schemas/AgentConfigResponse"},"type":"array","title":"Agents"}},"type":"object","required":["banned_words","agents"],"title":"TenantConfigResponse","description":"Enriched tenant config returned on GET."},"UpsertAiConfigRequest":{"properties":{"organization_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Organization Id"},"tenant_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tenant Id"},"global_config":{"anyOf":[{"$ref":"#/components/schemas/GlobalConfig"},{"type":"null"}]},"organization_config":{"anyOf":[{"$ref":"#/components/schemas/OrganizationConfig"},{"type":"null"}]},"tenant_config":{"anyOf":[{"$ref":"#/components/schemas/TenantConfig"},{"type":"null"}]}},"type":"object","title":"UpsertAiConfigRequest","description":"Create or update AI config.  Partial update: only keys present in the config\nare updated.\n\n- Key not sent: leave existing value unchanged.\n- Key sent with null or empty string: save as empty.\n- Key sent with value: save that value.\n\nUnknown/read-only fields (e.g. prompt_info) are silently ignored.\nTop-level ``prompt`` is no longer accepted (use ``agents[].prompt``).\n\nAt least one of ``global_config``, ``organization_config``, or\n``tenant_config`` must be present.  Each present org/tenant config\nrequires its respective ID; ``global_config`` requires no ID."},"UpsertAiConfigResponse":{"properties":{"message":{"type":"string","title":"Message","default":"Config updated successfully"}},"type":"object","title":"UpsertAiConfigResponse","description":"Response after create/update config."},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"WebsiteAnalyticsAppliedFilters":{"properties":{"pageFilter":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pagefilter"},"urlPattern":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Urlpattern"},"eventFilter":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Eventfilter"},"startDate":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Startdate"},"endDate":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Enddate"}},"type":"object","title":"WebsiteAnalyticsAppliedFilters"},"WebsiteAnalyticsChildrenItem":{"properties":{"hasChildren":{"type":"boolean","title":"Haschildren"},"label":{"type":"string","title":"Label"},"count":{"type":"integer","title":"Count","default":0},"percentage":{"type":"number","title":"Percentage","default":0.0}},"type":"object","required":["hasChildren","label"],"title":"WebsiteAnalyticsChildrenItem"},"WebsiteAnalyticsDistributionItem":{"properties":{"label":{"type":"string","title":"Label"},"count":{"type":"integer","title":"Count","default":0},"percentage":{"type":"number","title":"Percentage","default":0.0}},"type":"object","required":["label"],"title":"WebsiteAnalyticsDistributionItem"},"WebsiteAnalyticsEngagement":{"properties":{"totalVisits":{"type":"integer","title":"Totalvisits","default":0},"totalVisitors":{"type":"integer","title":"Totalvisitors","default":0},"identifiedVisits":{"type":"integer","title":"Identifiedvisits","default":0},"identifiedVisitors":{"type":"integer","title":"Identifiedvisitors","default":0},"matchRate":{"type":"number","title":"Matchrate","default":0.0},"dateRange":{"type":"string","title":"Daterange","default":""}},"type":"object","title":"WebsiteAnalyticsEngagement"},"WebsiteAnalyticsEventItem":{"properties":{"eventId":{"type":"integer","title":"Eventid"},"eventName":{"type":"string","title":"Eventname"},"eventTag":{"type":"string","title":"Eventtag"},"count":{"type":"integer","title":"Count","default":0},"percentage":{"type":"number","title":"Percentage","default":0.0}},"type":"object","required":["eventId","eventName","eventTag"],"title":"WebsiteAnalyticsEventItem"},"WebsiteAnalyticsEventTracking":{"properties":{"abandonedSessions":{"type":"integer","title":"Abandonedsessions","default":0},"abandonedCarts":{"type":"integer","title":"Abandonedcarts","default":0},"productViews":{"type":"integer","title":"Productviews","default":0},"brandComparisons":{"type":"integer","title":"Brandcomparisons","default":0},"purchaseConversions":{"type":"integer","title":"Purchaseconversions","default":0},"loyaltySignups":{"type":"integer","title":"Loyaltysignups","default":0},"events":{"items":{"$ref":"#/components/schemas/WebsiteAnalyticsEventItem"},"type":"array","title":"Events"}},"type":"object","title":"WebsiteAnalyticsEventTracking"},"WebsiteAnalyticsGeoStateItem":{"properties":{"stateCode":{"type":"string","title":"Statecode"},"stateName":{"type":"string","title":"Statename"},"count":{"type":"integer","title":"Count","default":0},"percentage":{"type":"number","title":"Percentage","default":0.0}},"type":"object","required":["stateCode","stateName"],"title":"WebsiteAnalyticsGeoStateItem"},"WebsiteAnalyticsHousehold":{"properties":{"men":{"type":"integer","title":"Men","default":0},"women":{"type":"integer","title":"Women","default":0},"adults":{"type":"integer","title":"Adults","default":0},"children":{"type":"integer","title":"Children","default":0},"totalHouseholds":{"type":"integer","title":"Totalhouseholds","default":0}},"type":"object","title":"WebsiteAnalyticsHousehold"},"WebsiteAnalyticsInsightSection":{"properties":{"title":{"type":"string","title":"Title"},"subsections":{"items":{"$ref":"#/components/schemas/WebsiteAnalyticsInsightSubsection"},"type":"array","title":"Subsections"}},"type":"object","required":["title"],"title":"WebsiteAnalyticsInsightSection"},"WebsiteAnalyticsInsightSubsection":{"properties":{"title":{"type":"string","title":"Title"},"bullet_points":{"items":{"type":"string"},"type":"array","title":"Bullet Points"}},"type":"object","required":["title"],"title":"WebsiteAnalyticsInsightSubsection"},"WebsiteAnalyticsInsightsGroup":{"properties":{"title":{"type":"string","title":"Title"},"subsections":{"items":{"$ref":"#/components/schemas/WebsiteAnalyticsInsightsSection"},"type":"array","title":"Subsections"}},"type":"object","required":["title"],"title":"WebsiteAnalyticsInsightsGroup"},"WebsiteAnalyticsInsightsSection":{"properties":{"title":{"type":"string","title":"Title"},"bullet_points":{"items":{"type":"string"},"type":"array","title":"Bullet Points"}},"type":"object","required":["title"],"title":"WebsiteAnalyticsInsightsSection"},"WebsiteAnalyticsLeadCapture":{"properties":{"highIntentSessions":{"type":"integer","title":"Highintentsessions","default":0},"preActivationLeads":{"type":"integer","title":"Preactivationleads","default":0},"b2bSalesLeads":{"type":"integer","title":"B2Bsalesleads","default":0},"potentialOpportunities":{"type":"integer","title":"Potentialopportunities","default":0}},"type":"object","title":"WebsiteAnalyticsLeadCapture"},"WebsiteAnalyticsMetricsPayload":{"properties":{"appliedFilters":{"$ref":"#/components/schemas/WebsiteAnalyticsAppliedFilters"},"engagement":{"$ref":"#/components/schemas/WebsiteAnalyticsEngagement"},"eventTracking":{"anyOf":[{"$ref":"#/components/schemas/WebsiteAnalyticsEventTracking"},{"type":"null"}]},"visitorProfiling":{"anyOf":[{"$ref":"#/components/schemas/WebsiteAnalyticsVisitorProfiling"},{"type":"null"}]},"segmentProfiles":{"items":{"$ref":"#/components/schemas/WebsiteAnalyticsSegmentProfile"},"type":"array","title":"Segmentprofiles"},"geographicDistribution":{"items":{"$ref":"#/components/schemas/WebsiteAnalyticsGeoStateItem"},"type":"array","title":"Geographicdistribution"},"leadCapture":{"anyOf":[{"$ref":"#/components/schemas/WebsiteAnalyticsLeadCapture"},{"type":"null"}]}},"type":"object","title":"WebsiteAnalyticsMetricsPayload"},"WebsiteAnalyticsReportPdfRequest":{"properties":{"current_time":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Current Time","description":"Generated-at override used for PDF header (ISO 8601)."},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title","description":"Report title for PDF header.","default":"Website Analytics Report"},"reportId":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reportid"},"generatedAt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Generatedat","description":"ISO 8601 generation timestamp from report response."},"prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Prompt"},"dateRange":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Daterange","description":"Human-readable period label from the agent response (e.g. 'Last 30 Days'). Takes priority over any computed date range."},"summaryText":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summarytext"},"insights":{"items":{"$ref":"#/components/schemas/WebsiteAnalyticsInsightsGroup"},"type":"array","title":"Insights"},"metrics":{"$ref":"#/components/schemas/WebsiteAnalyticsMetricsPayload"}},"type":"object","title":"WebsiteAnalyticsReportPdfRequest","description":"JSON request body for POST /website-analytics/pdf."},"WebsiteAnalyticsReportPdfResponse":{"properties":{"pdf_url":{"type":"string","title":"Pdf Url"}},"type":"object","required":["pdf_url"],"title":"WebsiteAnalyticsReportPdfResponse","description":"Response model for website analytics report PDF generation."},"WebsiteAnalyticsReportResponse":{"properties":{"reportId":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reportid"},"generatedAt":{"type":"string","title":"Generatedat"},"prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Prompt","description":"Original prompt used for the report, if any."},"dateRange":{"type":"string","title":"Daterange","description":"Human-readable period label (e.g. 'Last 30 Days').","default":""},"summaryText":{"type":"string","title":"Summarytext","default":""},"insights":{"items":{"$ref":"#/components/schemas/WebsiteAnalyticsInsightSection"},"type":"array","title":"Insights","description":"Structured AI insights grouped by section/subsection/bullets."},"metrics":{"additionalProperties":true,"type":"object","title":"Metrics","description":"Backend metrics payload grouped in a dedicated object."}},"type":"object","required":["generatedAt"],"title":"WebsiteAnalyticsReportResponse","description":"API response model aligned with Website Analytics Agent contract."},"WebsiteAnalyticsRequest":{"properties":{"tenantId":{"type":"string","title":"Tenantid","description":"Tenant identifier."},"organizationId":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Organizationid","description":"Organization identifier for org-level AI config. Optional; forward when available."},"startDate":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Startdate","description":"Report start date (YYYY-MM-DD). Optional when using prompt-only queries."},"endDate":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Enddate","description":"Report end date (YYYY-MM-DD). Optional when using prompt-only queries."},"prompt":{"type":"string","title":"Prompt","description":"Natural-language query for filters / focus (required)."}},"type":"object","required":["tenantId","prompt"],"title":"WebsiteAnalyticsRequest","description":"Request model for Website Analytics reports.\n\nMirrors the Website Analytics Agent function contract."},"WebsiteAnalyticsSegmentProfile":{"properties":{"segmentId":{"type":"string","title":"Segmentid"},"segmentName":{"type":"string","title":"Segmentname"},"description":{"type":"string","title":"Description","default":""},"visitCount":{"type":"integer","title":"Visitcount","default":0},"conversionRate":{"type":"number","title":"Conversionrate","default":0.0},"attributeIds":{"items":{"type":"integer"},"type":"array","title":"Attributeids"}},"type":"object","required":["segmentId","segmentName"],"title":"WebsiteAnalyticsSegmentProfile"},"WebsiteAnalyticsVisitorProfiling":{"properties":{"gender":{"items":{"$ref":"#/components/schemas/WebsiteAnalyticsDistributionItem"},"type":"array","title":"Gender"},"race":{"items":{"$ref":"#/components/schemas/WebsiteAnalyticsDistributionItem"},"type":"array","title":"Race"},"maritalStatus":{"items":{"$ref":"#/components/schemas/WebsiteAnalyticsDistributionItem"},"type":"array","title":"Maritalstatus"},"ageBuckets":{"items":{"$ref":"#/components/schemas/WebsiteAnalyticsDistributionItem"},"type":"array","title":"Agebuckets"},"incomeLevels":{"items":{"$ref":"#/components/schemas/WebsiteAnalyticsDistributionItem"},"type":"array","title":"Incomelevels"},"creditRanges":{"items":{"$ref":"#/components/schemas/WebsiteAnalyticsDistributionItem"},"type":"array","title":"Creditranges"},"presenceOfChildren":{"items":{"$ref":"#/components/schemas/WebsiteAnalyticsChildrenItem"},"type":"array","title":"Presenceofchildren"},"occupationCategories":{"items":{"$ref":"#/components/schemas/WebsiteAnalyticsDistributionItem"},"type":"array","title":"Occupationcategories"},"household":{"anyOf":[{"$ref":"#/components/schemas/WebsiteAnalyticsHousehold"},{"type":"null"}]}},"type":"object","title":"WebsiteAnalyticsVisitorProfiling"}}}}