openapi: 3.1.0 info: title: Api version: 0.1.0 description: API specification servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: dashboard description: Dashboard operations - name: campaigns description: Campaign operations - name: scans description: Scan operations - name: auth description: Authentication operations - name: onboarding description: Onboarding operations - name: organizations description: Organization operations - name: projects description: Project operations paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check description: Returns server health status responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /dashboard/summary: get: operationId: getDashboardSummary tags: [dashboard] summary: Get dashboard summary responses: "200": description: Dashboard summary content: application/json: schema: $ref: "#/components/schemas/DashboardSummary" /campaigns: get: operationId: getCampaigns tags: [campaigns] summary: List campaigns parameters: - in: query name: search schema: type: string - in: query name: platform schema: $ref: "#/components/schemas/AdPlatform" - in: query name: riskLevel schema: $ref: "#/components/schemas/RiskLevel" - in: query name: status schema: type: string description: Campaign lifecycle status (e.g. active, paused) - in: query name: page schema: type: integer minimum: 1 default: 1 - in: query name: pageSize schema: type: integer minimum: 1 maximum: 50 default: 10 responses: "200": description: Campaign list content: application/json: schema: $ref: "#/components/schemas/CampaignListResponse" /campaigns/{id}/report: get: operationId: getCampaignReport tags: [campaigns] summary: Get campaign report parameters: - in: path name: id required: true schema: type: string responses: "200": description: Campaign report content: application/json: schema: $ref: "#/components/schemas/CampaignReport" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ApiError" /scans: get: operationId: listScans tags: [scans] summary: List scans responses: "200": description: Scan list content: application/json: schema: $ref: "#/components/schemas/ScanListResponse" post: operationId: createScan tags: [scans] summary: Create ad scan requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateScanRequest" responses: "201": description: Scan created content: application/json: schema: $ref: "#/components/schemas/CreateScanResponse" /scans/upload: post: operationId: uploadScanMedia tags: [scans] summary: Upload scan media asset (base64) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UploadMediaRequest" responses: "201": description: Media uploaded content: application/json: schema: $ref: "#/components/schemas/UploadMediaResponse" /scans/{id}/result: get: operationId: getScanResult tags: [scans] summary: Get completed scan result parameters: - in: path name: id required: true schema: type: string responses: "200": description: Scan result content: application/json: schema: $ref: "#/components/schemas/ScanDetail" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ApiError" "409": description: Result not ready content: application/json: schema: $ref: "#/components/schemas/ApiError" /scans/{id}: get: operationId: getScan tags: [scans] summary: Get scan detail parameters: - in: path name: id required: true schema: type: string responses: "200": description: Scan detail content: application/json: schema: $ref: "#/components/schemas/ScanDetail" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ApiError" /auth/login: post: operationId: login tags: [auth] summary: Login requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/LoginRequest" responses: "200": description: Authenticated user content: application/json: schema: $ref: "#/components/schemas/AuthSession" /auth/me: get: operationId: getMe tags: [auth] summary: Get current session responses: "200": description: Current session content: application/json: schema: $ref: "#/components/schemas/AuthSession" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ApiError" /auth/logout: post: operationId: logout tags: [auth] summary: Logout responses: "200": description: Logged out content: application/json: schema: $ref: "#/components/schemas/LogoutResponse" /auth/refresh: post: operationId: refreshSession tags: [auth] summary: Refresh access token responses: "200": description: Session refreshed content: application/json: schema: $ref: "#/components/schemas/AuthSession" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ApiError" /auth/forgot-password: post: operationId: forgotPassword tags: [auth] summary: Request password reset requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ForgotPasswordRequest" responses: "200": description: Reset request accepted content: application/json: schema: $ref: "#/components/schemas/ForgotPasswordResponse" /auth/reset-password: post: operationId: resetPassword tags: [auth] summary: Reset password with token from email requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ResetPasswordRequest" responses: "200": description: Password reset content: application/json: schema: $ref: "#/components/schemas/ResetPasswordResponse" "400": description: Invalid token or password content: application/json: schema: $ref: "#/components/schemas/ApiError" /auth/profile: patch: operationId: updateProfile tags: [auth] summary: Update current user profile requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateProfileRequest" responses: "200": description: Updated session content: application/json: schema: $ref: "#/components/schemas/AuthSession" "400": description: Invalid profile data content: application/json: schema: $ref: "#/components/schemas/ApiError" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ApiError" /organizations: get: operationId: listOrganizations tags: [organizations] summary: List organizations responses: "200": description: Organization list content: application/json: schema: $ref: "#/components/schemas/OrganizationListResponse" post: operationId: createOrganization tags: [organizations] summary: Create organization requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateOrganizationRequest" responses: "201": description: Organization created content: application/json: schema: $ref: "#/components/schemas/Organization" /organizations/{id}: get: operationId: getOrganization tags: [organizations] summary: Get organization parameters: - in: path name: id required: true schema: type: string responses: "200": description: Organization content: application/json: schema: $ref: "#/components/schemas/Organization" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ApiError" /projects: get: operationId: listProjects tags: [projects] summary: List projects parameters: - in: query name: organizationId required: false schema: type: string responses: "200": description: Project list content: application/json: schema: $ref: "#/components/schemas/ProjectListResponse" post: operationId: createProject tags: [projects] summary: Create project requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateProjectRequest" responses: "201": description: Project created content: application/json: schema: $ref: "#/components/schemas/Project" /projects/{id}: get: operationId: getProject tags: [projects] summary: Get project parameters: - in: path name: id required: true schema: type: string responses: "200": description: Project content: application/json: schema: $ref: "#/components/schemas/Project" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ApiError" /onboarding/complete: post: operationId: completeOnboarding tags: [onboarding] summary: Persist onboarding profile to organization requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/OnboardingCompleteRequest" responses: "200": description: Onboarding saved content: application/json: schema: $ref: "#/components/schemas/OnboardingCompleteResponse" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ApiError" components: schemas: HealthStatus: type: object properties: status: type: string required: - status ApiError: type: object properties: message: type: string required: - message AdPlatform: type: string enum: - meta - google - tiktok RiskLevel: type: string enum: - low - medium - high - critical PlatformScore: type: object properties: platform: $ref: "#/components/schemas/AdPlatform" label: type: string riskScore: type: number passProbability: type: number riskLevel: $ref: "#/components/schemas/RiskLevel" trend: type: string enum: [up, down, flat] required: - platform - label - riskScore - passProbability - riskLevel - trend RecentScan: type: object properties: scanId: type: string campaignId: type: string campaignName: type: string platform: $ref: "#/components/schemas/AdPlatform" riskLevel: $ref: "#/components/schemas/RiskLevel" passProbability: type: number createdAtLabel: type: string required: - scanId - campaignId - campaignName - platform - riskLevel - passProbability - createdAtLabel DashboardSummary: type: object properties: kpis: type: object properties: totalScans: type: integer flaggedAds: type: integer passRate: type: integer activeCampaigns: type: integer required: - totalScans - flaggedAds - passRate - activeCampaigns platformScores: type: array items: $ref: "#/components/schemas/PlatformScore" recentScans: type: array items: $ref: "#/components/schemas/RecentScan" required: - kpis - platformScores - recentScans CampaignSummary: type: object properties: id: type: string name: type: string platform: $ref: "#/components/schemas/AdPlatform" status: type: string riskLevel: $ref: "#/components/schemas/RiskLevel" score: type: number scanCount: type: integer violationCount: type: integer lastScannedAt: type: string latestScanId: type: string required: - id - name - platform - status - riskLevel - score - scanCount - violationCount - lastScannedAt - latestScanId CampaignListResponse: type: object properties: items: type: array items: $ref: "#/components/schemas/CampaignSummary" total: type: integer page: type: integer pageSize: type: integer required: - items - total - page - pageSize ForgotPasswordRequest: type: object properties: email: type: string required: - email ForgotPasswordResponse: type: object properties: success: type: boolean message: type: string required: - success - message ResetPasswordRequest: type: object properties: token: type: string password: type: string minLength: 8 required: - token - password ResetPasswordResponse: type: object properties: success: type: boolean message: type: string required: - success - message Violation: type: object properties: id: type: string platform: $ref: "#/components/schemas/AdPlatform" severity: $ref: "#/components/schemas/RiskLevel" title: type: string description: type: string fixSuggestion: type: string required: - id - platform - severity - title - description - fixSuggestion RewriteSuggestion: type: object properties: id: type: string title: type: string copy: type: string complianceScore: type: integer required: - id - title - copy - complianceScore TimelineEvent: type: object properties: id: type: string label: type: string at: type: string status: type: string required: - id - label - at - status LandingPageAudit: type: object properties: disclaimer: type: string privacyPolicy: type: string contactInfo: type: string mobileFriendly: type: string required: - disclaimer - privacyPolicy - contactInfo - mobileFriendly CampaignReport: type: object properties: campaign: $ref: "#/components/schemas/CampaignSummary" summary: $ref: "#/components/schemas/PlatformScore" platformScores: type: array items: $ref: "#/components/schemas/PlatformScore" violations: type: array items: $ref: "#/components/schemas/Violation" rewriteSuggestions: type: array items: $ref: "#/components/schemas/RewriteSuggestion" timeline: type: array items: $ref: "#/components/schemas/TimelineEvent" landingPageAudit: $ref: "#/components/schemas/LandingPageAudit" required: - campaign - summary - platformScores - violations - rewriteSuggestions - timeline - landingPageAudit ScanStatus: type: string enum: [pending, running, completed, failed] CreateScanRequest: type: object properties: campaignName: type: string platforms: type: array minItems: 1 items: $ref: "#/components/schemas/AdPlatform" primaryText: type: string headline: type: string description: type: string landingPageUrl: type: string imageUrl: type: string videoThumbUrl: type: string projectId: type: string required: - campaignName - platforms - primaryText CreateScanResponse: type: object properties: scanId: type: string reportUrl: type: string required: - scanId - reportUrl ScanInput: type: object properties: campaignName: type: string primaryText: type: string headline: type: string description: type: string landingPageUrl: type: string imageUrl: type: string videoThumbUrl: type: string platforms: type: array items: $ref: "#/components/schemas/AdPlatform" required: - campaignName - primaryText - platforms ScanSummary: type: object properties: scanId: type: string campaignId: type: string campaignName: type: string status: $ref: "#/components/schemas/ScanStatus" platform: $ref: "#/components/schemas/AdPlatform" riskLevel: $ref: "#/components/schemas/RiskLevel" passProbability: type: number createdAt: type: string required: - scanId - campaignId - campaignName - status - platform - riskLevel - passProbability - createdAt ScanListResponse: type: object properties: items: type: array items: $ref: "#/components/schemas/ScanSummary" total: type: integer required: - items - total UploadMediaRequest: type: object properties: kind: type: string enum: [image, video_thumb] filename: type: string contentBase64: type: string required: - kind - filename - contentBase64 UploadMediaResponse: type: object properties: assetUrl: type: string kind: type: string enum: [image, video_thumb] filename: type: string required: - assetUrl - kind - filename ScanDetail: type: object properties: scanId: type: string campaignId: type: string status: $ref: "#/components/schemas/ScanStatus" createdAt: type: string input: $ref: "#/components/schemas/ScanInput" summary: $ref: "#/components/schemas/PlatformScore" platformScores: type: array items: $ref: "#/components/schemas/PlatformScore" violations: type: array items: $ref: "#/components/schemas/Violation" rewriteSuggestions: type: array items: $ref: "#/components/schemas/RewriteSuggestion" timeline: type: array items: $ref: "#/components/schemas/TimelineEvent" landingPageAudit: $ref: "#/components/schemas/LandingPageAudit" landingAuditFindings: type: array items: $ref: "#/components/schemas/LandingAuditFinding" required: - scanId - campaignId - status - createdAt - input - summary - platformScores - violations - rewriteSuggestions - timeline LandingAuditFinding: type: object properties: category: type: string status: type: string detail: type: string required: - category - status - detail Organization: type: object properties: id: type: string name: type: string createdAt: type: string required: - id - name - createdAt OrganizationListResponse: type: object properties: items: type: array items: $ref: "#/components/schemas/Organization" total: type: integer required: - items - total CreateOrganizationRequest: type: object properties: name: type: string required: - name Project: type: object properties: id: type: string organizationId: type: string name: type: string createdAt: type: string required: - id - organizationId - name - createdAt ProjectListResponse: type: object properties: items: type: array items: $ref: "#/components/schemas/Project" total: type: integer required: - items - total CreateProjectRequest: type: object properties: organizationId: type: string name: type: string required: - organizationId - name User: type: object properties: id: type: string email: type: string name: type: string role: type: string required: - id - email - name - role LoginRequest: type: object properties: email: type: string password: type: string required: - email - password UpdateProfileRequest: type: object properties: name: type: string minLength: 1 maxLength: 120 required: - name AuthSession: type: object properties: user: $ref: "#/components/schemas/User" required: - user LogoutResponse: type: object properties: success: type: boolean required: - success OnboardingCompleteRequest: type: object properties: businessName: type: string industry: type: string website: type: string platforms: type: array minItems: 1 items: $ref: "#/components/schemas/AdPlatform" projectName: type: string required: - businessName - industry - platforms - projectName OnboardingCompleteResponse: type: object properties: success: type: boolean organizationId: type: string organizationName: type: string projectId: type: string projectName: type: string required: - success - organizationId - organizationName - projectId - projectName