{
  "status": 200,
  "body": {
    "method": "PUT",
    "path": "/client-data/profile",
    "tag": "Client Account",
    "operation": {
      "operationId": "ClientAccountController_updateProfile",
      "summary": "Update my profile",
      "description": "Updates the customer's own profile. Changing an email here does not re-verify it — use the verification endpoints if the new address needs proving.\n\n#### Signature\n\n```http\nPUT /client-data/profile (body) -> The updated profile\n```\n\n#### Access\n\nRequires a bearer JWT (`Authorization: Bearer <token>`).\n\n#### Errors\n\n| Status | Code | Message | When | What to do |\n| --- | --- | --- | --- | --- |\n| `401` | CUSTOMER_REQUIRED | Customer required | No signed-in customer could be resolved. | Sign in. Every endpoint here is scoped to the caller and none work anonymously. |\n\nPlus the standard platform errors: `403`, `429`, `500`.\n\n#### See also\n\n- `POST /client-data/verification/email/send`",
      "parameters": [
        {
          "name": "orgid",
          "required": true,
          "in": "header",
          "description": "Organization (tenant) identifier. Every request is scoped to this org; data from other orgs is never visible. Issued with your API credentials.",
          "schema": {
            "type": "string"
          },
          "example": "acme-retail"
        }
      ],
      "requestBody": {
        "description": "Fields to change.",
        "required": true,
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "additionalProperties": true
            },
            "example": {
              "firstName": "Ada",
              "lastName": "Lovelace",
              "phone": "+15551234567"
            }
          }
        }
      },
      "responses": {
        "200": {
          "description": "The updated profile",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        },
        "401": {
          "description": "Customer required — No signed-in customer could be resolved.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "statusCode",
                  "error",
                  "path",
                  "method",
                  "timeStamp"
                ],
                "properties": {
                  "statusCode": {
                    "type": "integer",
                    "description": "HTTP status code, repeated in the body.",
                    "example": 404
                  },
                  "error": {
                    "type": "string",
                    "description": "Human-readable failure description.",
                    "example": "Category not found"
                  },
                  "path": {
                    "type": "string",
                    "description": "Request path that failed, including query string.",
                    "example": "/storefront/categories"
                  },
                  "method": {
                    "type": "string",
                    "description": "HTTP method of the failed request.",
                    "example": "POST"
                  },
                  "timeStamp": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Server time the error was produced.",
                    "example": "2026-08-29T14:03:22.118Z"
                  }
                }
              },
              "example": {
                "statusCode": 401,
                "error": "Customer required",
                "path": "/client-data/profile",
                "method": "PUT",
                "timeStamp": "2026-08-29T14:03:22.118Z"
              }
            }
          }
        },
        "403": {
          "$ref": "#/components/responses/Forbidden"
        },
        "429": {
          "$ref": "#/components/responses/RateLimited"
        },
        "500": {
          "$ref": "#/components/responses/ServerError"
        }
      },
      "tags": [
        "Client Account"
      ]
    },
    "components": {
      "securitySchemes": {
        "JWT-auth": {
          "scheme": "bearer",
          "bearerFormat": "JWT",
          "type": "http",
          "name": "Authorization",
          "description": "Enter JWT token",
          "in": "header"
        },
        "orgid": {
          "type": "apiKey",
          "in": "header",
          "name": "orgid",
          "description": "Organization ID"
        }
      },
      "schemas": {
        "WebsiteOverviewDto": {
          "type": "object",
          "properties": {
            "totalVisitors": {
              "type": "number"
            },
            "pageViews": {
              "type": "number"
            },
            "sessions": {
              "type": "number"
            },
            "bounceRate": {
              "type": "number"
            },
            "avgSessionDuration": {
              "type": "number"
            },
            "avgPagesPerSession": {
              "type": "number"
            },
            "avgScrollDepth": {
              "type": "number"
            },
            "avgLoadTime": {
              "type": "number"
            },
            "botRate": {
              "type": "number"
            },
            "conversionRate": {
              "type": "number"
            }
          },
          "required": [
            "totalVisitors",
            "pageViews",
            "sessions",
            "bounceRate",
            "avgSessionDuration",
            "avgPagesPerSession",
            "avgScrollDepth",
            "avgLoadTime",
            "botRate",
            "conversionRate"
          ]
        },
        "ChartDataPointDto": {
          "type": "object",
          "properties": {
            "date": {
              "type": "string"
            },
            "value": {
              "type": "number"
            },
            "label": {
              "type": "string"
            }
          },
          "required": [
            "date",
            "value"
          ]
        },
        "WebsiteAnalyticsDto": {
          "type": "object",
          "properties": {
            "overview": {
              "$ref": "#/components/schemas/WebsiteOverviewDto"
            },
            "traffic": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/ChartDataPointDto"
              }
            },
            "topPages": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "exitPages": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "deviceBreakdown": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "browserBreakdown": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "osBreakdown": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "geographicData": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "topCities": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "trafficSources": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "topReferrers": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "utmAttribution": {
              "type": "object"
            },
            "eventBreakdown": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "topSearches": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "formAnalytics": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "hourHeatmap": {
              "description": "24-entry hour-of-day traffic heatmap (UTC).",
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "dayOfWeekBreakdown": {
              "description": "7-entry day-of-week traffic breakdown. 1=Sun .. 7=Sat.",
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "sessionDurationBuckets": {
              "description": "Session duration distribution in buckets: <10s, 10-30s, 30-60s, 1-5m, 5-15m, 15m+",
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "pagesPerSessionBuckets": {
              "description": "Session depth distribution by pages per session: 1, 2-3, 4-10, 10+",
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "scrollDepthBuckets": {
              "description": "Scroll depth distribution: 0-25, 25-50, 50-75, 75-100",
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "newVsReturning": {
              "type": "object"
            },
            "languageBreakdown": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "topIsps": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "entryPages": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "errorEvents": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "siteBreakdown": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "dailyMetrics": {
              "description": "Per-day metrics: sessions, unique visitors, bounce rate, avg duration.",
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "realTimeUsers": {
              "type": "number"
            }
          },
          "required": [
            "overview",
            "traffic",
            "topPages",
            "exitPages",
            "deviceBreakdown",
            "browserBreakdown",
            "osBreakdown",
            "geographicData",
            "topCities",
            "trafficSources",
            "topReferrers",
            "utmAttribution",
            "eventBreakdown",
            "topSearches",
            "formAnalytics",
            "hourHeatmap",
            "dayOfWeekBreakdown",
            "sessionDurationBuckets",
            "pagesPerSessionBuckets",
            "scrollDepthBuckets",
            "newVsReturning",
            "languageBreakdown",
            "topIsps",
            "entryPages",
            "errorEvents",
            "siteBreakdown",
            "dailyMetrics",
            "realTimeUsers"
          ]
        },
        "BlogOverviewDto": {
          "type": "object",
          "properties": {
            "totalPosts": {
              "type": "number"
            },
            "totalViews": {
              "type": "number"
            },
            "avgEngagement": {
              "type": "number"
            },
            "totalComments": {
              "type": "number"
            },
            "totalShares": {
              "type": "number"
            }
          },
          "required": [
            "totalPosts",
            "totalViews",
            "avgEngagement",
            "totalComments",
            "totalShares"
          ]
        },
        "BlogAnalyticsDto": {
          "type": "object",
          "properties": {
            "overview": {
              "$ref": "#/components/schemas/BlogOverviewDto"
            },
            "topPosts": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "engagementTrends": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/ChartDataPointDto"
              }
            },
            "categoryPerformance": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "authorPerformance": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "required": [
            "overview",
            "topPosts",
            "engagementTrends",
            "categoryPerformance",
            "authorPerformance"
          ]
        },
        "WorkflowOverviewDto": {
          "type": "object",
          "properties": {
            "totalTasks": {
              "type": "number"
            },
            "completedTasks": {
              "type": "number"
            },
            "overdueTasks": {
              "type": "number"
            },
            "avgCompletionTime": {
              "type": "number"
            },
            "teamProductivity": {
              "type": "number"
            }
          },
          "required": [
            "totalTasks",
            "completedTasks",
            "overdueTasks",
            "avgCompletionTime",
            "teamProductivity"
          ]
        },
        "WorkflowAnalyticsDto": {
          "type": "object",
          "properties": {
            "overview": {
              "$ref": "#/components/schemas/WorkflowOverviewDto"
            },
            "tasksByStatus": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "tasksByType": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "assigneePerformance": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "completionTrends": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/ChartDataPointDto"
              }
            },
            "workloadDistribution": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "required": [
            "overview",
            "tasksByStatus",
            "tasksByType",
            "assigneePerformance",
            "completionTrends",
            "workloadDistribution"
          ]
        },
        "StorefrontOverviewDto": {
          "type": "object",
          "properties": {
            "totalRevenue": {
              "type": "number"
            },
            "totalOrders": {
              "type": "number"
            },
            "avgOrderValue": {
              "type": "number"
            },
            "conversionRate": {
              "type": "number"
            },
            "returnCustomers": {
              "type": "number"
            },
            "pendingOrders": {
              "type": "number"
            }
          },
          "required": [
            "totalRevenue",
            "totalOrders",
            "avgOrderValue",
            "conversionRate",
            "returnCustomers"
          ]
        },
        "StorefrontAnalyticsDto": {
          "type": "object",
          "properties": {
            "overview": {
              "$ref": "#/components/schemas/StorefrontOverviewDto"
            },
            "channelPerformance": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "productPerformance": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "salesTrends": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/ChartDataPointDto"
              }
            },
            "revenueTrends": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/ChartDataPointDto"
              }
            },
            "customerSegments": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "required": [
            "overview",
            "channelPerformance",
            "productPerformance",
            "salesTrends",
            "customerSegments"
          ]
        },
        "TicketOverviewDto": {
          "type": "object",
          "properties": {
            "totalTickets": {
              "type": "number"
            },
            "openTickets": {
              "type": "number"
            },
            "resolvedTickets": {
              "type": "number"
            },
            "avgResolutionTime": {
              "type": "number"
            },
            "customerSatisfaction": {
              "type": "number"
            }
          },
          "required": [
            "totalTickets",
            "openTickets",
            "resolvedTickets",
            "avgResolutionTime",
            "customerSatisfaction"
          ]
        },
        "TicketAnalyticsDto": {
          "type": "object",
          "properties": {
            "overview": {
              "$ref": "#/components/schemas/TicketOverviewDto"
            },
            "ticketsByPriority": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "ticketsByCategory": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "agentPerformance": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "resolutionTrends": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/ChartDataPointDto"
              }
            },
            "satisfactionTrends": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/ChartDataPointDto"
              }
            }
          },
          "required": [
            "overview",
            "ticketsByPriority",
            "ticketsByCategory",
            "agentPerformance",
            "resolutionTrends",
            "satisfactionTrends"
          ]
        },
        "LeadsOverviewDto": {
          "type": "object",
          "properties": {
            "totalLeads": {
              "type": "number"
            },
            "qualifiedLeads": {
              "type": "number"
            },
            "conversionRate": {
              "type": "number"
            },
            "avgDealSize": {
              "type": "number"
            },
            "pipelineValue": {
              "type": "number"
            }
          },
          "required": [
            "totalLeads",
            "qualifiedLeads",
            "conversionRate",
            "avgDealSize",
            "pipelineValue"
          ]
        },
        "LeadsAnalyticsDto": {
          "type": "object",
          "properties": {
            "overview": {
              "$ref": "#/components/schemas/LeadsOverviewDto"
            },
            "leadSources": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "funnelData": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "campaignPerformance": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "leadTrends": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/ChartDataPointDto"
              }
            },
            "dealStages": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "required": [
            "overview",
            "leadSources",
            "funnelData",
            "campaignPerformance",
            "leadTrends",
            "dealStages"
          ]
        },
        "AutomationOverviewDto": {
          "type": "object",
          "properties": {
            "activeWorkflows": {
              "type": "number"
            },
            "totalExecutions": {
              "type": "number"
            },
            "successRate": {
              "type": "number"
            },
            "timeSaved": {
              "type": "number"
            },
            "errorRate": {
              "type": "number"
            }
          },
          "required": [
            "activeWorkflows",
            "totalExecutions",
            "successRate",
            "timeSaved",
            "errorRate"
          ]
        },
        "AutomationAnalyticsDto": {
          "type": "object",
          "properties": {
            "overview": {
              "$ref": "#/components/schemas/AutomationOverviewDto"
            },
            "workflowPerformance": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "triggerAnalysis": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "executionTrends": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/ChartDataPointDto"
              }
            },
            "errorAnalysis": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "required": [
            "overview",
            "workflowPerformance",
            "triggerAnalysis",
            "executionTrends",
            "errorAnalysis"
          ]
        },
        "UserAccountOverviewDto": {
          "type": "object",
          "properties": {
            "totalUsers": {
              "type": "number"
            },
            "activeUsers": {
              "type": "number"
            },
            "totalRevenue": {
              "type": "number"
            },
            "avgRevenuePerUser": {
              "type": "number"
            },
            "churnRate": {
              "type": "number"
            }
          },
          "required": [
            "totalUsers",
            "activeUsers",
            "totalRevenue",
            "avgRevenuePerUser",
            "churnRate"
          ]
        },
        "UserAccountAnalyticsDto": {
          "type": "object",
          "properties": {
            "overview": {
              "$ref": "#/components/schemas/UserAccountOverviewDto"
            },
            "userGrowth": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/ChartDataPointDto"
              }
            },
            "revenueBreakdown": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "apiUsage": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "userActivities": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "costAnalysis": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "subscriptionTiers": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "required": [
            "overview",
            "userGrowth",
            "revenueBreakdown",
            "apiUsage",
            "userActivities",
            "costAnalysis",
            "subscriptionTiers"
          ]
        },
        "EmailOverviewDto": {
          "type": "object",
          "properties": {
            "totalSent": {
              "type": "number"
            },
            "delivered": {
              "type": "number"
            },
            "opened": {
              "type": "number"
            },
            "clicked": {
              "type": "number"
            },
            "replied": {
              "type": "number"
            },
            "bounced": {
              "type": "number"
            },
            "unsubscribed": {
              "type": "number"
            }
          },
          "required": [
            "totalSent",
            "delivered",
            "opened",
            "clicked",
            "replied",
            "bounced",
            "unsubscribed"
          ]
        },
        "EmailRatesDto": {
          "type": "object",
          "properties": {
            "deliveryRate": {
              "type": "number"
            },
            "openRate": {
              "type": "number"
            },
            "clickRate": {
              "type": "number"
            },
            "replyRate": {
              "type": "number"
            },
            "bounceRate": {
              "type": "number"
            },
            "unsubscribeRate": {
              "type": "number"
            }
          },
          "required": [
            "deliveryRate",
            "openRate",
            "clickRate",
            "replyRate",
            "bounceRate",
            "unsubscribeRate"
          ]
        },
        "EmailEngagementDto": {
          "type": "object",
          "properties": {
            "avgTimeToOpen": {
              "type": "number"
            },
            "avgTimeToClick": {
              "type": "number"
            },
            "uniqueOpens": {
              "type": "number"
            },
            "uniqueClicks": {
              "type": "number"
            },
            "totalOpens": {
              "type": "number"
            },
            "totalClicks": {
              "type": "number"
            }
          },
          "required": [
            "avgTimeToOpen",
            "avgTimeToClick",
            "uniqueOpens",
            "uniqueClicks",
            "totalOpens",
            "totalClicks"
          ]
        },
        "EmailPerformanceDto": {
          "type": "object",
          "properties": {
            "topPerformingEmails": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "subject": {
                    "type": "string"
                  },
                  "openRate": {
                    "type": "number"
                  },
                  "clickRate": {
                    "type": "number"
                  },
                  "sentAt": {
                    "type": "string"
                  }
                }
              }
            },
            "bestSendTimes": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "hour": {
                    "type": "string"
                  },
                  "dayOfWeek": {
                    "type": "string"
                  },
                  "openRate": {
                    "type": "number"
                  }
                }
              }
            }
          },
          "required": [
            "topPerformingEmails",
            "bestSendTimes"
          ]
        },
        "EmailAnalyticsDto": {
          "type": "object",
          "properties": {
            "overview": {
              "$ref": "#/components/schemas/EmailOverviewDto"
            },
            "rates": {
              "$ref": "#/components/schemas/EmailRatesDto"
            },
            "engagement": {
              "$ref": "#/components/schemas/EmailEngagementDto"
            },
            "performance": {
              "$ref": "#/components/schemas/EmailPerformanceDto"
            },
            "deviceBreakdown": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "device": {
                    "type": "string"
                  },
                  "percentage": {
                    "type": "number"
                  },
                  "count": {
                    "type": "number"
                  }
                }
              }
            },
            "locationBreakdown": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "location": {
                    "type": "string"
                  },
                  "percentage": {
                    "type": "number"
                  },
                  "count": {
                    "type": "number"
                  }
                }
              }
            },
            "campaignMetrics": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "sent": {
                    "type": "number"
                  },
                  "opened": {
                    "type": "number"
                  },
                  "clicked": {
                    "type": "number"
                  },
                  "converted": {
                    "type": "number"
                  }
                }
              }
            }
          },
          "required": [
            "overview",
            "rates",
            "engagement",
            "performance",
            "deviceBreakdown",
            "locationBreakdown",
            "campaignMetrics"
          ]
        },
        "AdCreativeDto": {
          "type": "object",
          "properties": {
            "headlines": {
              "description": "Headline variations",
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "descriptions": {
              "description": "Description variations",
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "cta": {
              "type": "string",
              "description": "Call-to-action text"
            },
            "ctaType": {
              "type": "string",
              "description": "CTA button type (platform-specific)"
            },
            "imageUrls": {
              "description": "Product images to use",
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "destinationUrl": {
              "type": "string",
              "description": "Destination URL"
            },
            "validation": {
              "type": "object",
              "description": "Character count validation"
            }
          },
          "required": [
            "headlines",
            "descriptions",
            "cta",
            "ctaType",
            "imageUrls",
            "destinationUrl"
          ]
        },
        "PlatformCampaignPreviewDto": {
          "type": "object",
          "properties": {
            "platform": {
              "type": "string",
              "description": "Platform identifier"
            },
            "platformDisplayName": {
              "type": "string",
              "description": "Platform display name"
            },
            "isEnabled": {
              "type": "boolean",
              "description": "Is platform connected/enabled"
            },
            "connectionStatus": {
              "type": "string",
              "description": "Connection status"
            },
            "allocatedBudget": {
              "type": "number",
              "description": "Allocated budget for this platform"
            },
            "budgetPercentage": {
              "type": "number",
              "description": "Budget percentage"
            },
            "adCreatives": {
              "description": "Generated ad creatives",
              "allOf": [
                {
                  "$ref": "#/components/schemas/AdCreativeDto"
                }
              ]
            },
            "platformSettings": {
              "type": "object",
              "description": "Platform-specific settings"
            },
            "recommendationScore": {
              "type": "number",
              "description": "Recommendation score (0-100)"
            },
            "recommendationReason": {
              "type": "string",
              "description": "Recommendation reason"
            }
          },
          "required": [
            "platform",
            "platformDisplayName",
            "isEnabled",
            "connectionStatus",
            "allocatedBudget",
            "budgetPercentage",
            "adCreatives",
            "recommendationScore",
            "recommendationReason"
          ]
        },
        "BudgetDistributionDto": {
          "type": "object",
          "properties": {
            "totalBudget": {
              "type": "number",
              "description": "Total budget"
            },
            "platformAllocations": {
              "description": "Per-platform allocation",
              "type": "array",
              "items": {
                "type": "object"
              }
            },
            "strategy": {
              "type": "string",
              "description": "Distribution strategy used"
            },
            "hasHistoricalData": {
              "type": "boolean",
              "description": "Historical data availability"
            }
          },
          "required": [
            "totalBudget",
            "platformAllocations",
            "strategy",
            "hasHistoricalData"
          ]
        },
        "ProductSummaryDto": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "description": "Product ID"
            },
            "name": {
              "type": "string",
              "description": "Product name"
            },
            "price": {
              "type": "number",
              "description": "Product price"
            },
            "imageUrl": {
              "type": "string",
              "description": "Main image URL"
            },
            "category": {
              "type": "string",
              "description": "Product category"
            }
          },
          "required": [
            "id",
            "name",
            "price"
          ]
        },
        "GenerationMetadataDto": {
          "type": "object",
          "properties": {
            "aiModel": {
              "type": "string",
              "description": "AI model used"
            },
            "generatedAt": {
              "type": "string",
              "description": "Generation timestamp"
            },
            "durationMs": {
              "type": "number",
              "description": "Generation duration in ms"
            },
            "tokenUsage": {
              "type": "object",
              "description": "Token usage"
            }
          },
          "required": [
            "aiModel",
            "generatedAt",
            "durationMs"
          ]
        },
        "EstimatedPerformanceDto": {
          "type": "object",
          "properties": {
            "estimatedReach": {
              "type": "object",
              "description": "Estimated total reach"
            },
            "estimatedClicks": {
              "type": "object",
              "description": "Estimated clicks"
            },
            "estimatedConversions": {
              "type": "object",
              "description": "Estimated conversions"
            },
            "estimatedCpc": {
              "type": "number",
              "description": "Estimated CPC"
            },
            "confidenceLevel": {
              "type": "string",
              "description": "Confidence level"
            },
            "estimateBasis": {
              "type": "string",
              "description": "Basis for estimates"
            }
          },
          "required": [
            "estimatedReach",
            "estimatedClicks",
            "estimatedConversions",
            "estimatedCpc",
            "confidenceLevel",
            "estimateBasis"
          ]
        },
        "SellLikeMadPreviewResponseDto": {
          "type": "object",
          "properties": {
            "previewId": {
              "type": "string",
              "description": "Preview session ID for approval"
            },
            "platformCampaigns": {
              "description": "Generated campaigns per platform",
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/PlatformCampaignPreviewDto"
              }
            },
            "budgetDistribution": {
              "description": "Budget distribution summary",
              "allOf": [
                {
                  "$ref": "#/components/schemas/BudgetDistributionDto"
                }
              ]
            },
            "products": {
              "description": "Products included in campaign",
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/ProductSummaryDto"
              }
            },
            "generationMetadata": {
              "description": "AI generation metadata",
              "allOf": [
                {
                  "$ref": "#/components/schemas/GenerationMetadataDto"
                }
              ]
            },
            "estimatedPerformance": {
              "description": "Estimated reach and performance",
              "allOf": [
                {
                  "$ref": "#/components/schemas/EstimatedPerformanceDto"
                }
              ]
            },
            "expiresAt": {
              "type": "string",
              "description": "Preview expiration time"
            },
            "campaignName": {
              "type": "string",
              "description": "Campaign name"
            }
          },
          "required": [
            "previewId",
            "platformCampaigns",
            "budgetDistribution",
            "products",
            "generationMetadata",
            "estimatedPerformance",
            "expiresAt",
            "campaignName"
          ]
        },
        "PlatformLaunchResultDto": {
          "type": "object",
          "properties": {
            "platform": {
              "type": "string",
              "description": "Platform name"
            },
            "success": {
              "type": "boolean",
              "description": "Success status"
            },
            "campaignId": {
              "type": "string",
              "description": "Platform-specific campaign ID"
            },
            "error": {
              "type": "string",
              "description": "Error message if failed"
            }
          },
          "required": [
            "platform",
            "success"
          ]
        },
        "LaunchResultDto": {
          "type": "object",
          "properties": {
            "success": {
              "type": "boolean",
              "description": "Overall success status"
            },
            "masterCampaignId": {
              "type": "string",
              "description": "Master campaign ID"
            },
            "platformResults": {
              "description": "Per-platform launch results",
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/PlatformLaunchResultDto"
              }
            },
            "launchedAt": {
              "type": "string",
              "description": "Launch timestamp"
            },
            "message": {
              "type": "string",
              "description": "Summary message"
            }
          },
          "required": [
            "success",
            "masterCampaignId",
            "platformResults",
            "launchedAt",
            "message"
          ]
        },
        "AvailablePlatformDto": {
          "type": "object",
          "properties": {
            "platform": {
              "type": "string",
              "description": "Platform identifier"
            },
            "displayName": {
              "type": "string",
              "description": "Platform display name"
            },
            "connected": {
              "type": "boolean",
              "description": "Is connected"
            },
            "accountId": {
              "type": "string",
              "description": "Account ID if connected"
            },
            "status": {
              "type": "string",
              "description": "Status"
            },
            "message": {
              "type": "string",
              "description": "Error or status message explaining the current state"
            }
          },
          "required": [
            "platform",
            "displayName",
            "connected",
            "status"
          ]
        },
        "ErrorEnvelope": {
          "type": "object",
          "required": [
            "statusCode",
            "error",
            "path",
            "method",
            "timeStamp"
          ],
          "properties": {
            "statusCode": {
              "type": "integer",
              "description": "HTTP status code, repeated in the body.",
              "example": 404
            },
            "error": {
              "type": "string",
              "description": "Human-readable failure description.",
              "example": "Category not found"
            },
            "path": {
              "type": "string",
              "description": "Request path that failed, including query string.",
              "example": "/storefront/categories"
            },
            "method": {
              "type": "string",
              "description": "HTTP method of the failed request.",
              "example": "POST"
            },
            "timeStamp": {
              "type": "string",
              "format": "date-time",
              "description": "Server time the error was produced.",
              "example": "2026-08-29T14:03:22.118Z"
            }
          }
        }
      },
      "responses": {
        "Unauthenticated": {
          "description": "Authentication failed: Invalid or expired token — The `Authorization` header is missing, malformed, or the JWT has expired.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ErrorEnvelope"
              },
              "example": {
                "statusCode": 401,
                "error": "Authentication failed: Invalid or expired token",
                "path": "/example",
                "method": "GET",
                "timeStamp": "2026-08-29T14:03:22.118Z"
              }
            }
          }
        },
        "Forbidden": {
          "description": "You do not have permission to perform this action — The caller is authenticated but lacks the role required by the endpoint, or is acting on another org.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ErrorEnvelope"
              },
              "example": {
                "statusCode": 403,
                "error": "You do not have permission to perform this action",
                "path": "/example",
                "method": "GET",
                "timeStamp": "2026-08-29T14:03:22.118Z"
              }
            }
          }
        },
        "RateLimited": {
          "description": "Too many requests from this IP, please try again later — The per-IP rate limit has been exceeded.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ErrorEnvelope"
              },
              "example": {
                "statusCode": 429,
                "error": "Too many requests from this IP, please try again later",
                "path": "/example",
                "method": "GET",
                "timeStamp": "2026-08-29T14:03:22.118Z"
              }
            }
          }
        },
        "ServerError": {
          "description": "An unexpected error occurred. Our team has been notified. — An unhandled server-side failure.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ErrorEnvelope"
              },
              "example": {
                "statusCode": 500,
                "error": "An unexpected error occurred. Our team has been notified.",
                "path": "/example",
                "method": "GET",
                "timeStamp": "2026-08-29T14:03:22.118Z"
              }
            }
          }
        }
      }
    }
  }
}
